libp2p

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL