ipconv

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

From https://github.com/praserx/ipconv

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 BigIntToIPv6

func BigIntToIPv6(ipaddr big.Int) net.IP

BigIntToIPv6 converts IP address of version 6 from big integer to net.IP representation.

func IPv4ToInt

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

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

func IPv6ToBigInt

func IPv6ToBigInt(ipaddr net.IP) (*big.Int, error)

IPv6ToBigInt converts IP address of version 6 from net.IP to math big integer representation.

func IPv6ToInt

func IPv6ToInt(ipaddr net.IP) ([2]uint64, error)

IPv6ToInt converts IP address of version 6 from net.IP to uint64 array representation. Return value contains high integer value on the first place and low integer value on second place.

func IntToIPv4

func IntToIPv4(ipaddr uint32) net.IP

IntToIPv4 converts IP address of version 4 from integer to net.IP representation.

func IntToIPv6

func IntToIPv6(high, low uint64) net.IP

IntToIPv6 converts IP address of version 6 from integer (high and low value) to net.IP representation.

Types

type IP

type IP uint32

func FromIPAddr

func FromIPAddr(ip netip.Addr) (IP, error)

func ParseToIP

func ParseToIP(ipString string) (IP, error)

func (IP) ToIPV4

func (ip IP) ToIPV4() net.IP

func (IP) ToInt

func (ip IP) ToInt() uint32

func (IP) ToIpAddr

func (ip IP) ToIpAddr() netip.Addr

Jump to

Keyboard shortcuts

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