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 ConnectionResult
- 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) Connect(ctx context.Context, addrs []string) (<-chan ConnectionResult, error)
- func (network *Network) GetBandwidthStats() metrics.Stats
- func (network *Network) GetPeerAddresses() []ma.Multiaddr
- func (network *Network) GetPeerID() peer.ID
- func (network *Network) Peers(ctx context.Context, verbose, latency, streams bool) (*SwarmConnInfos, 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
- type SwarmConnInfo
- type SwarmConnInfos
- type SwarmStreamInfo
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 ConnectionResult ¶
ConnectionResult represents the result of an attempted connection from the Connect method.
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 (*Network) Connect ¶
func (network *Network) Connect(ctx context.Context, addrs []string) (<-chan ConnectionResult, error)
Connect connects to peers at the given addresses. Does not retry.
func (*Network) GetBandwidthStats ¶
GetBandwidthStats gets stats on the current bandwidth usage of the network
func (*Network) GetPeerAddresses ¶
GetPeerAddresses gets the current addresses of the node
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.
type SwarmConnInfo ¶
type SwarmConnInfo struct { Addr string Peer string Latency string Muxer string Streams []SwarmStreamInfo }
SwarmConnInfo represents details about a single swarm connection.
func (*SwarmConnInfo) Len ¶
func (ci *SwarmConnInfo) Len() int
func (*SwarmConnInfo) Less ¶
func (ci *SwarmConnInfo) Less(i, j int) bool
func (*SwarmConnInfo) Swap ¶
func (ci *SwarmConnInfo) Swap(i, j int)
type SwarmConnInfos ¶
type SwarmConnInfos struct {
Peers []SwarmConnInfo
}
SwarmConnInfos represent details about a list of swarm connections.
func (SwarmConnInfos) Len ¶
func (ci SwarmConnInfos) Len() int
func (SwarmConnInfos) Less ¶
func (ci SwarmConnInfos) Less(i, j int) bool
func (SwarmConnInfos) Swap ¶
func (ci SwarmConnInfos) Swap(i, j int)
type SwarmStreamInfo ¶
type SwarmStreamInfo struct {
Protocol string
}
SwarmStreamInfo represents details about a single swarm stream.