ip

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmp

func Cmp(a, b net.IP) int

Cmp compares two IPs, returning the usual ordering: a < b : -1 a == b : 0 a > b : 1 incomparable : -2

func Distance

func Distance(a, b net.IP) int64

Distance returns amount of IPs between a and b returns -1 if result is negative returns -2 if result is too large or IPs are not valid addresses

func IsBroadcast

func IsBroadcast(ip net.IP, network *net.IPNet) bool

IsBroadcast returns true if provided IP is IPv4 Broadcast ip of the network

func NextIP

func NextIP(ip net.IP) net.IP

NextIP returns IP incremented by 1, if IP is invalid, return nil

func NextIPWithOffset

func NextIPWithOffset(ip net.IP, offset int64) net.IP

NextIPWithOffset returns IP incremented by offset, if IP is invalid, return nil

func NormalizeIP added in v0.1.0

func NormalizeIP(ip net.IP) net.IP

NormalizeIP will normalize IP by family, IPv4 : 4-byte form IPv6 : 16-byte form others : nil

func PrevIP

func PrevIP(ip net.IP) net.IP

PrevIP returns IP decremented by 1, if IP is invalid, return nil

Types

This section is empty.

Jump to

Keyboard shortcuts

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