Documentation
¶
Index ¶
- func GetHostByName(hostname string) (string, error)
- func GetHostsByName(hostname string) ([]string, error)
- func GetIntranetIp() (ip string, err error)
- func GetIntranetIpArray() (ips []string, err error)
- func GetIpArray() (ips []string, err error)
- func GetMac() (mac string, err error)
- func GetMacArray() (macs []string, err error)
- func GetNameByAddr(ipAddress string) (string, error)
- func GetSegment(ip string) string
- func Ip2long(ip string) uint32
- func IsIntranet(ip string) bool
- func Long2ip(long uint32) string
- func ParseAddress(address string) (string, int)
- func Validate(ip string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHostByName ¶
GetHostByName 通过hostname解析出对应的ip地址
func GetHostsByName ¶
GetHostsByName 通过hostname解析出对应的所有ip地址
func GetIntranetIpArray ¶
GetIntranetIpArray 返回当前计算机上所有内网ip的列表
func GetNameByAddr ¶
GetNameByAddr 通过ip地址,获取dns地址
func GetSegment ¶
GetSegment 返回传入ip地址的网段 Eg: 192.168.2.102 -> 192.168.2
func IsIntranet ¶
IsIntranet 判断ip地址是否是内网ip
Local: 127.0.0.1 A: 10.0.0.0--10.255.255.255 B: 172.16.0.0--172.31.255.255 C: 192.168.0.0--192.168.255.255
func ParseAddress ¶
ParseAddress 把连起来的ip端口转换成分开的ip和端口 Eg: 192.168.1.1:80 -> 192.168.1.1, 80
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.