ip

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: GPL-3.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 Family

type Family uint8

Family represents IP Range family.

const (
	InvalidFamily Family = iota
	V4Family
	V6Family
)

type IRange

type IRange interface {
	Family() Family
	Contains(ip net.IP) bool
	Hosts() *big.Int
	fmt.Stringer
}

func ParseRange

func ParseRange(s string) IRange

ParseRange parses s as an IP Range, returning the result. If s is not a valid textual representation of an IP Range, ParseRange returns nil.

type Range

type Range struct {
	Start net.IP
	End   net.IP
}

Range represents IP Range.

func (Range) Contains

func (r Range) Contains(ip net.IP) bool

Contains reports whether net.IP is within Range.

func (Range) Family

func (r Range) Family() Family

Family returns IP Range family.

func (Range) Hosts

func (r Range) Hosts() *big.Int

Hosts returns number of hosts addresses in the Range. Hosts returns nil if Range is not valid.

func (Range) String

func (r Range) String() string

String returns Range string representation.

Jump to

Keyboard shortcuts

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