Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ProtocolRequestID - protocol header id for request traffic ProtocolRequestID string = "/od/syncreq/1.0.0" // ProtocolResponseID - protocol header id for response traffic ProtocolResponseID string = "/od/syncresp/1.0.0" )
View Source
const (
MerkleHashRequest = "MerkleHashRequest"
)
Variables ¶
View Source
var (
ErrLNodeNotInitialized = errors.New("p2p: local node not initialized")
)
Functions ¶
func ConnectToBootstrapNodes ¶
func ConnectToBootstrapNodes(ln *LNode)
ConnectToBootstrapNodes initialize connection to hardcoded ipfs nodes addr.
func GetMerkleHash ¶
func GetMerkleHash() error
Types ¶
type LNode ¶
type LNode struct { host.Host RPC // Port for tcp connection of local node to listen to. Port string // NID (Network ID) is the rendez vous point for other nodes. NID string // Peers is the list of connected peers under the same NID. Peers []peer.ID // contains filtered or unexported fields }
LNode represents a local node connection and is a wrapper around libp2p Host.
func (*LNode) GetContext ¶
GetContext return current local node context.
type RPC ¶
type RPC struct { // TODO: Might need to create a self contained context queue to timeout request pending for x amount of seconds. // ReqOut represents the queue outgoing requests from the current node. ReqOut map[string]*ReqResp // ReqIn represents a chan of incoming request to process. ReqIn chan *pb.Request // contains filtered or unexported fields }
RPC handles the data stream from/to libp2p host and stores all incoming/outgoing request until fully resolve or timeout is reached.
func (*RPC) RequestToPeer ¶
RequestToPeer opens a stream to a single peer and sends a proto request.
func (*RPC) ResponseID ¶
ResponseID returns the protol response id.
Click to show internal directories.
Click to hide internal directories.