iputil

package
v2.21.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIpV6Addr added in v2.11.0

func IsIpV6Addr(ipAddStr string) bool

func JoinHostPort added in v2.18.0

func JoinHostPort(host string, port uint16) string

func JoinIpPort added in v2.11.0

func JoinIpPort(ip net.IP, port uint16) string

func Normalize added in v2.18.0

func Normalize(ip net.IP) net.IP

Normalize returns the four byte version of an IPv4, even if it was expressed as a 16 byte IP.

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 PrefixToRPC added in v2.21.0

func PrefixToRPC(n netip.Prefix) *manager.IPNet

func PrefixesToRPC added in v2.21.0

func PrefixesToRPC(n []netip.Prefix) []*manager.IPNet

func RPCToPrefix added in v2.21.0

func RPCToPrefix(m *manager.IPNet) netip.Prefix

func RPCsToPrefixes added in v2.21.0

func RPCsToPrefixes(n []*manager.IPNet) []netip.Prefix

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 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

Jump to

Keyboard shortcuts

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