gf: Index | Files

package gipv4

import ""

Package gipv4 provides useful API for IPv4 address handling.


Package Files


func GetHostByName Uses

func GetHostByName(hostname string) (string, error)

Get the IPv4 address corresponding to a given Internet host name.

func GetHostsByName Uses

func GetHostsByName(hostname string) ([]string, error)

Get a list of IPv4 addresses corresponding to a given Internet host name.

func GetNameByAddr Uses

func GetNameByAddr(ipAddress string) (string, error)

Get the Internet host name corresponding to a given IP address.

func GetSegment Uses

func GetSegment(ip string) string

获得ip的网段,例如: -> 192.168.2

func IntranetIP Uses

func IntranetIP() (ips []string, err error)


func Ip2long Uses

func Ip2long(ipAddress string) uint32


func IsIntranet Uses

func IsIntranet(ipStr string) bool

判断所给ip是否为局域网ip A类 B类 C类

func Long2ip Uses

func Long2ip(properAddress uint32) string


func ParseAddress Uses

func ParseAddress(addr string) (string, int)

解析地址,形如: ->, 80

func Validate Uses

func Validate(ip string) bool


Package gipv4 imports 7 packages (graph) and is imported by 2 packages. Updated 2019-06-25. Refresh now. Tools for package owners.