misc

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalizeTCPAddr

func CanonicalizeTCPAddr(addr *net.TCPAddr) *net.TCPAddr

CanonicalizeTCPAddr takes a TCPAddr and returns a TCPAddr with the same value, but with the guarantee that two calls to CanonicalizeTCPAddr with the same TCPAddr value will return the same pointer.

func CompareIP

func CompareIP(a net.IP, b net.IP) int

CompareIP returns {a < b: -1, a == b: 0, a > b: +1}.

func CompareTCPAddr

func CompareTCPAddr(a *net.TCPAddr, b *net.TCPAddr) int

CompareTCPAddr returns {a < b: -1, a == b: 0, a > b: +1}.

func ErrorOrNil added in v0.4.6

func ErrorOrNil(multi multierror.Error) error

func ParseBool

func ParseBool(str string) (bool, error)

ParseBool parses a boolean value.

func ParseIP

func ParseIP(host string) (net.IP, error)

ParseIP parses an IP address.

func ParseIPAndZone

func ParseIPAndZone(host string) (net.IP, string, error)

ParseIPAndZone parses a string in "<ip>%<zone>" format.

func ParsePort

func ParsePort(port string) (uint16, error)

ParsePort parses a port number.

func ParseTCPAddr

func ParseTCPAddr(str, defaultPort string) (*net.TCPAddr, error)

ParseTCPAddr parses a string in "<ip>:<port>" format.

func ParseTCPAddrList

func ParseTCPAddrList(str, defaultPort string) ([]*net.TCPAddr, error)

ParseTCPAddrList parses a string in "<ip>:<port>,<ip>:<port>,..." format.

func SplitHostPort

func SplitHostPort(str, defaultPort string) (host string, port string, err error)

SplitHostPort splits a string in "<host>:<port>" format, except that if a port is not present in the string and defaultPort is non-empty, then defaultPort is used instead.

func StrictUnmarshalJSON

func StrictUnmarshalJSON(raw []byte, v interface{}) error

StrictUnmarshalJSON is a variant of json.Unmarshal that always sets DisallowUnknownFields() and UseNumber().

func TryBase64DecodeString

func TryBase64DecodeString(str string) ([]byte, error)

TryBase64DecodeString attempts to decode base-64 byte array using any of the standard base-64 encodings.

Types

This section is empty.

Jump to

Keyboard shortcuts

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