package netutils
import "github.com/docker/libnetwork/netutils"
Index ¶
- Constants
- Variables
- func CheckNameserverOverlaps(nameservers []string, toCheck *net.IPNet) error
- func GenerateMACFromIP(ip net.IP) net.HardwareAddr
- func GenerateRandomMAC() net.HardwareAddr
- func GenerateRandomName(prefix string, size int) (string, error)
- func GetIfaceAddr(name string) (net.Addr, []net.Addr, error)
- func NetworkOverlaps(netX *net.IPNet, netY *net.IPNet) bool
- func NetworkRange(network *net.IPNet) (net.IP, net.IP)
- func ParseAlias(val string) (string, string, error)
- func ReverseIP(IP string) string
- func ValidateAlias(val string) (string, error)
Constants ¶
const ( IP = iota // IPv4 and IPv6 IPv4 IPv6 )
constants for the IP address type
Variables ¶
var ( // ErrNetworkOverlapsWithNameservers preformatted error ErrNetworkOverlapsWithNameservers = errors.New("requested network overlaps with nameserver") // ErrNetworkOverlaps preformatted error ErrNetworkOverlaps = errors.New("requested network overlaps with existing network") // ErrNoDefaultRoute preformatted error ErrNoDefaultRoute = errors.New("no default route") )
Functions ¶
func CheckNameserverOverlaps ¶
CheckNameserverOverlaps checks whether the passed network overlaps with any of the nameservers
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 new name joined with a prefix. This size specified is used to truncate the randomly generated value
func GetIfaceAddr ¶
GetIfaceAddr returns the first IPv4 address and slice of IPv6 addresses for the specified network interface
func NetworkOverlaps ¶
NetworkOverlaps detects overlap between one IPNet and another
func NetworkRange ¶
NetworkRange calculates the first and last IP addresses in an IPNet
func ParseAlias ¶
ParseAlias parses and validates the specified string as a alias format (name:alias)
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.
func ValidateAlias ¶
ValidateAlias validates that the specified string has a valid alias format (containerName:alias).
Source Files ¶
- Version
- v0.7.0-dev.1
- Published
- Feb 11, 2016
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 11 hours ago –
Tools for package owners.