Documentation ¶
Index ¶
- Variables
- func AdjustIPv4(pkg []byte, v4 string, start int, end int) error
- func AdjustIPv4Dst(pkg []byte, v4 string) error
- func AdjustIPv4Src(pkg []byte, v4 string) error
- func CountHostWithIPNet(ipNet *net.IPNet) uint32
- func CountIPNum(startIP, endIP net.IP) uint32
- func CountIPNumWithIPNet(ipNet *net.IPNet) uint32
- func CountIPNumWithMask(mask *net.IPMask) uint32
- func DiffIP(s, e net.IP) uint32
- func IPToUint32(ip net.IP) uint32
- func ObtainRangeSubnet(ipNet *net.IPNet) (startIP, endIP net.IP)
- func ParseIPv4(pkg []byte, start int, end int) (net.IP, error)
- func ParseIPv4Dst(pkg []byte) (net.IP, error)
- func ParseIPv4Src(pkg []byte) (net.IP, error)
- func SumIP(ip net.IP, offset int) net.IP
- func Uint32toIP(uint32Value uint32) net.IP
- func Version(pkg []byte) int
- type Nat
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCountIPNum = errors.New("Start IP is greater than end IP") // 起始IP>结束IP
View Source
var ErrNotIP = errors.New("Not IPv4") // 不是IP数据包
错误列表
View Source
var ErrNotIPv4 = errors.New("Not IPv4 package") // 不是IPv4 无法解析
View Source
var ErrNotIPv6 = errors.New("Not IPv6 package") // 不是IPv4 无法解析
View Source
var ErrNullIP = errors.New("IP is null") // IP地址为空
Functions ¶
func CountHostWithIPNet ¶
CountHostWithIPNet 通过掩码计算得到CIDR地址范围内可拥有的主机数(去除广播地址和组播地址)
func CountIPNumWithIPNet ¶
CountIPNumWithIPNet 通过掩码计算得到CIDR地址范围内可拥有的地址总数
func CountIPNumWithMask ¶
CountIPNumWithMask 通过掩码计算得到CIDR地址范围内地址总数
func ObtainRangeSubnet ¶
ObtainRangeSubnet 得到一段子网的IP地址范围
Types ¶
Click to show internal directories.
Click to hide internal directories.