Documentation
¶
Index ¶
- Constants
- func AddrInfoToPeerIDs(ai []peer.AddrInfo) []peer.ID
- func FilecoinDHT(network string) protocol.ID
- func ParseAddresses(ctx context.Context, addrs []string) ([]peer.AddrInfo, error)
- func PeerAddrsToAddrInfo(addrs []string) ([]peer.AddrInfo, error)
- type IPeerMgr
- type MockPeerMgr
- func (m MockPeerMgr) AddFilecoinPeer(p peer.ID)
- func (m MockPeerMgr) Disconnect(p peer.ID)
- func (m MockPeerMgr) GetPeerLatency(p peer.ID) (time.Duration, bool)
- func (m MockPeerMgr) Run(ctx context.Context)
- func (m MockPeerMgr) SetPeerLatency(p peer.ID, latency time.Duration)
- func (m MockPeerMgr) Stop(ctx context.Context) error
- type Network
- func (network *Network) AgentVersion(ctx context.Context, p peer.ID) (string, error)
- func (network *Network) AutoNatStatus() (types.NatInfo, error)
- func (network *Network) Connect(ctx context.Context, p peer.AddrInfo) error
- func (network *Network) Connectedness(p peer.ID) (network2.Connectedness, error)
- func (network *Network) Disconnect(p peer.ID) error
- func (network *Network) GetBandwidthStats() metrics.Stats
- func (network *Network) GetBandwidthStatsByPeer() (map[string]metrics.Stats, error)
- func (network *Network) GetBandwidthStatsByProtocol() (map[protocol.ID]metrics.Stats, error)
- func (network *Network) GetPeerAddresses() []ma.Multiaddr
- func (network *Network) GetPeerID() peer.ID
- func (network *Network) PeerInfo(ctx context.Context, p peer.ID) (*types.ExtendedPeerInfo, error)
- func (network *Network) Peers(ctx context.Context) ([]peer.AddrInfo, error)
- func (network *Network) ProtectAdd(peers []peer.ID) error
- func (network *Network) ProtectList() ([]peer.ID, error)
- func (network *Network) ProtectRemove(peers []peer.ID) error
- type NewFilPeer
- type PeerMgr
- func (pmgr *PeerMgr) AddFilecoinPeer(p peer.ID)
- func (pmgr *PeerMgr) Disconnect(p peer.ID)
- func (pmgr *PeerMgr) GetPeerLatency(p peer.ID) (time.Duration, bool)
- func (pmgr *PeerMgr) Run(ctx context.Context)
- func (pmgr *PeerMgr) SetPeerLatency(p peer.ID, latency time.Duration)
- func (pmgr *PeerMgr) Stop(ctx context.Context) error
- type Router
Constants ¶
const ( MaxFilPeers = 320 MinFilPeers = 128 )
Variables ¶
This section is empty.
Functions ¶
func AddrInfoToPeerIDs ¶
AddrInfoToPeerIDs converts a slice of AddrInfo to a slice of peerID's.
func FilecoinDHT ¶
FilecoinDHT is creates a protocol for the filecoin DHT.
func ParseAddresses ¶
ParseAddresses is a function that takes in a slice of string peer addresses (multiaddr + peerid) and returns a slice of properly constructed peers
Types ¶
type MockPeerMgr ¶
type MockPeerMgr struct {
}
func (MockPeerMgr) AddFilecoinPeer ¶
func (m MockPeerMgr) AddFilecoinPeer(p peer.ID)
func (MockPeerMgr) Disconnect ¶
func (m MockPeerMgr) Disconnect(p peer.ID)
func (MockPeerMgr) GetPeerLatency ¶
func (MockPeerMgr) Run ¶
func (m MockPeerMgr) Run(ctx context.Context)
func (MockPeerMgr) SetPeerLatency ¶
func (m MockPeerMgr) SetPeerLatency(p peer.ID, latency time.Duration)
type Network ¶
Network is a unified interface for dealing with libp2p
func New ¶
func New( host host.Host, rawHost types.RawHost, router *Router, reporter metrics.Reporter, ) *Network
New returns a new Network
func (*Network) AgentVersion ¶ added in v1.6.1
AgentVersion returns agent version for a given peer id
func (*Network) AutoNatStatus ¶ added in v1.6.1
AutoNatStatus return a struct with current NAT status and public dial address
func (*Network) Connectedness ¶ added in v1.6.1
Connectedness returns a state signaling connection capabilities
func (*Network) Disconnect ¶ added in v1.6.1
Disconnect disconnect to peer at the given address
func (*Network) GetBandwidthStats ¶
GetBandwidthStats gets stats on the current bandwidth usage of the network
func (*Network) GetBandwidthStatsByPeer ¶ added in v1.6.1
GetBandwidthStatsByPeer returns statistics about the nodes bandwidth usage and current rate per peer
func (*Network) GetBandwidthStatsByProtocol ¶ added in v1.6.1
GetBandwidthStatsByProtocol returns statistics about the nodes bandwidth usage and current rate per protocol
func (*Network) GetPeerAddresses ¶
GetPeerAddresses gets the current addresses of the node
func (*Network) ProtectAdd ¶ added in v1.6.1
ProtectAdd protect peer at the given peers id
func (*Network) ProtectList ¶ added in v1.6.1
ProtectList returns the peers that are protected
type NewFilPeer ¶
type PeerMgr ¶
type PeerMgr struct {
// contains filtered or unexported fields
}
func NewPeerMgr ¶
func (*PeerMgr) AddFilecoinPeer ¶
func (*PeerMgr) Disconnect ¶
func (*PeerMgr) GetPeerLatency ¶
func (*PeerMgr) SetPeerLatency ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router exposes the methods on the internal filecoin router that are needed by the system plumbing API.