ip

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 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 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

Types

This section is empty.

Jump to

Keyboard shortcuts

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