iputil

package
v2.9.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPNetFromRPC

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

func IPNetToRPC

func IPNetToRPC(n *net.IPNet) *manager.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 UniqueSorted added in v2.8.0

func UniqueSorted(ips []net.IP) 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

Subnet is a net.IPNet that can be marshalled/unmarshalled as yaml or json.

func (*Subnet) MarshalJSON added in v2.3.1

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

func (*Subnet) MarshalYAML added in v2.9.0

func (s *Subnet) MarshalYAML() (any, error)

func (*Subnet) String added in v2.9.0

func (s *Subnet) String() string

func (*Subnet) UnmarshalJSON added in v2.3.1

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

func (*Subnet) UnmarshalYAML added in v2.9.0

func (s *Subnet) UnmarshalYAML(node *yaml.Node) error

Jump to

Keyboard shortcuts

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