ip

package
v1.5.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveGatewayIP added in v1.2.0

func DeriveGatewayIP(cidr string) string

DeriveGatewayIP gateway ip from cidr

func GetIPAtIndex added in v1.2.1

func GetIPAtIndex(ipNet net.IPNet, index int64) net.IP

GetIPAtIndex get the IP by index in the range of ipNet. The index is start with 0.

func GetNextIP added in v1.4.1

func GetNextIP(ip net.IP) net.IP

GetNextIP returns the next IP from the given IP address. If the given IP is the last IP of a v4 or v6 range, the same IP is returned.

func IPs2str

func IPs2str(ips []net.IP) []string

func IPsHasAll

func IPsHasAll(a []net.IP, b []net.IP) bool

IPsHasAll return true if all b is in a

func IPsIntersect

func IPsIntersect(a []net.IP, b []net.IP) bool

IPsIntersect return is 2 set is intersect

func IPv6

func IPv6(ip net.IP) bool

func NetEqual

func NetEqual(ipn1 *net.IPNet, ipn2 *net.IPNet) bool

NetEqual returns true if both IPNet are equal

func ToIP

func ToIP(addr string) (net.IP, error)

ToIP parse str to net.IP and return error is parse failed

func ToIPMap

func ToIPMap(addrs []net.IP) map[string]net.IP

func ToIPs

func ToIPs(addrs []string) ([]net.IP, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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