netaddr

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidIPAddress = errors.New("invalid ip address")
View Source
var ErrNotIPv4Address = errors.New("not an IPv4 addres")
View Source
var ErrNotIPv6Address = errors.New("not an IPv6 addres")

Functions

func HostToNetShort

func HostToNetShort(i uint16) uint16

HostToNetShort converts a 16-bit integer from host to network byte order, aka "htons"

func IPv4ToInt

func IPv4ToInt(ipaddr net.IP) (uint32, error)

IPv4ToInt converts IP address of version 4 from net.IP to uint32 representation.

func ParseIP

func ParseIP(s string) (net.IP, int, error)

ParseIP implements extension of net.ParseIP. It returns additional information about IP address bytes length. In general, it works typically as standard net.ParseIP. So if IP is not valid, nil is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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