cidr_merger

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeIPNet

func MergeIPNet(in []*net.IPNet, typeRange bool) []*net.IPNet

MergeIPNet 对ip进行合并 see https://github.com/zhanhb/cidr-merger

func MergeIp

func MergeIp(in []string, typeRange bool) []string

MergeIp 对ip进行合并 see https://github.com/zhanhb/cidr-merger

Types

type IRange

type IRange interface {
	ToIp() net.IP // return nil if it can't be represented as a single ip
	ToIpNets() []*net.IPNet
	ToRange() *Range
	String() string
}

func MergeIRange

func MergeIRange(result []IRange, typeRange bool) []IRange

MergeIRange 对ip进行合并 see https://github.com/zhanhb/cidr-merger

type IpNetWrapper

type IpNetWrapper struct {
	*net.IPNet
}

func (IpNetWrapper) String

func (r IpNetWrapper) String() string

func (IpNetWrapper) ToIp

func (r IpNetWrapper) ToIp() net.IP

func (IpNetWrapper) ToIpNets

func (r IpNetWrapper) ToIpNets() []*net.IPNet

func (IpNetWrapper) ToRange

func (r IpNetWrapper) ToRange() *Range

type IpWrapper

type IpWrapper struct {
	net.IP
}

func (IpWrapper) String

func (r IpWrapper) String() string

func (IpWrapper) ToIp

func (r IpWrapper) ToIp() net.IP

func (IpWrapper) ToIpNets

func (r IpWrapper) ToIpNets() []*net.IPNet

func (IpWrapper) ToRange

func (r IpWrapper) ToRange() *Range

type Range

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

func (*Range) String

func (r *Range) String() string

func (*Range) ToIp

func (r *Range) ToIp() net.IP

func (*Range) ToIpNets

func (r *Range) ToIpNets() []*net.IPNet

func (*Range) ToRange

func (r *Range) ToRange() *Range

type Ranges

type Ranges []*Range

func (Ranges) Len

func (s Ranges) Len() int

func (Ranges) Less

func (s Ranges) Less(i, j int) bool

func (Ranges) Swap

func (s Ranges) Swap(i, j int)

Jump to

Keyboard shortcuts

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