iplist

package
v0.0.0-...-df6d21c Latest Latest
Warning

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

Go to latest
Published: May 16, 2015 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPList

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

func New

func New(initSorted []Range) *IPList

Create a new IP list. The given ranges must already sorted by the lower bound IP in each range. Behaviour is undefined for lists of overlapping ranges.

func (*IPList) Lookup

func (me *IPList) Lookup(ip net.IP) (r *Range)

Return the range the given IP is in. Returns nil if no range is found.

func (*IPList) NumRanges

func (me *IPList) NumRanges() int

type Range

type Range struct {
	First, Last net.IP
	Description string
}

func ParseBlocklistP2PLine

func ParseBlocklistP2PLine(l []byte) (r Range, ok bool, err error)

Parse a line of the PeerGuardian Text Lists (P2P) Format. Returns !ok but no error if a line doesn't contain a range but isn't erroneous, such as comment and blank lines.

func (*Range) String

func (r *Range) String() string

Jump to

Keyboard shortcuts

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