networking

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 20 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// MaxOCRMsgLength is the maximum allowed length for a data payload in bytes
	// This is exported as serialization tests depend on it.
	// NOTE: This is slightly larger than 2x of the largest message we can
	// possibly send, assuming N=31.
	MaxOCRMsgLength = 10000
)

Variables

This section is empty.

Functions

func NewPeer

func NewPeer(c PeerConfig) (*concretePeerV2, error)

Users are expected to create (using the OCR*Factory() methods) and close endpoints and bootstrappers before calling Close() on the peer itself.

Types

type BinaryNetworkEndpointLimits

type BinaryNetworkEndpointLimits struct {
	MaxMessageLength          int
	MessagesRatePerOracle     float64
	MessagesCapacityPerOracle int
	BytesRatePerOracle        float64
	BytesCapacityPerOracle    int
}

type EndpointConfigV2

type EndpointConfigV2 struct {
	// IncomingMessageBufferSize is the per-remote number of incoming
	// messages to buffer. Any additional messages received on top of those
	// already in the queue will be dropped.
	IncomingMessageBufferSize int

	// OutgoingMessageBufferSize is the per-remote number of outgoing
	// messages to buffer. Any additional messages send on top of those
	// already in the queue will displace the oldest.
	// NOTE: OutgoingMessageBufferSize should be comfortably smaller than remote's
	// IncomingMessageBufferSize to give the remote enough space to process
	// them all in case we regained connection and now send a bunch at once
	OutgoingMessageBufferSize int
}

type PeerConfig

type PeerConfig struct {
	PrivKey ed25519.PrivateKey
	Logger  commontypes.Logger

	// V2ListenAddresses contains the addresses the peer will listen to on the network in <ip>:<port> form as
	// accepted by net.Listen.
	V2ListenAddresses []string

	// V2AnnounceAddresses contains the addresses the peer will advertise on the network in <host>:<port> form as
	// accepted by net.Dial. The addresses should be reachable by peers of interest.
	// May be left unspecified, in which case the announce addresses are auto-detected based on V2ListenAddresses.
	V2AnnounceAddresses []string

	// Every V2DeltaReconcile a Reconcile message is sent to every peer.
	V2DeltaReconcile time.Duration

	// Dial attempts will be at least V2DeltaDial apart.
	V2DeltaDial time.Duration

	V2DiscovererDatabase nettypes.DiscovererDatabase

	V2EndpointConfig EndpointConfigV2

	MetricsRegisterer prometheus.Registerer

	LatencyMetricsServiceConfigs []*rageping.LatencyMetricsServiceConfig
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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