Documentation
¶
Overview ¶
Package plpmtud implements Packetization Layer Path MTU Discovery for Datagram Transports according to RFC8899 for detecting the maximum packet size (MPS).
Index ¶
Constants ¶
View Source
const ( OverheadWireGuard = 32 // https://lists.zx2c4.com/pipermail/wireguard/2017-December/002201.html OverheadPPPoE = 8 OverheadL2TP = 12 OverheadVXLAN = 8 OverheadGRE = 4 OverheadIPv4 = 20 OverheadIPv6 = 40 OverheadUDP = 8 Overhead802_3 = 14 // Ethernet header Overhead802_1q = 4 // VLAN tag MtuIPv6Minimal = 1280 Mtu802_3Standard = 1500 Mtu802_3Jumbo = 9000 Mtu802_11 = 2304 MtuLoopbackDarwin = 1 << 14 MtuLoopbackLinux = 1 << 16 )
View Source
const ( DefaultMaxProbes = 3 DefaultMinPLPMTU = 1280 ProbeTimerTimeout = 15 * time.Second RaiseTimerTimeout = 600 * time.Second StunMethodProbe stun.Method = 0x00D StunMethodReport stun.Method = 0x00E StunAttrPadding stun.AttrType = 0x0026 StunAttrIdentifier stun.AttrType = 0x0031 // TODO: use final IANA allocation StunAttrProbePMTUDSupported stun.AttrType = 0x8031 // TODO: use final IANA allocation )
View Source
const ( StateUnspecified state = iota StateDisabled = iota StateBase = iota StateError = iota StateSearching = iota StateSearchComplete = iota )
View Source
const ( EventAcknowledgementReceived eventType = iota EventConnected = iota EventDisconnected = iota EventNewLinkMTU = iota EventProbeTimerExpired = iota EventRaiseTimerExpired = iota EventPacketTooBigReceived = iota EventBlackHoleDetected = iota )
View Source
const (
StunMethodFallthrough stun.Method = 0xffff
)
Variables ¶
View Source
var WellKnownMTUs = CalculateWellKnownMTUs() //nolint:gochecknoglobals
Functions ¶
func CalculateWellKnownMTUs ¶
func CalculateWellKnownMTUs() []uint
func SetDontFragment ¶
Types ¶
type Discoverer ¶
type Discoverer struct { State state MaxProbes uint MinPLPMTU uint MaxPLPMTU uint BasePLPMTU uint // contains filtered or unexported fields }
Discoverer implements the core state-machine of the Datagram Packet Layer Path MTU Discovery (DPLPMTUD) protocol
DPLPMTUD aims at detected the largest supported MTU on a give path.
See: https://datatracker.ietf.org/doc/html/rfc8899
func NewDiscoverer ¶
func NewDiscoverer(maxMTU uint, prober Prober) *Discoverer
func (*Discoverer) OnConnectionEstablished ¶
func (d *Discoverer) OnConnectionEstablished()
func (*Discoverer) OnConnectionLost ¶
func (d *Discoverer) OnConnectionLost()
func (*Discoverer) OnNewLinkMTU ¶
func (d *Discoverer) OnNewLinkMTU(mtu uint)
func (*Discoverer) OnPacketTooBig ¶
func (d *Discoverer) OnPacketTooBig(mtu uint)
func (*Discoverer) OnProbeRequest ¶
func (d *Discoverer) OnProbeRequest(mtu uint)
func (*Discoverer) OnProbeResponse ¶
func (d *Discoverer) OnProbeResponse(mtu uint)
type StunHandler ¶
type StunHandler func(*stun.Message) error
type StunMultiplexer ¶
func NewStunMultiplexer ¶
func NewStunMultiplexer(c *net.UDPConn) (*StunMultiplexer, error)
func (*StunMultiplexer) ReadFromUDP ¶
func (*StunMultiplexer) RegisterStunHandler ¶
func (c *StunMultiplexer) RegisterStunHandler(m stun.Method, h StunHandler)
func (*StunMultiplexer) WriteStunMessage ¶
func (c *StunMultiplexer) WriteStunMessage(msg *stun.Message) error
type StunProber ¶
type StunProber struct { *StunMultiplexer // contains filtered or unexported fields }
A PLPMTUD prober for UDP transports using STUN See the following RFC draft: https://datatracker.ietf.org/doc/html/draft-petithuguenin-tsvwg-stun-pmtud-01
func NewStunConnProber ¶
func NewStunConnProber(c *net.UDPConn) (*StunProber, error)
func NewStunMultiplexProber ¶
func NewStunMultiplexProber(m *StunMultiplexer) (*StunProber, error)
func (*StunProber) Close ¶
func (p *StunProber) Close() error
func (*StunProber) RegisterDiscoverer ¶
func (p *StunProber) RegisterDiscoverer(h *Discoverer)
func (*StunProber) SendProbeRequest ¶
func (p *StunProber) SendProbeRequest(mtu uint) error
func (*StunProber) SendProbeResponse ¶
func (p *StunProber) SendProbeResponse(_ uint) error
func (*StunProber) SetCredentials ¶
func (p *StunProber) SetCredentials(localUfrag, localPwd, remoteUfrag, remotePwd string)
Click to show internal directories.
Click to hide internal directories.