p2p

package
v0.0.0-...-4fce9dd Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const DiscoveryInterval = time.Second * 10

DiscoveryInterval is how often we search for other peers via the DHT.

View Source
const DiscoveryServiceTag = "erebrus"

DiscoveryServiceTag is used in our DHT advertisements to discover other peers.

Variables

View Source
var Host host.Host

Add this variable to store the host instance

View Source
var StartTimeStamp int64

Functions

func Discover

func Discover(ctx context.Context, h host.Host, dht *dht.IpfsDHT, rendezvous string)

Search the DHT for peers, then connect to them.

func GetHost

func GetHost() host.Host

Add a function to get the Host

func Init

func Init()

func InitHost

func InitHost() error

InitHost initializes the LibP2P host

func NewDHT

func NewDHT(ctx context.Context, host host.Host, bootstrapPeers []multiaddr.Multiaddr) (*dht.IpfsDHT, error)

NewDHT attempts to connect to a bunch of bootstrap peers and returns a new DHT. If you don't have any bootstrapPeers, you can use dht.DefaultBootstrapPeers or an empty list.

Types

This section is empty.

Jump to

Keyboard shortcuts

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