autopeering

package
v0.2.4-0...-2c2ceb1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0, BSD-2-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CfgEntryNodes defines the config flag of the entry nodes.
	CfgEntryNodes = "autopeering.entryNodes"
	// CfgNetworkVersion defines the config flag of the network version.
	CfgNetworkVersion = "autopeering.networkVersion"
)
View Source
const PluginName = "Autopeering"

PluginName is the name of the autopeering plugin.

View Source
const (
	ProtocolVersion = 0 // update on protocol changes
)

autopeering constants

Variables

This section is empty.

Functions

func BindAddress

func BindAddress() string

BindAddress returns the string form of the autopeering bind address.

func Discovery

func Discovery() *discover.Protocol

Discovery returns the peer discovery instance.

func NetworkVersion

func NetworkVersion() uint32

NetworkVersion returns the network version of the autopeering.

func Plugin

func Plugin() *node.Plugin

Plugin gets the plugin instance.

func Selection

func Selection() *selection.Protocol

Selection returns the neighbor selection instance.

func StartSelection

func StartSelection()

StartSelection starts the neighbor selection process. It blocks until the peer discovery has been started. Multiple calls of StartSelection are ignored.

Types

type NetConnMetric

type NetConnMetric struct {
	*net.UDPConn
	// contains filtered or unexported fields
}

NetConnMetric is a wrapper of a UDPConn that keeps track of RX and TX bytes.

var (
	// ErrParsingMasterNode is returned for an invalid master node.
	ErrParsingMasterNode = errors.New("cannot parse master node")

	// Conn contains the network connection.
	Conn *NetConnMetric
)

func (*NetConnMetric) RXBytes

func (nc *NetConnMetric) RXBytes() uint64

RXBytes returns the RX bytes.

func (*NetConnMetric) ReadFromUDP

func (nc *NetConnMetric) ReadFromUDP(b []byte) (int, *net.UDPAddr, error)

ReadFromUDP acts like ReadFrom but returns a UDPAddr.

func (*NetConnMetric) TXBytes

func (nc *NetConnMetric) TXBytes() uint64

TXBytes returns the TX bytes.

func (*NetConnMetric) WriteToUDP

func (nc *NetConnMetric) WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)

WriteToUDP acts like WriteTo but takes a UDPAddr.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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