util

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAvailableUDPPort

func FindAvailableUDPPort(minPort, maxPort uint16) (uint16, error)

find an available UDP port in the range [minPort, maxPort] and also the next port for the wgtester

func FixKey

func FixKey(key string) string

func GetDestPort

func GetDestPort(packet []byte) (uint16, bool)

GetDestPort returns destination port from TCP/UDP packet (fast path)

func GetProtocol

func GetProtocol(packet []byte) (uint8, bool)

GetProtocol returns protocol number from IPv4 packet (fast path)

func MapToWireGuardLogLevel

func MapToWireGuardLogLevel(level logger.LogLevel) int

func ParseLogLevel

func ParseLogLevel(level string) logger.LogLevel

func ResolveDomain

func ResolveDomain(domain string) (string, error)

func ResolveDomainAll added in v1.18.0

func ResolveDomainAll(domain string) ([]string, error)

ResolveDomainAll is ResolveDomainAllUpstream using only the system/platform resolver (no explicit upstream DNS servers).

func ResolveDomainAllUpstream added in v1.18.0

func ResolveDomainAllUpstream(domain string, publicDNS []string) ([]string, error)

ResolveDomainAllUpstream resolves domain to every candidate address (all families, deduplicated), each formatted as "ip:port" (or bare ip if domain had no port). Unlike ResolveDomainUpstream, which collapses to a single IPv4-preferred address, this lets a caller that can try more than one candidate (e.g. UDP hole punching) reach the destination over whichever address family the local network path actually has a route for, instead of always preferring an IPv4 address that may be completely unreachable (e.g. on an IPv6-only/NAT64 network). See https://github.com/fosrl/olm/issues/108.

func ResolveDomainUpstream added in v1.10.3

func ResolveDomainUpstream(domain string, publicDNS []string) (string, error)

func UnfixKey

func UnfixKey(hexKey string) string

this is the opposite of FixKey

Types

This section is empty.

Jump to

Keyboard shortcuts

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