netutil

package
v0.2.52 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NameServer = "ns1.google.com:53"

NameServer the name server to use for this lib

Functions

func Get added in v0.2.45

func Get() (port int, err error)

Get a free port.

func GetClientIP added in v0.2.19

func GetClientIP(r *http.Request) (ip string)

GetClientIP 获取用户ip

func GetDefaultInterfaceName added in v0.2.45

func GetDefaultInterfaceName() string

func GetInterfaceIP added in v0.2.45

func GetInterfaceIP() (string, error)

GetInterfaceIP get the ip of your interface, useful when you want to get your ip inside a private network, such as wifi network.

func GetIp138 added in v0.2.30

func GetIp138(ip string) string

爬虫 ip138 获取 ip 地理信息 ~~~~~~ 暂时废弃,采用 IPIP

func GetLocalIP added in v0.2.19

func GetLocalIP() (ip string)

GetLocalIP 获取内网ip

func GetLocalIp added in v0.2.30

func GetLocalIp() string

func GetOutboundIP added in v0.2.45

func GetOutboundIP() string

Get preferred outbound ip of this machine

func GetPublicIP added in v0.2.45

func GetPublicIP() (string, error)

GetPublicIP get the ip that is public to global.

func GetValidAddressCount added in v0.2.45

func GetValidAddressCount(cidr string) int

func GetWwwIP added in v0.2.19

func GetWwwIP() (exip string)

GetWwwIP 获取公网IP地址

func Intersect added in v0.2.45

func Intersect(n1, n2 *net.IPNet) bool

func IpAddress

func IpAddress() string

func LocalIP

func LocalIP() (string, error)

LocalIP gets the first NIC's IP address.

func LocalMac

func LocalMac() (string, error)

LocalMac gets the first NIC's MAC address.

func ToCommonString added in v0.2.45

func ToCommonString(ip string, prefix uint32) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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