gipv4

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gipv4 provides useful API for IPv4 address handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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(ipstr string) (ip 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(ip 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