networkutil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIPs

func GetLocalIPs() (result []string, err error)

此方法无法直接获取到对外的IP,只能判断IPv4和非回环地址,多IP情况还需要额外进行判断

func GetOutBoundIP

func GetOutBoundIP() (ip string, err error)

该方法可直接获取到对外的IP,使用udp的优点不需要关注是否送达,只需要对应的{ip}:{port}结构正确,即可获取到IP地址。 这里使用TCP也是可以的,只是需要保证对应的{ip}:{port}连通性。

Types

This section is empty.

Jump to

Keyboard shortcuts

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