util

package
v1.6.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPToUint

func IPToUint(addr net.IP) uint32

IPToUint converts an IP address to a uint32 for BPF map operations. On little-endian hosts (x86_64), this produces the same byte representation that the BPF program sees when reading ip->saddr/ip->daddr as __u32.

func MaskToUint

func MaskToUint(mask net.IPMask) uint32

MaskToUint converts a netmask to a uint32 for BPF map operations.

func ToHost16

func ToHost16(n uint16) uint16

func ToHostBytes32

func ToHostBytes32(n uint32) []byte

func ToIP

func ToIP(addr uint32) net.IP

ToIP converts a uint32 from BPF back to a net.IP. This is the inverse of IPToUint.

func ToNetBytes16

func ToNetBytes16(n uint16) uint16

func ToNetMask

func ToNetMask(addr, mask uint32) *net.IPNet

ToNetMask converts uint32 addr and mask back to an IPNet.

Types

This section is empty.

Jump to

Keyboard shortcuts

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