address

package
v2.6.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 {
	Addr      Address
	PrefixLen int
}

func MakeCIDR added in v1.5.0

func MakeCIDR(subnet CIDR, addr Address) CIDR

func NewCIDRs added in v1.6.0

func NewCIDRs(ranges []Range) (cidrs []CIDR)

func ParseCIDR

func ParseCIDR(s string) (CIDR, error)

func (CIDR) End added in v1.6.0

func (cidr CIDR) End() Address

cidr = [Start; End)

func (CIDR) HostRange

func (cidr CIDR) HostRange() Range

func (CIDR) IPNet

func (cidr CIDR) IPNet() (r *net.IPNet)

func (CIDR) IsSubnet added in v1.5.0

func (cidr CIDR) IsSubnet() bool

func (CIDR) Range

func (cidr CIDR) Range() Range

func (CIDR) Size

func (cidr CIDR) Size() Offset

func (CIDR) Start

func (cidr CIDR) Start() Address

func (CIDR) String

func (cidr CIDR) String() string

type Count added in v1.5.0

type Count uint32

func Length added in v1.5.0

func Length(a, b Address) Count

func Min

func Min(a, b Count) Count

type Offset

type Offset uint32

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) BiggestCIDRRange added in v1.6.0

func (r Range) BiggestCIDRRange() Range

func (Range) CIDRs added in v1.6.0

func (r Range) CIDRs() []CIDR

CIDRs returns a list of CIDR-aligned ranges which cover this range.

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() Count

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