physical

package
v0.0.0-...-1f64b99 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MTU (maximum transmission unit) is the maximum number of bytes that are
	// allowed on the payload of the physical layer. In reality such concept
	// does not exist. MTU is usually defined for the link layer and upwards,
	// but here we are creating a hypothetical network on top of something else,
	// which happens to be UDP in our choice. According to this reference:
	//
	// https://stackoverflow.com/a/35697810
	//
	// the practical maximum safe MTU for an IP datagram is 576 after RFCs 791
	// and 1122. Since the UDP header has 8 bytes, we are left with 568 bytes.
	// To be even safer and make it round (and exactly one third of the usual
	// 1500) we use 500.
	MTU = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptureConfig

type CaptureConfig struct {
	Filename string `yaml:"filename"`
}

CaptureConfig allows specifying configurations for capturing traffic in the pcapng format.

type FullDuplexUnreliableWire

type FullDuplexUnreliableWire interface {
	Send(ctx context.Context, payload []byte) (n int, err error)
	Recv(ctx context.Context, payload []byte) (n int, err error)
	Close() error
}

FullDuplexUnreliableWire represents a hypothetical guided medium where you can send and receive bytes at the same time. No guarantee is provided about the delivery/integrity.

func NewFullDuplexUnreliableWire

func NewFullDuplexUnreliableWire(
	ctx context.Context,
	conf FullDuplexUnreliableWireConfig,
) (FullDuplexUnreliableWire, error)

NewFullDuplexUnreliableWire creates a FullDuplexUnreliableWire from config.

type FullDuplexUnreliableWireConfig

type FullDuplexUnreliableWireConfig struct {
	RecvUDPEndpoint string         `yaml:"recvUDPEndpoint"`
	SendUDPEndpoint string         `yaml:"sendUDPEndpoint"`
	Capture         *CaptureConfig `yaml:"capture"`
	MetricLabels    struct {
		StackName string `yaml:"stackName"`
	} `yaml:"metricLabels"`
}

FullDuplexUnreliableWireConfig contains the UDP configs for the concrete implementation of FullDuplexUnreliableWire.

Jump to

Keyboard shortcuts

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