Documentation ¶
Index ¶
Constants ¶
const (
//IPSize = 2 or 4
IPSize = 128 / intSize
)
Variables ¶
var ( //ErrNotIPv6 raised by Conv() ErrNotIPv6 = errors.New("ip is not a valid ipv6 address") )
var ( //ErrParseCIDR raised by ParseCIDR() ErrParseCIDR = errors.New("error CIDR format") )
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a list of Nets. All Nets will be in ipv6 format, even it's ipv4 addr. Cause we use bin search.
func NewListFromFile ¶
NewListFromFile read IP list from a file, if no valid IP addr was found, it will return a empty NetList, NOT nil. NetList will be a sorted list.
func NewListFromReader ¶
NewListFromReader read IP list from a reader, if no valid IP addr was found, it will return a empty NetList, NOT nil. NetList will be a sorted list.
func (*List) Append ¶
Append appends new Nets to the list. This modified list, call Sort() before call next Contains()
func (*List) Contains ¶
Contains reports whether the list includes given ipv6. list must be sorted, or Contains will panic.
func (*List) Merge ¶
Merge merges srcList with list This modified list, call Sort() before call next Contains()
type Net ¶
type Net struct {
// contains filtered or unexported fields
}
Net represents a ip network
func NewNet ¶
NewNet returns a new IPNet, mask should be an ipv6 mask, which means you should +96 if you have an ipv4 mask.