net

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIPFamily

func GetIPFamily(ip net.IP) int

GetIPFamily returns AF_INET (IPv4), AF_INET6 (IPv6), or -1.

func GetInterfaceByIP

func GetInterfaceByIP(localIP net.IP) (*net.Interface, error)

GetInterfaceByIP returns interface for given local IP

func GetLocalWildcardIP

func GetLocalWildcardIP(family int) net.IP

GetLocalWildcardIP returns wildcard IP for family

func GetOutboundAddr

func GetOutboundAddr(destIP net.IP) (net.IP, error)

GetOutboundAddr returns local IP used to reach dest IP

func PickRandomPort

func PickRandomPort() (int, error)

PickRandomPort returns a random ephemeral port

func RandomSeq

func RandomSeq() uint32

RandomSeq returns a random uint32 sequence number

func ResolveHostnameToIP

func ResolveHostnameToIP(dest string, preferAddressFamily int) (net.IP, error)

ResolveHostnameToIP resolves hostname to preferred IP family (IPv4 or IPv6)

func ReverseLookup

func ReverseLookup(addr string, timeout time.Duration) string

ReverseLookup does reverse DNS lookup with timeout

func SkipIPHeader

func SkipIPHeader(packet []byte, af int) ([]byte, error)

SkipIPHeader returns the slice of data after the IP header in the packet It uses the address family to determine the IP header length

Types

This section is empty.

Directories

Path Synopsis
this file provides low-level socket operations for Linux, macOS, FreeBSD
this file provides low-level socket operations for Linux, macOS, FreeBSD
tcp

Jump to

Keyboard shortcuts

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