Documentation
¶
Overview ¶
Package libp2p provides discovery mechanisms using Kademlia DHT.
Index ¶
Constants ¶
View Source
const JoinProtocol = protocol.ID("/webmesh/join/0.0.1")
JoinProtocol is the protocol used for joining a mesh.
Variables ¶
This section is empty.
Functions ¶
func NewKadDHTAnnouncer ¶
func NewKadDHTAnnouncer(ctx context.Context, opts *KadDHTOptions) (meshdiscovery.Discovery, error)
NewKadDHTAnnouncer creates a new announcer for the libp2p kademlia DHT.
func NewKadDHTJoiner ¶
func NewKadDHTJoiner(ctx context.Context, opts *KadDHTOptions) (meshdiscovery.Discovery, error)
NewKadDHTJoiner creates a new joiner for the libp2p kademlia DHT.
Types ¶
type KadDHTOptions ¶
type KadDHTOptions struct {
// PSK is the pre-shared key to use as a rendezvous point for the DHT.
PSK string
// BootstrapPeers is a list of bootstrap peers to use for the DHT.
// If empty or nil, the default bootstrap peers will be used.
BootstrapPeers []multiaddr.Multiaddr
// Options are options for configuring the libp2p host.
Options []libp2p.Option
// DiscoveryTTL is the TTL to use for the discovery service.
// This is only applicable when announcing the host.
DiscoveryTTL time.Duration
}
KadDHTOptions are options for announcing the host or discovering peers on the libp2p kademlia DHT.
Click to show internal directories.
Click to hide internal directories.