package netutils
import "github.com/docker/docker/libnetwork/netutils"
Package netutils provides network utility functions.
Index ¶
- func GenerateMACFromIP(ip net.IP) net.HardwareAddr
- func GenerateRandomMAC() net.HardwareAddr
- func GenerateRandomName(prefix string, length int) (string, error)
- func IsV6Listenable() bool
- func MustParseMAC(s string) net.HardwareAddr
- func ReverseIP(IP string) string
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 ¶
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 ¶
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 ¶
- Version
- v27.4.0+incompatible
- Published
- Dec 4, 2024
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 49 seconds ago –
Tools for package owners.