routing

package
v0.0.0-...-3231407 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerInfo

type PeerInfo struct {
	peer.ID
	Addr string
}

PeerInfo describes a peer.

type PeerNotFoundError

type PeerNotFoundError struct {
	// contains filtered or unexported fields
}

PeerNotFoundError indicates that no peer could be found for the given key.

type Router

type Router interface {
	// Net returns the network interface.
	Net() peernet.Network

	// Resolve resolves the given key to a peer address.
	Resolve(ctx context.Context, key string, allowSelf bool, count int) (<-chan PeerInfo, error)

	// ResolveWithCache is like Resolve but it also returns a function callback that can be used to cache that a key could not be resolved.
	ResolveWithCache(ctx context.Context, key string, allowSelf bool, count int) (<-chan PeerInfo, func(), error)

	// Advertise advertises the given keys to the network.
	Advertise(ctx context.Context, keys []string) error

	// Close closes the router.
	Close() error
}

Router provides an interface to a peered network.

func NewRouter

func NewRouter(ctx context.Context, routerAddr, serverPort string) (Router, error)

NewRouter creates a new router.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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