netutil

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateULA

func GenerateULA() (netip.Prefix, error)

GenerateULA generates a unique local address with a /48 prefix according to RFC 4193. The network is returned as a netip.Prefix.

func MACtoEUI64

func MACtoEUI64(mac net.HardwareAddr) net.HardwareAddr

MACtoEUI64 converts a MAC address to an EUI-64 identifier.

func ParsePortRange

func ParsePortRange(s string) (start int, end int, err error)

ParsePortRange parses a port range string.

func Ping

func Ping(ctx context.Context, addr netip.Addr) error

Ping sends ICMP echo requests to the given address. The context must have a timeout set and is used for the duration of the ping. The function returns an error if no replies were received.

func Random64

func Random64(prefix netip.Prefix) (netip.Prefix, error)

Random64 generates a random /64 prefix from a /48 prefix.

func RandomLocalMAC

func RandomLocalMAC() (net.HardwareAddr, error)

GetRandomLocalMAC returns a random MAC address from the host.

func ResolveTCPAddr

func ResolveTCPAddr(ctx context.Context, lookup string, maxRetries int) (net.Addr, error)

ResolveTCPAddr resolves a TCP address with retries and context.

func TimeToNTP

func TimeToNTP(t time.Time) uint64

TimeToNTP converts a time.Time object to a 64-bit NTP time.

func VerifyChainOnly

func VerifyChainOnly(rawCerts [][]byte, _ [][]*x509.Certificate) error

VerifyChainOnly is a function that can be used in a TLS configuration to only verify that the certificate chain is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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