netutil

package
v0.4.31 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHost

func ExtractHost(hostport string) (net.IP, error)

func GetAvailableIPs

func GetAvailableIPs() (availableIPs []net.IP, err error)

func GetPublicIPs added in v0.4.10

func GetPublicIPs() ([]net.IP, error)

func IsIPv4 added in v0.4.10

func IsIPv4(ip net.IP) bool

func IsPrivateIP

func IsPrivateIP(ip net.IP) bool

func LookupTCPHostPort

func LookupTCPHostPort(hostport string) ([]net.Addr, error)

func SortedIPs added in v0.4.10

func SortedIPs(ips []string) []string

Types

type Port

type Port uint16

Port describes a transport layer port.

func ExtractPort

func ExtractPort(hostport string) (Port, error)

func SplitHostPort

func SplitHostPort(hostport string) (net.IP, Port, error)

SplitHostPort splits a network address.

A literal address or host name for IPv6 must be enclosed in square brackets, as in "[::1]:80".

Unlike net.SplitHostPort this function also performs type transformations to represent an IP address as a commonly-used interface and a port as an uint16.

type TCPAddr

type TCPAddr struct {
	net.TCPAddr
}

TCPAddr wraps net.TCPAddr allowing to initialize itself using YAML unmarshaller.

func (*TCPAddr) UnmarshalYAML

func (m *TCPAddr) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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