Skip to content

DE-labtory/bifrost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Bifrost

Build Status License Language Coverage Status

Bifrost is a grpc-based P2P network library

(In Norse mythology, Bifrรถst is a burning rainbow bridge that reaches between Midgard and Asgard, the realm of the gods.)

Getting Started with Bifrost

Installation

go get -u github.com/DE-labtory/bifrost

Usage

Server

import (
  "github.com/DE-labtory/bifrost/pb"
	"github.com/DE-labtory/bifrost/server"
)

// connection control
ConnectionStore := bifrost.NewConnectionStore()

// server listen
s := server.New(bifrost.KeyOpts{PriKey: priKey, PubKey: pubKey})
server.Listen(_gRPCatewayIP_)

Client

import (
  "github.com/DE-labtory/bifrost/client"
)
connection, err := client.Dial(command.Address, clientOpt, grpcOpt) //ํ”ํžˆ cli ์—์„œ ์ด๋ฃจ์–ด์ง
connection.send(payload []byte, protocol string, successCallBack func(interface{}), errCallBack func(error)) //connection GrpcConnection

Document

process buffer

bifrost ๊ฐ€ grpc ์„œ๋น„์Šค๋ฅผ ๊ตฌ์ถ•ํ•˜๊ธฐ ์œ„ํ•ด stream.proto file ์„ ์ž‘์„ฑํ•˜์˜€์œผ๋ฉฐ, ์ด๋Š” protoc ์— ์˜ํ•ด compile ๋˜์–ด go ์ฝ”๋“œ๋กœ ๋ณ€ํ™˜๋œ๋‹ค. stream.proto file ์— ๋Œ€ํ•ด ๊ฐ„๋‹จํžˆ ์†Œ๊ฐœํ•˜์ž๋ฉด StreamService ๋ผ๋Š” ๊ตฌ์กฐ์ฒด๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ BifrostStream์ด๋ผ๋Š” ํ•จ์ˆ˜๋ฅผ ๊ฐ€์ง€๋ฉฐ, Envelope ๋ผ๋Š” ์ž๋ฃŒํ˜•์„ ์ถ”๊ฐ€๋กœ ๊ตฌ์„ฑํ•œ๋‹ค.

์„œ๋ฒ„์ธก์—์„œ RegisterStreamServiceServer ๋ฅผ ํ†ตํ•ด ์„œ๋ฒ„๋ฅผ ๋“ฑ๋กํ•˜๊ณ  ํด๋ผ์ด์–ธํŠธ ์ธก์—์„œ NewStreamServiceClient ๋ฅผ ํ†ตํ•ด streamServiceClient ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ณ , streamServiceClient.BifrostStream ์„ ํ˜ธ์ถœํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ Envelop ๋ฅผ ์†ก์ˆ˜์‹  ํ•œ๋‹ค.

data structure

Bifrost Data Structure

Lincese

Bifrost source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file.