util

package
v0.0.0-...-846387b Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNextCIDR

func GetNextCIDR(iprange string) (string, error)

GetNextCIDR 获取下一个网段 172.168.0.0/24 ->172.168.1.0/24

func IP2Long

func IP2Long(ip net.IP) uint

IP2Long IP 转位

func IsPrivate

func IsPrivate(ip net.IP) bool

IsPrivate 是否为局域网IP

func List

func List(iprange string) (ips []string, err error)

List 列出全部ip

func Long2IP

func Long2IP(long uint) net.IP

Long2IP 位转 IP

func RangeLength

func RangeLength(iprange string) int

RangeLength 获取网段所有ip数量

Types

type Range

type Range struct {
	// contains filtered or unexported fields
}

func NewRange

func NewRange(iprange string) (*Range, error)

NewRange 网段内ip范围

func NewRangeWithBlockSize

func NewRangeWithBlockSize(iprange string, blockSize int) (*Range, error)

NewRangeWithBlockSize 创建Range 通过设置总位数 ipv4 32 ipv6 64

func (*Range) Next

func (r *Range) Next() bool

func (*Range) String

func (r *Range) String() string

func (*Range) StringPrefix

func (r *Range) StringPrefix() string

func (*Range) StringSuffix

func (r *Range) StringSuffix() string

Jump to

Keyboard shortcuts

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