flowhash

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(key uint64, ipPacket []byte) uint16

Hash computes a symmetric, keyed flow hash for the given IP packet. It returns a 16-bit value derived from the source/destination IP addresses and the L4 source/destination ports (for TCP/UDP), or the protocol number otherwise, canonicalized so the two directions of a flow hash identically (stable ECMP). If the packet is invalid or the IP version unsupported it returns 0.

key is a per-session secret mixed into the hash: it makes the resulting outer UDP source port no longer a public function of the inner 5-tuple, so an off-path observer cannot fingerprint or correlate inner flows from it (APO-661). Both directions on one handler share the key, preserving the symmetric ECMP property within a session while denying an outsider the mapping.

func MapToEphemeralPort added in v0.17.0

func MapToEphemeralPort(hash uint16) uint16

MapToEphemeralPort maps a given hash value to the ephemeral port range (49152-65535).

Types

This section is empty.

Jump to

Keyboard shortcuts

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