utils

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capacity added in v0.7.7

func Capacity(a, b net.IP) *big.Int

Capacity returns the absolute number of IPs between a and b. 0 is returned if a and b are of different IP families, or any of those two IPs is invalid.

func CheckNotEmpty added in v0.6.0

func CheckNotEmpty(name, input string) error

func Cmp added in v0.7.6

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 DeepCopyStringSlice added in v0.5.0

func DeepCopyStringSlice(in []string) []string

func DeepEqualStringSlice added in v0.4.0

func DeepEqualStringSlice(a []string, b []string) bool

func LastIP added in v0.3.0

func LastIP(subnet *net.IPNet) net.IP

LastIP Determine the last IP of a subnet, excluding the broadcast if IPv4

func MinUint32 added in v0.6.0

func MinUint32(a, b uint32) uint32

func Network added in v0.7.6

func Network(ipn *net.IPNet) *net.IPNet

Network masks off the host portion of the IP, if IPNet is invalid, return nil

func NextIP added in v0.6.0

func NextIP(ip net.IP) net.IP

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

func NormalizedIP

func NormalizedIP(ip string) string

NormalizedIP If IP is valid, return itself otherwise empty string

func ParseBoolOrDefault

func ParseBoolOrDefault(in string, defaultValue bool) bool

func PickFirstNonEmptyString

func PickFirstNonEmptyString(ss ...string) string

func PrevIP added in v0.7.6

func PrevIP(ip net.IP) net.IP

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

func StringSliceToMap

func StringSliceToMap(in []string) (out map[string]struct{})

func StringToIPNet

func StringToIPNet(in string) *net.IPNet

func ToDNSFormat added in v0.5.0

func ToDNSFormat(ip net.IP) string

func ValidateIP added in v0.6.0

func ValidateIP(ip string) error

func ValidateIPv4 added in v0.6.0

func ValidateIPv4(ip string) error

func ValidateIPv6 added in v0.6.0

func ValidateIPv6(ip string) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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