Documentation
¶
Index ¶
- Constants
- func DefaultListenAddrs() []multiaddr.Multiaddr
- func UnicastListenAddrs() []multiaddr.Multiaddr
- type BootstrapPeerDebugInfo
- type ConnectionInfo
- type Duration
- type HostConfig
- type IDService
- type P2p
- func (p *P2p) AnnouncedAs() []multiaddr.Multiaddr
- func (p *P2p) Bootstrap()
- func (p *P2p) BootstrapPeersStats() (int, int)
- func (p *P2p) BootstrapPeersStatsDetailed() map[string]BootstrapPeerDebugInfo
- func (p *P2p) ClearBackoff(peerID peer.ID)
- func (p *P2p) Close() error
- func (p *P2p) ConfirmedAddrs() (reachable []multiaddr.Multiaddr, unreachable []multiaddr.Multiaddr, ...)
- func (p *P2p) ConnectPeer(ctx context.Context, peerID peer.ID) error
- func (p *P2p) ConnectedPeersCount() int
- func (p *P2p) ConnectionsLastTrimAgo() time.Duration
- func (p *P2p) FindPeer(ctx context.Context, id peer.ID) (peer.AddrInfo, error)
- func (p *P2p) GetPeerLatency(id peer.ID) time.Duration
- func (p *P2p) Host() host.Host
- func (p *P2p) IDService() IDService
- func (p *P2p) InitHost(hostConfig HostConfig) (host.Host, error)
- func (p *P2p) IsConnected(peerID peer.ID) bool
- func (p *P2p) MaintainBackgroundConnections(ctx context.Context, interval time.Duration, ...)
- func (p *P2p) NetworkSize() (int32, error)
- func (p *P2p) NetworkStats() metrics.Stats
- func (p *P2p) NetworkStatsByPeer() map[peer.ID]metrics.Stats
- func (p *P2p) NetworkStatsByProtocol() map[protocol.ID]metrics.Stats
- func (p *P2p) NetworkStatsForPeer(peerID peer.ID) metrics.Stats
- func (p *P2p) NewStream(ctx context.Context, id peer.ID, proto protocol.ID) (network.Stream, error)
- func (p *P2p) NewStreamMulti(ctx context.Context, id peer.ID, protos ...protocol.ID) (network.Stream, error)
- func (p *P2p) NewStreamWithDedicatedConn(ctx context.Context, id peer.ID, proto protocol.ID) (network.Stream, error)
- func (p *P2p) OpenConnectionsCount() int
- func (p *P2p) OpenStreamStats() map[protocol.ID]map[string]int
- func (p *P2p) OpenStreamsCount() int64
- func (p *P2p) PeerConnectionsInfo(peerID peer.ID) []ConnectionInfo
- func (p *P2p) PeerID() peer.ID
- func (p *P2p) PeerUserAgent(peerID peer.ID) string
- func (p *P2p) PeersWithAddrsCount() int
- func (p *P2p) ProtectPeer(id peer.ID)
- func (p *P2p) Reachability() network.Reachability
- func (p *P2p) RecordPeerLatency(id peer.ID, rtt time.Duration)
- func (p *P2p) RoutingTablePeers() []kbucket.PeerInfo
- func (p *P2p) RoutingTableSize() int
- func (p *P2p) SubscribeConnectionEvents(onConnected, onDisconnected func(network.Network, network.Conn))
- func (p *P2p) UnprotectPeer(id peer.ID)
- func (p *P2p) Uptime() time.Duration
Constants ¶
View Source
const ( DesiredRelays = 2 RelayBootDelay = 20 * time.Second DHTProtocolPrefix protocol.ID = "/awl" )
Variables ¶
This section is empty.
Functions ¶
func DefaultListenAddrs ¶
func UnicastListenAddrs ¶
Types ¶
type BootstrapPeerDebugInfo ¶
type ConnectionInfo ¶
type Duration ¶ added in v0.13.0
func (Duration) MarshalJSON ¶ added in v0.13.0
func (*Duration) UnmarshalJSON ¶ added in v0.13.0
type HostConfig ¶
type HostConfig struct {
PrivKeyBytes []byte
ListenAddrs []multiaddr.Multiaddr
UserAgent string
BootstrapPeers []peer.AddrInfo
AllowEmptyBootstrapPeers bool
EnableAutoRelay bool
Libp2pOpts []libp2p.Option
ConnManager struct {
LowWater int
HighWater int
GracePeriod time.Duration
}
Peerstore peerstore.Peerstore
DHTDatastore ds.Batching
DHTOpts []dht.Option
}
type IDService ¶
type IDService interface {
// IdentifyConn synchronously triggers an identify request on the connection and
// waits for it to complete. If the connection is being identified by another
// caller, this call will wait. If the connection has already been identified,
// it will return immediately.
IdentifyConn(network.Conn)
// IdentifyWait triggers an identify (if the connection has not already been
// identified) and returns a channel that is closed when the identify protocol
// completes.
IdentifyWait(network.Conn) <-chan struct{}
}
type P2p ¶
type P2p struct {
// contains filtered or unexported fields
}
func (*P2p) AnnouncedAs ¶
func (*P2p) BootstrapPeersStats ¶
BootstrapPeersStats returns total peers count and connected count.
func (*P2p) BootstrapPeersStatsDetailed ¶
func (p *P2p) BootstrapPeersStatsDetailed() map[string]BootstrapPeerDebugInfo
func (*P2p) ClearBackoff ¶
func (*P2p) ConfirmedAddrs ¶ added in v0.14.0
func (*P2p) ConnectedPeersCount ¶
func (*P2p) ConnectionsLastTrimAgo ¶
func (*P2p) GetPeerLatency ¶ added in v0.14.0
func (*P2p) MaintainBackgroundConnections ¶
func (*P2p) NetworkSize ¶ added in v0.8.0
func (*P2p) NetworkStats ¶
func (*P2p) NetworkStatsByProtocol ¶
func (*P2p) NewStreamMulti ¶ added in v0.17.0
func (*P2p) NewStreamWithDedicatedConn ¶ added in v0.11.0
func (*P2p) OpenConnectionsCount ¶
func (*P2p) OpenStreamsCount ¶
func (*P2p) PeerConnectionsInfo ¶
func (p *P2p) PeerConnectionsInfo(peerID peer.ID) []ConnectionInfo
func (*P2p) PeersWithAddrsCount ¶
func (*P2p) ProtectPeer ¶
func (*P2p) Reachability ¶
func (p *P2p) Reachability() network.Reachability
func (*P2p) RecordPeerLatency ¶ added in v0.14.0
func (*P2p) RoutingTablePeers ¶
func (*P2p) RoutingTableSize ¶
func (*P2p) SubscribeConnectionEvents ¶
func (*P2p) UnprotectPeer ¶
Click to show internal directories.
Click to hide internal directories.