autopeering

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunForever

func RunForever(ctx context.Context, srv Service, params Params)

Types

type AddrSource

type AddrSource = func() []TransportAddr

AddrSource returns a list of addresses suitable for advertisement.

type Params

type Params struct {
	// Outbound
	LocalAddr  inet256.Addr
	AddrSource AddrSource

	// Inbound
	PeerStore peers.Store[TransportAddr]
	ParseAddr func([]byte) (TransportAddr, error)
}

type Service

type Service interface {
	// Run should run until the context is cancelled, calling params.AddrSource to
	// get the local addresses, and storing discovered addresses in params.PeerStore
	Run(ctx context.Context, params Params) error
}

Service manages the peers in a PeerStore, adding to and removing from them automatically as peers are discovered and lost.

type TransportAddr added in v0.0.3

type TransportAddr = multiswarm.Addr

Jump to

Keyboard shortcuts

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