Giter Site home page Giter Site logo

bifrost's Introduction

Bifrost

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/it-chain/bifrost

Usage

Server

import (
  "github.com/it-chain/bifrost/pb"
	"github.com/it-chain/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/it-chain/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

Lincese

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

bifrost's People

Contributors

frontalnh avatar hea9549 avatar junbeomlee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.