Documentation
¶
Index ¶
- Constants
- Variables
- func GetAllGlobalUnicastAddresses(includeLoopback bool) ([]netip.Prefix, error)
- func GetGlobalUnicastAddresses(ifcName string, includeLoopback bool) ([]netip.Prefix, error)
- func GetTCPChecksum(packetData []byte) (uint16, error)
- func LastIP(prefix netip.Prefix) netip.Addr
- func NetworkPrefix(id NetworkID) netip.Prefix
- func NetworkPrefixOf(addr netip.Addr) netip.Prefix
- func RecalculateTCPChecksum(packetData []byte) error
- func ULAPrefix() netip.Prefix
- func VerifyTCPChecksum(packetData []byte) (bool, error)
- type EndpointID
- type IPAM
- type NetULA
- type NetworkID
- type PcapDevice
- func (d *PcapDevice) BatchSize() int
- func (d *PcapDevice) Close() error
- func (d *PcapDevice) Events() <-chan tun.Event
- func (d *PcapDevice) File() *os.File
- func (d *PcapDevice) MTU() (int, error)
- func (d *PcapDevice) Name() (string, error)
- func (d *PcapDevice) Read(bufs [][]byte, sizes []int, offset int) (n int, err error)
- func (d *PcapDevice) Write(bufs [][]byte, offset int) (int, error)
Constants ¶
const ( // ApoxyULAAddr is the base address of the ApoxyNet ULA prefix. // Used as the server-side address for overlay services (e.g. BFD). ApoxyULAAddr = "fd61:706f:7879::" )
const (
IPv4CidrPrefix = "100.64.0.0/10"
)
Variables ¶
var ( // ProxyEndpointID is the endpoint ID for the proxy. ProxyEndpointID = EndpointID{0x00, 0x00} )
var ( // SystemNetworkID is the network ID for the system network (as opposed to a user network). SystemNetworkID = NetworkID{0x00, 0x00, 0x00} )
Functions ¶
func GetAllGlobalUnicastAddresses ¶
GetAllGlobalUnicastAddresses returns the global unicast IPv4/IPv6 addresses across all non-loopback, up interfaces by calling GetGlobalUnicastAddresses for each interface.
func GetGlobalUnicastAddresses ¶
GetGlobalUnicastAddresses returns the global unicast IPv4/IPv6 address of the specified interface.
func GetTCPChecksum ¶
GetTCPChecksum extracts the TCP checksum from a packet without modifying it
func NetworkPrefix ¶
NetworkPrefix returns the overlay /72 for a NetworkID. Unlike NewULA(ctx, id).NetPrefix(), it constructs no go-ipam instance — it is pure address arithmetic, safe on hot paths.
func NetworkPrefixOf ¶
NetworkPrefixOf returns the overlay /72 containing addr (its network portion).
func RecalculateTCPChecksum ¶
RecalculateTCPChecksum manually recalculates and updates the TCP checksum in a raw packet
func ULAPrefix ¶
ULAPrefix returns the Apoxy overlay ULA prefix (fd61:706f:7879::/48). Every project overlay /72 and endpoint /96 is carved from within it; callers use it to bound-check addresses that claim to be overlay space (e.g. the resident egress SSRF carve-out, which must only ever relax destinations inside it).
func VerifyTCPChecksum ¶
VerifyTCPChecksum verifies if the TCP checksum in a packet is correct
Types ¶
type EndpointID ¶
type EndpointID [2]byte
EndpointID is and endpoint (e.g a Tunnel Agent, Backplane) which is unique within the network.
type IPAM ¶
type IPAM interface {
// Allocate allocates a prefix.
Allocate() (netip.Prefix, error)
// Release releases an IP address. No-op if the address is not allocated
// (returns nil).
Release(peerPrefix netip.Prefix) error
}
IPAM interface defines the methods for managing IP addresses.
type NetULA ¶
type NetULA struct {
NetID NetworkID
EndpointID EndpointID
// contains filtered or unexported fields
}
NetULA represents a ULA prefix for a network.
func ULAFromPrefix ¶
ULAFromPrefix creates a new NetULA from an IPv6 address.
func (*NetULA) FullPrefix ¶
FullPrefix returns the IPv6 ULA prefix for the network.
func (*NetULA) WithEndpoint ¶
WithEndpoint returns the IPv6 ULA prefix for an endpoint.
type NetworkID ¶
type NetworkID [3]byte
NetworkID represents a unique identifier for a network.
func NetworkIDFromCIDR ¶
NetworkIDFromCIDR extracts the 24-bit NetworkID (ULA bytes 6-8) from a network's overlay /72 prefix in CIDR string form.
func NetworkIDHexToBytes ¶
NetworkIDHexToBytes converts a hexadecimal network id representation to a byte array. Example: NetworkIDHexToBytes("123456") returns [18, 52, 86]
type PcapDevice ¶
type PcapDevice struct {
// contains filtered or unexported fields
}
func NewPcapDevice ¶
func NewPcapDevice(dev tun.Device, pcapPath string) (*PcapDevice, error)
func (*PcapDevice) BatchSize ¶
func (d *PcapDevice) BatchSize() int
func (*PcapDevice) Close ¶
func (d *PcapDevice) Close() error
func (*PcapDevice) Events ¶
func (d *PcapDevice) Events() <-chan tun.Event
func (*PcapDevice) File ¶
func (d *PcapDevice) File() *os.File
func (*PcapDevice) MTU ¶
func (d *PcapDevice) MTU() (int, error)
func (*PcapDevice) Name ¶
func (d *PcapDevice) Name() (string, error)