package netutils

import "github.com/docker/docker/libnetwork/netutils"

Package netutils provides network utility functions.

Index

Functions

func GenerateMACFromIP

func GenerateMACFromIP(ip net.IP) net.HardwareAddr

GenerateMACFromIP returns a locally administered MAC address where the 4 least significant bytes are derived from the IPv4 address.

func GenerateRandomMAC

func GenerateRandomMAC() net.HardwareAddr

GenerateRandomMAC returns a new 6-byte(48-bit) hardware address (MAC)

func GenerateRandomName

func GenerateRandomName(prefix string, length int) (string, error)

GenerateRandomName returns a string of the specified length, created by joining the prefix to random hex characters. The length must be strictly larger than len(prefix), or an error will be returned.

func IsV6Listenable

func IsV6Listenable() bool

IsV6Listenable returns true when `[::1]:0` is listenable. IsV6Listenable returns false mostly when the kernel was booted with `ipv6.disable=1` option.

func MustParseMAC

func MustParseMAC(s string) net.HardwareAddr

MustParseMAC returns a net.HardwareAddr or panic.

func ReverseIP

func ReverseIP(IP string) string

ReverseIP accepts a V4 or V6 IP string in the canonical form and returns a reversed IP in the dotted decimal form . This is used to setup the IP to service name mapping in the optimal way for the DNS PTR queries.

Source Files

utils.go

Version
v27.3.0-rc.2+incompatible
Published
Sep 18, 2024
Platform
js/wasm
Imports
9 packages
Last checked
1 minute ago

Tools for package owners.