networks

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TransportMTU is the guaranteed MTU presented to networks.
	TransportMTU = (1 << 16) - 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr = inet256.Addr

type Factory

type Factory func(Params) Network

NetworkFactory is a constructor for a network

type Logger

type Logger = logrus.Logger

type Network

type Network interface {
	p2p.Teller[inet256.Addr]
	p2p.Secure[inet256.Addr]
	LocalAddr() inet256.Addr
	MTU(context.Context, inet256.Addr) int
	FindAddr(ctx context.Context, prefix []byte, nbits int) (inet256.Addr, error)

	Bootstrap(ctx context.Context) error
	Close() error
}

Network is an instantiated network routing algorithm

This interface is not described in the spec, and is incidental to the implementation.

type Params

type Params struct {
	PrivateKey PrivateKey
	Swarm      Swarm
	Peers      PeerSet

	Logger *Logger
}

Params are passed to a NetworkFactory to create a Network. This type really defines the problem domain quite well. Essentially it is a set of one-hop peers and a means to send messages to them.

type PeerSet

type PeerSet = peers.Set

type PrivateKey

type PrivateKey = inet256.PrivateKey

type PublicKey

type PublicKey = inet256.PublicKey

type ReceiveFunc

type ReceiveFunc = inet256.ReceiveFunc

type Swarm

type Swarm interface {
	p2p.Teller[inet256.Addr]
	Close() error
	LookupPublicKey(ctx context.Context, addr Addr) (PublicKey, error)
	PublicKey() PublicKey
	LocalAddr() Addr
	MTU(ctx context.Context, addr Addr) int
}

Swarm is similar to a p2p.Swarm, but uses inet256.Addrs instead of p2p.Addrs

This interface is not described in the spec, and is incidental to the implementation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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