Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ProtocolBitswapNoVers is equivalent to the legacy bitswap protocol ProtocolBitswapNoVers = internal.ProtocolBitswapNoVers // ProtocolBitswapOneZero is the prefix for the legacy bitswap protocol ProtocolBitswapOneZero = internal.ProtocolBitswapOneZero // ProtocolBitswapOneOne is the prefix for version 1.1.0 ProtocolBitswapOneOne = internal.ProtocolBitswapOneOne // ProtocolBitswap is the current version of the bitswap protocol: 1.2.0 ProtocolBitswap = internal.ProtocolBitswap )
Functions ¶
This section is empty.
Types ¶
type BitSwapNetwork ¶
type BitSwapNetwork interface { Self() peer.ID // SendMessage sends a BitSwap message to a peer. SendMessage( context.Context, peer.ID, bsmsg.BitSwapMessage) error // Start registers the Reciver and starts handling new messages, connectivity events, etc. Start(...Receiver) // Stop stops the network service. Stop() ConnectTo(context.Context, peer.ID) error DisconnectFrom(context.Context, peer.ID) error NewMessageSender(context.Context, peer.ID, *MessageSenderOpts) (MessageSender, error) ConnectionManager() connmgr.ConnManager Stats() Stats Routing Pinger }
BitSwapNetwork provides network connectivity for BitSwap sessions.
func NewFromIpfsHost ¶
func NewFromIpfsHost(host host.Host, r routing.ContentRouting, opts ...NetOpt) BitSwapNetwork
NewFromIpfsHost returns a BitSwapNetwork supported by underlying IPFS host.
type ConnectionListener ¶
type MessageSender ¶
type MessageSender interface { SendMsg(context.Context, bsmsg.BitSwapMessage) error Close() error Reset() error // Indicates whether the remote peer supports HAVE / DONT_HAVE messages SupportsHave() bool }
MessageSender is an interface for sending a series of messages over the bitswap network
type MessageSenderOpts ¶
type Pinger ¶
type Pinger interface { // Ping a peer Ping(context.Context, peer.ID) ping.Result // Get the average latency of all pings Latency(peer.ID) time.Duration }
Pinger is an interface to ping a peer and get the average latency of all pings
type Receiver ¶
type Receiver interface { ReceiveMessage( ctx context.Context, sender peer.ID, incoming bsmsg.BitSwapMessage) ReceiveError(error) // Connected/Disconnected warns bitswap about peer connections. PeerConnected(peer.ID) PeerDisconnected(peer.ID) }
Receiver is an interface that can receive messages from the BitSwapNetwork.
type Routing ¶
type Routing interface { // FindProvidersAsync returns a channel of providers for the given key. FindProvidersAsync(context.Context, cid.Cid, int) <-chan peer.ID // Provide provides the key to the network. Provide(context.Context, cid.Cid) error }
Routing is an interface to providing and finding providers on a bitswap network.
Click to show internal directories.
Click to hide internal directories.