Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ProtocolDataTransfer is the protocol identifier for graphsync messages ProtocolDataTransfer protocol.ID = "/fil/datatransfer/1.0.0" )
Functions ¶
This section is empty.
Types ¶
type DataTransferNetwork ¶
type DataTransferNetwork interface {
Protect(id peer.ID, tag string)
Unprotect(id peer.ID, tag string) bool
// SendMessage sends a GraphSync message to a peer.
SendMessage(
context.Context,
peer.ID,
datatransfer.Message) error
// SetDelegate registers the Reciver to handle messages received from the
// network.
SetDelegate(Receiver)
// ConnectTo establishes a connection to the given peer
ConnectTo(context.Context, peer.ID) error
// ID returns the peer id of this libp2p host
ID() peer.ID
}
DataTransferNetwork provides network connectivity for GraphSync.
func NewFromLibp2pHost ¶
func NewFromLibp2pHost(host host.Host) DataTransferNetwork
NewFromLibp2pHost returns a GraphSyncNetwork supported by underlying Libp2p host.
type Receiver ¶
type Receiver interface {
ReceiveRequest(
ctx context.Context,
sender peer.ID,
incoming datatransfer.Request)
ReceiveResponse(
ctx context.Context,
sender peer.ID,
incoming datatransfer.Response)
ReceiveError(error)
}
Receiver is an interface for receiving messages from the GraphSyncNetwork.
Click to show internal directories.
Click to hide internal directories.