Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Protocol ¶
type Protocol interface { // ID returns the protocol Identifier as specified in the libp2p-core pkg ID() protocol.ID // HandleMsg is used to handle new incoming request on the host. The response is sent // back on the same stream HandleMsg(Request, peer.ID) (Response, error) // SetSender will be used to provide protocols the ability to send messages. It will // provide an interface which can be used to send the messages on the wire. This sender // can be used within the protocol to initiate message sending SetSender(Sender) // ReqFactory is used to instantiate a new object for handling the request ReqFactory() Request // RespFactory is used to instantiate a new object for handling the response RespFactory() Response }
Protocol interface defines contract to implement to have a new P2P protocol registered on the host
type ProtocolsSvc ¶
type ProtocolsSvc interface {
Register(Protocol)
}
ProtocolsSvc provides an easier interface to write P2P protocols in terms of request-response schemes
func New ¶
func New(h host.Host) ProtocolsSvc
Click to show internal directories.
Click to hide internal directories.