Documentation
¶
Index ¶
- func ToAddrInfos(addrs []string) ([]peer.AddrInfo, error)
- func ToMultiaddrs(addr []string) ([]multiaddr.Multiaddr, error)
- type Config
- type HostWrapper
- func (n *HostWrapper) Close() error
- func (n *HostWrapper) ConnectToPeer(ctx context.Context, addrs ...multiaddr.Multiaddr) error
- func (n *HostWrapper) GetFullAddresses() []multiaddr.Multiaddr
- func (n *HostWrapper) GetMetrics() metrics.MetricsSnapshot
- func (n *HostWrapper) Peers() []peer.ID
- func (n *HostWrapper) Receive(ctx context.Context, want cid.Cid) (peer.ID, []byte, error)
- func (n *HostWrapper) Send(ctx context.Context, to peer.ID, payload []byte) (cid.Cid, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
ProtocolID string
MaxPayload uint64
Timeout time.Duration
ListenAddrs []string
UseTLS bool
UseNoise bool
// Ask router via UPnP/NAT-PMP/PCP to map inbound ports.
// Use on home/office public IPv4; ineffective under CGNAT/double NAT.
NATPortMap bool
// Enable DCUtR to form direct connections through NATs.
// Best with relay candidates; helpful when port mapping fails.
HolePunching bool
// Fixed relay candidates for AutoRelay v2 (/p2p-circuit).
// Use behind CGNAT/strict NAT for predictable reachability.
StaticRelays []string
// Dynamic supplier of relay candidates when StaticRelays is empty.
// AutoRelay requests up to numPeers; send then close the channel.
PeerSource autorelay.PeerSource
// Run THIS node as a public relay (HOP).
// Use on well-connected/public hosts; clients usually keep OFF.
RelayService bool
}
type HostWrapper ¶
func New ¶
func New(cfg *Config) (*HostWrapper, error)
func (*HostWrapper) Close ¶
func (n *HostWrapper) Close() error
func (*HostWrapper) ConnectToPeer ¶
func (*HostWrapper) GetFullAddresses ¶
func (n *HostWrapper) GetFullAddresses() []multiaddr.Multiaddr
func (*HostWrapper) GetMetrics ¶
func (n *HostWrapper) GetMetrics() metrics.MetricsSnapshot
GetMetrics returns the current metrics for this network wrapper
func (*HostWrapper) Peers ¶
func (n *HostWrapper) Peers() []peer.ID
Click to show internal directories.
Click to hide internal directories.