netutil

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2018 License: Apache-2.0 Imports: 4 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 IsPrivateIP

func IsPrivateIP(ip net.IP) bool

func LookupTCPHostPort

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

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