ip

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultLoopbackIP4 = "127.0.0.1"
	DefaultLoopbackIP6 = "::1"
)

Variables

This section is empty.

Functions

func GetLoopbackIP

func GetLoopbackIP(wantIPv6 bool) (string, error)

GetLoopbackIP returns the ip address of local loopback interface.

func JoinIPStrings

func JoinIPStrings(ips []net.IP) string

func MustGetLoopbackIP

func MustGetLoopbackIP(wantIPv6 bool) string

MustGetLoopbackIP is a wrapper for GetLoopbackIP. If any error occurs or loopback interface is not found, will fall back to 127.0.0.1 for ipv4 or ::1 for ipv6.

func ParseIPList added in v1.2.0

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

Parse a list of IP Strings to net.IP type

func RemoveDupIPs added in v1.0.0

func RemoveDupIPs(ips []net.IP) []net.IP

RemoveDupIPs removes duplicate ips from the ip list and returns a new created list

func SearchAllIP added in v1.2.1

func SearchAllIP(ipList []net.IP, ips []net.IP) bool

searchAllIP returns true if all ips are in ipList

func SearchIP added in v1.2.1

func SearchIP(ipList []net.IP, ip net.IP) bool

searchIP returns true if ip is in ipList

Types

This section is empty.

Jump to

Keyboard shortcuts

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