util

package
v0.0.0-...-5cc2904 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: GPL-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TCPProtocol = "tcp"
	UDPProtocol = "udp"
)
View Source
const (
	UDPMaxBuffer       = 1500
	DefaultSTUNTimeout = 2 * time.Second
)

Variables

This section is empty.

Functions

func ConvertAllowedIPs

func ConvertAllowedIPs(allowedIPs []string) ([]net.IPNet, error)

ConvertAllowedIPs takes a slice of CIDR strings and converts them to a slice of net.IPNet. It returns an error if any string is not a valid CIDR.

func GetPublicEndpoint

func GetPublicEndpoint(ctx context.Context, conn *net.UDPConn, servers []string) (*net.UDPAddr, error)

GetPublicEndpoint attempts to discover the public-facing UDP address of the local machine by querying a list of STUN servers. It sends a STUN Binding Request through the provided UDP connection and returns the first successful response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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