netutil

package
v0.2.56 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 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

func Get() (port int, err error)

Get a free port.

func GetClientIP

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

GetClientIP 获取用户ip

func GetDefaultInterfaceName

func GetDefaultInterfaceName() string

func GetInterfaceIP

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

func GetIp138(ip string) string

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

func GetLocalIP

func GetLocalIP() (ip string)

GetLocalIP 获取内网ip

func GetLocalIp

func GetLocalIp() string

func GetOutboundIP

func GetOutboundIP() string

Get preferred outbound ip of this machine

func GetPublicIP

func GetPublicIP() (string, error)

GetPublicIP get the ip that is public to global.

func GetValidAddressCount

func GetValidAddressCount(cidr string) int

func GetWwwIP

func GetWwwIP() (exip string)

GetWwwIP 获取公网IP地址

func Intersect

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

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