netutil

package
v12.120.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Overview

Package netutil provides methods for working with network

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllIP added in v12.82.0

func GetAllIP() []string

GetAllIP returns all IPv4 addresses

Example
ips := GetAllIP()

if len(ips) > 0 {
	fmt.Printf("All IPv4: %v\n", ips)
}
Output:

func GetAllIP6 added in v12.82.0

func GetAllIP6() []string

GetAllIP6 returns all IPv6 addresses

Example
ips := GetAllIP6()

if len(ips) > 0 {
	fmt.Printf("All IPv6: %v\n", ips)
}
Output:

func GetIP

func GetIP() string

GetIP returns main IPv4 address

Example
ip := GetIP()

if ip != "" {
	fmt.Printf("Your IPv4 is %s\n", ip)
}
Output:

func GetIP6

func GetIP6() string

GetIP6 returns main IPv6 address

Example
ip := GetIP6()

if ip != "" {
	fmt.Printf("Your IPv6 is %s\n", ip)
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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