iputil

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPNetFromRPC

func IPNetFromRPC(r *daemon.IPNet) *net.IPNet

func IPNetToRPC

func IPNetToRPC(n *net.IPNet) *daemon.IPNet

func Parse

func Parse(ipStr string) (ip net.IP)

Parse is like net.ParseIP but converts an IPv4 in 16 byte form to its 4 byte form

func SplitToIPPort

func SplitToIPPort(netAddr net.Addr) (net.IP, uint16, error)

SplitToIPPort splits the given address into an IP and a port number. It's an error if the address is based on a hostname rather than an IP.

Types

type IPKey

type IPKey string

IPKey is an immutable cast of a net.IP suitable to be used as a map key. It must be created using IPKey(ip)

func (IPKey) IP

func (k IPKey) IP() net.IP

func (IPKey) MarshalJSON added in v2.3.1

func (k IPKey) MarshalJSON() ([]byte, error)

func (IPKey) String

func (k IPKey) String() string

String returns the human readable string form of the IP (as opposed to the binary junk displayed when using it directly).

func (*IPKey) UnmarshalJSON added in v2.3.1

func (k *IPKey) UnmarshalJSON(data []byte) error

type IPs

type IPs []net.IP

func IPsFromBytesSlice

func IPsFromBytesSlice(bss [][]byte) IPs

func (IPs) BytesSlice

func (ips IPs) BytesSlice() [][]byte

BytesSlice is returns a [][]byte copy of the IPs

func (IPs) String

func (ips IPs) String() string

func (IPs) UniqueSorted

func (ips IPs) UniqueSorted() IPs

type Subnet added in v2.3.1

type Subnet net.IPNet

func (*Subnet) MarshalJSON added in v2.3.1

func (s *Subnet) MarshalJSON() ([]byte, error)

func (*Subnet) UnmarshalJSON added in v2.3.1

func (s *Subnet) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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