Documentation
¶
Overview ¶
package net provides an interface for ipfs to interact with the network through
Index ¶
- type Dialer
- type Handler
- type IpfsNetwork
- func (n *IpfsNetwork) ClosePeer(p peer.Peer) error
- func (n *IpfsNetwork) DialPeer(ctx context.Context, p peer.Peer) error
- func (n *IpfsNetwork) GetBandwidthTotals() (in uint64, out uint64)
- func (n *IpfsNetwork) GetConnections() []conn.Conn
- func (n *IpfsNetwork) GetPeerList() []peer.Peer
- func (n *IpfsNetwork) GetProtocols() *mux.ProtocolMap
- func (n *IpfsNetwork) InterfaceListenAddresses() ([]ma.Multiaddr, error)
- func (n *IpfsNetwork) IsConnected(p peer.Peer) (bool, error)
- func (n *IpfsNetwork) ListenAddresses() []ma.Multiaddr
- func (n *IpfsNetwork) SendMessage(m msg.NetMessage) error
- type Network
- type Sender
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dialer ¶
type Dialer interface {
// DialPeer attempts to establish a connection to a given peer
DialPeer(context.Context, peer.Peer) error
}
Dialer represents a service that can dial out to peers (this is usually just a Network, but other services may not need the whole stack, and thus it becomes easier to mock)
type IpfsNetwork ¶
type IpfsNetwork struct {
// network context closer
ctxc.ContextCloser
// contains filtered or unexported fields
}
IpfsNetwork implements the Network interface,
func NewIpfsNetwork ¶
func NewIpfsNetwork(ctx context.Context, listen []ma.Multiaddr, local peer.Peer,
peers peer.Peerstore, pmap *mux.ProtocolMap) (*IpfsNetwork, error)
NewIpfsNetwork is the structure that implements the network interface
func (*IpfsNetwork) ClosePeer ¶
func (n *IpfsNetwork) ClosePeer(p peer.Peer) error
ClosePeer connection to peer
func (*IpfsNetwork) DialPeer ¶
func (n *IpfsNetwork) DialPeer(ctx context.Context, p peer.Peer) error
DialPeer attempts to establish a connection to a given peer. Respects the context.
func (*IpfsNetwork) GetBandwidthTotals ¶
func (n *IpfsNetwork) GetBandwidthTotals() (in uint64, out uint64)
GetBandwidthTotals returns the total amount of bandwidth transferred
func (*IpfsNetwork) GetConnections ¶
func (n *IpfsNetwork) GetConnections() []conn.Conn
GetConnections returns the networks list of open connections
func (*IpfsNetwork) GetPeerList ¶
func (n *IpfsNetwork) GetPeerList() []peer.Peer
GetPeerList returns the networks list of connected peers
func (*IpfsNetwork) GetProtocols ¶
func (n *IpfsNetwork) GetProtocols() *mux.ProtocolMap
GetProtocols returns the protocols registered in the network.
func (*IpfsNetwork) InterfaceListenAddresses ¶
func (n *IpfsNetwork) InterfaceListenAddresses() ([]ma.Multiaddr, error)
InterfaceListenAddresses returns a list of addresses at which this network listens. It expands "any interface" addresses (/ip4/0.0.0.0, /ip6/::) to use the known local interfaces.
func (*IpfsNetwork) IsConnected ¶
func (n *IpfsNetwork) IsConnected(p peer.Peer) (bool, error)
IsConnected returns whether a connection to given peer exists.
func (*IpfsNetwork) ListenAddresses ¶
func (n *IpfsNetwork) ListenAddresses() []ma.Multiaddr
ListenAddresses returns a list of addresses at which this network listens.
func (*IpfsNetwork) SendMessage ¶
func (n *IpfsNetwork) SendMessage(m msg.NetMessage) error
SendMessage sends given Message out
type Network ¶
type Network interface {
ctxc.ContextCloser
// DialPeer attempts to establish a connection to a given peer
DialPeer(context.Context, peer.Peer) error
// ClosePeer connection to peer
ClosePeer(peer.Peer) error
// IsConnected returns whether a connection to given peer exists.
IsConnected(peer.Peer) (bool, error)
// GetProtocols returns the protocols registered in the network.
GetProtocols() *mux.ProtocolMap
// GetPeerList returns the list of peers currently connected in this network.
GetPeerList() []peer.Peer
// GetConnections returns the list of connections currently open in this network.
GetConnections() []conn.Conn
// GetBandwidthTotals returns the total number of bytes passed through
// the network since it was instantiated
GetBandwidthTotals() (uint64, uint64)
// SendMessage sends given Message out
SendMessage(msg.NetMessage) error
// ListenAddresses returns a list of addresses at which this network listens.
ListenAddresses() []ma.Multiaddr
// InterfaceListenAddresses returns a list of addresses at which this network
// listens. It expands "any interface" addresses (/ip4/0.0.0.0, /ip6/::) to
// use the known local interfaces.
InterfaceListenAddresses() ([]ma.Multiaddr, error)
}
Network is the interface IPFS uses for connecting to the world.
Directories
¶
Path | Synopsis |
---|---|
package handshake implements the ipfs handshake protocol
|
package handshake implements the ipfs handshake protocol |
pb
Package handshake_pb is a generated protocol buffer package.
|
Package handshake_pb is a generated protocol buffer package. |
package mux implements a protocol muxer.
|
package mux implements a protocol muxer. |
package swarm implements a connection muxer with a pair of channels to synchronize all network communication.
|
package swarm implements a connection muxer with a pair of channels to synchronize all network communication. |