network

package
v0.0.3-beta Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeerAdded   = "PeerAdded"
	PeerRemoved = "PeerRemoved"
)
View Source
const PeerFound = "PeerFound"

Variables

This section is empty.

Functions

func Discover

func Discover(ctx context.Context, host host.Host, dht *dht.IpfsDHT, protocol protocol.ID)

Discover searches for and connects to peers that support the given protocol ID. It initializes discovery via the DHT and advertises this node. It runs discovery in a loop with a ticker, re-advertising and finding new peers. For each discovered peer, it checks if already connected, and if not, dials them.

func GetBootNodesMultiAddress

func GetBootNodesMultiAddress(bootstrapNodes []string) ([]multiaddr.Multiaddr, error)

func GetMultiAddressesForHost

func GetMultiAddressesForHost(host host.Host) ([]multiaddr.Multiaddr, error)

func GetMultiAddressesForHostQuiet

func GetMultiAddressesForHostQuiet(host host.Host) []multiaddr.Multiaddr

func GetPriorityAddress

func GetPriorityAddress(addrs []multiaddr.Multiaddr) multiaddr.Multiaddr

func WithDht

func WithDht(ctx context.Context, host host.Host, bootstrapNodes []multiaddr.Multiaddr,
	protocolId, prefix protocol.ID, peerChan chan PeerEvent, isStaked bool) (*dht.IpfsDHT, error)

func WithMDNS

func WithMDNS(host host.Host, rendezvous string, peerChan chan PeerEvent) error

Types

type PeerEvent

type PeerEvent struct {
	AddrInfo   peer.AddrInfo
	Action     string
	Source     string
	Rendezvous string
}

Jump to

Keyboard shortcuts

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