address

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCIDR

func ParseCIDR(s string) (Address, CIDR, error)

Types

type Address

type Address uint32

Using 32-bit integer to represent IPv4 address

func Add

func Add(addr Address, i Offset) Address

func FromIP4

func FromIP4(ip4 net.IP) (r Address)

FromIP4 converts an ipv4 address to our integer address type

func ParseIP

func ParseIP(s string) (Address, error)

func (Address) IP4

func (addr Address) IP4() (r net.IP)

IP4 converts our integer address type to an ipv4 address

func (Address) MarshalJSON

func (addr Address) MarshalJSON() ([]byte, error)

func (Address) Reverse

func (addr Address) Reverse() Address

func (Address) String

func (addr Address) String() string

type CIDR

type CIDR struct {
	Start     Address
	PrefixLen int
}

func (CIDR) HostRange

func (cidr CIDR) HostRange() Range

func (CIDR) Range

func (cidr CIDR) Range() Range

func (CIDR) Size

func (cidr CIDR) Size() Offset

func (CIDR) String

func (cidr CIDR) String() string

type Offset

type Offset uint32

func Min

func Min(a, b Offset) Offset

func Subtract

func Subtract(a, b Address) Offset

type Range

type Range struct {
	Start, End Address // [Start, End); Start <= End
}

func NewRange

func NewRange(start Address, size Offset) Range

func (Range) AsCIDRString

func (r Range) AsCIDRString() string

func (Range) Contains

func (r Range) Contains(addr Address) bool

func (Range) Overlaps

func (r Range) Overlaps(or Range) bool

func (Range) Size

func (r Range) Size() Offset

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