Documentation
¶
Index ¶
- Variables
- type Host
- func (h *Host) Addrs() []string
- func (h *Host) Close() error
- func (h *Host) Connect(ctx context.Context, addr string) error
- func (h *Host) DHT() *dht.IpfsDHT
- func (h *Host) EnableMDNS(ctx context.Context) error
- func (h *Host) GetNetworkStats() NetworkStats
- func (h *Host) ID() string
- func (h *Host) LibP2PHost() host.Host
- func (h *Host) NewStream(ctx context.Context, peerID string, protocolID string) (types.Stream, error)
- func (h *Host) Peers() []PeerInfo
- func (h *Host) SetStreamHandler(protocolID string, handler types.StreamHandler)
- func (h *Host) StartDiagnosticLogging(ctx context.Context, interval time.Duration)
- type HostConfig
- type NetworkStats
- type PeerInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultBootstrapPeers = []string{
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
}
DefaultBootstrapPeers are the default IPFS bootstrap nodes
Functions ¶
This section is empty.
Types ¶
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host wraps libp2p host
func (*Host) DHT ¶ added in v0.3.0
DHT returns the DHT routing table (may be nil if DHT is disabled)
func (*Host) EnableMDNS ¶
EnableMDNS enables mDNS discovery
func (*Host) GetNetworkStats ¶ added in v0.3.0
func (h *Host) GetNetworkStats() NetworkStats
GetNetworkStats returns current network statistics
func (*Host) LibP2PHost ¶ added in v0.3.0
LibP2PHost returns the underlying libp2p host for advanced usage
func (*Host) NewStream ¶
func (h *Host) NewStream(ctx context.Context, peerID string, protocolID string) (types.Stream, error)
NewStream creates a new stream to a peer
func (*Host) SetStreamHandler ¶
func (h *Host) SetStreamHandler(protocolID string, handler types.StreamHandler)
SetStreamHandler registers a handler for incoming streams
type HostConfig ¶
type HostConfig struct {
// ListenAddrs are the multiaddrs to listen on
ListenAddrs []string
// PSK is the pre-shared key for private network (hex-encoded)
PSK string
// EnableAuth enables PSK authentication
EnableAuth bool
// TrustedPeers are peer IDs allowed to connect (if non-empty)
TrustedPeers []string
// BootstrapPeers are initial peers to connect to
BootstrapPeers []string
// DisableDHT disables Distributed Hash Table for peer discovery
DisableDHT bool
// DHTMode is the DHT mode: "client" or "server" (default: "server")
DHTMode string
// DisableNATService disables NAT traversal service
DisableNATService bool
// DisableAutoRelay disables automatic relay for NAT traversal
DisableAutoRelay bool
// DisableHolePunching disables hole punching for direct connections
DisableHolePunching bool
// DisableRelayService disables this node from acting as a relay server
DisableRelayService bool
// StaticRelays are static relay addresses for NAT traversal
// If provided, these will be used instead of DHT-based relay discovery
StaticRelays []string
}
HostConfig contains configuration for creating a P2P host
type NetworkStats ¶ added in v0.3.0
NetworkStats contains network diagnostic information
Click to show internal directories.
Click to hide internal directories.