gipv4

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: MIT Imports: 7 Imported by: 7

Documentation

Overview

Package gipv4 provides useful API for IPv4 address handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHostByName

func GetHostByName(hostname string) (string, error)

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

func GetHostsByName

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

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

func GetNameByAddr

func GetNameByAddr(ipAddress string) (string, error)

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

func GetSegment

func GetSegment(ip string) string

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

func IntranetIP

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

获取本地局域网ip列表

func Ip2long

func Ip2long(ipAddress string) uint32

IP字符串转为整形.

func IsIntranet

func IsIntranet(ipStr string) bool

判断所给ip是否为局域网ip 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 Long2ip

func Long2ip(properAddress uint32) string

ip整形转为字符串

func ParseAddress

func ParseAddress(addr string) (string, int)

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

func Validate

func Validate(ip string) bool

判断所给地址是否是一个IPv4地址

Types

This section is empty.

Jump to

Keyboard shortcuts

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