discovery

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: 9 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 AddrParser added in v0.0.3

type AddrParser = p2p.AddrParser[TransportAddr]

type AddressBook

type AddressBook interface {
	SetAddrs(x inet256.Addr, addrs []TransportAddr)
	ListPeers() []inet256.Addr
}

type AnnounceFunc

type AnnounceFunc = func(ctx context.Context, privateKey inet256.PrivateKey, addrs []string, ttl time.Duration) error

type FindFunc

type FindFunc = func(ctx context.Context, x inet256.Addr) ([]string, error)

type Params

type Params struct {
	// Announcing
	PrivateKey    inet256.PrivateKey
	LocalID       inet256.Addr
	GetLocalAddrs func() []TransportAddr

	// Finding
	AddressBook AddressBook
	AddrParser  p2p.AddrParser[TransportAddr]
}

type PollingDiscovery added in v0.0.3

type PollingDiscovery struct {
	Period   time.Duration
	Announce AnnounceFunc
	Find     FindFunc
}

func (*PollingDiscovery) Run added in v0.0.3

func (s *PollingDiscovery) Run(ctx context.Context, params Params) error

type Service

type Service interface {
	Run(ctx context.Context, params Params) error
}

type TransportAddr added in v0.0.3

type TransportAddr = multiswarm.Addr

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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