Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageRouting ¶ added in v1.3.0
type MessageRouting interface { // SendMessage forward messages to peers // if no connection has been established with the target peer, the message is sent directly to the target peer. // if no connection is established with the target peer, a few peers closest to the target peer // will be selected from the peers that have established connections to send routing messages. // if the peer receives the routing message request and finds that the target peer is not itself, // it will repeat the forwarding action again, and will select several peers closest to the target peer // from the peers that have established connections to send the routing message. // the forwarding of the message is terminated until the target peer receives the message or the message expires. SendMessage(ctx context.Context, service string, protocolID protocol.ID, targetPeerId peer.ID, msgPayload []byte, timeout time.Duration, waitResp bool) (peer.AddrInfo, error) }
MessageRouting forward messages to peers not directly connected
type PeerRouting ¶
type PeerRouting interface { // FindPeer searches for a peer with given ID FindPeer(ctx context.Context, service string, targetPeerId peer.ID, timeout time.Duration) (peer.AddrInfo, error) }
PeerRouting provides a way to query the net address of the peer in network.
type ProtocolRouting ¶
type ProtocolRouting interface { // FindPeerSupportProtocolsAsync searches for a peer with given protocol id list FindPeerSupportProtocolsAsync(context.Context, int, ...protocol.ID) <-chan peer.AddrInfo }
ProtocolRouting provides a way to query the net addresses of the peers who support protocols given.
type Routing ¶
type Routing interface { ProtocolRouting MessageRouting }
Routing service upper interface
Click to show internal directories.
Click to hide internal directories.