address

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 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 added in v1.0.0

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) String

func (addr Address) String() string

type CIDR added in v1.0.0

type CIDR struct {
	Start     Address
	PrefixLen int
}

func (CIDR) HostRange added in v1.0.0

func (cidr CIDR) HostRange() Range

func (CIDR) Range added in v1.0.0

func (cidr CIDR) Range() Range

func (CIDR) Size added in v1.0.0

func (cidr CIDR) Size() Offset

func (CIDR) String added in v1.0.0

func (cidr CIDR) String() string

type Offset

type Offset uint32

func Min added in v0.11.1

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 added in v1.0.0

func NewRange(start Address, size Offset) Range

func (Range) Contains added in v1.0.0

func (r Range) Contains(addr Address) bool

func (Range) Overlaps added in v1.0.0

func (r Range) Overlaps(or Range) bool

func (Range) Size added in v1.0.0

func (r Range) Size() Offset

func (Range) String added in v1.0.0

func (r Range) String() string

Jump to

Keyboard shortcuts

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