Documentation ¶
Overview ¶
Package gipv4 provides useful API for IPv4 address handling.
Index ¶
- func GetHostByName(hostname string) (string, error)
- func GetHostsByName(hostname string) ([]string, error)
- func GetNameByAddr(ipAddress string) (string, error)
- func GetSegment(ip string) string
- func IntranetIP() (ip string, err error)
- func IntranetIPArray() (ips []string, err error)
- 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 returns the IPv4 address corresponding to a given Internet host name.
func GetHostsByName ¶
GetHostsByName returns a list of IPv4 addresses corresponding to a given Internet host name.
func GetNameByAddr ¶
GetNameByAddr returns the Internet host name corresponding to a given IP address.
func GetSegment ¶
GetSegment returns the segment of given ip address. Eg: 192.168.2.102 -> 192.168.2
func IntranetIP ¶
IntranetIP returns the first intranet ip of current machine.
func IntranetIPArray ¶ added in v1.10.0
IntranetIPArray returns the intranet ip list of current machine.
func IsIntranet ¶
IsIntranet checks and returns whether given ip an intranet 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 parses <address> to its ip and port. Eg: 192.168.1.1:80 -> 192.168.1.1, 80
Types ¶
This section is empty.