addr

package
v0.0.0-...-c8fc2fc Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostLenNone = 0
	HostLenIPv4 = net.IPv4len
	HostLenIPv6 = net.IPv6len
	HostLenSVC  = 2
)
View Source
const (
	IABytes = 4
	MaxISD  = (1 << 12) - 1
	MaxAS   = (1 << 20) - 1
)
View Source
const (
	ErrorBadHostAddrType = "Unsupported host address type"
)
View Source
const (
	ErrorIAUnpack = "Unable to unpack ISD-AS"
)
View Source
const SVCMcast = 0x8000

Variables

View Source
var (
	SvcBS   = HostSVC(0x0000)
	SvcPS   = HostSVC(0x0001)
	SvcCS   = HostSVC(0x0002)
	SvcSB   = HostSVC(0x0003)
	SvcNone = HostSVC(0xffff)
)

Functions

func HostEq

func HostEq(a, b HostAddr) bool

func HostLen

func HostLen(htype HostAddrType) (uint8, error)

func HostTypeCheck

func HostTypeCheck(t HostAddrType) bool

Types

type HostAddr

type HostAddr interface {
	Size() int
	Type() HostAddrType
	Pack() common.RawBytes
	IP() net.IP
	Copy() HostAddr
	fmt.Stringer
}

func HostFromIP

func HostFromIP(ip net.IP) HostAddr

func HostFromRaw

func HostFromRaw(b common.RawBytes, htype HostAddrType) (HostAddr, error)

type HostAddrType

type HostAddrType uint8
const (
	HostTypeNone HostAddrType = iota
	HostTypeIPv4
	HostTypeIPv6
	HostTypeSVC
)

func (HostAddrType) String

func (t HostAddrType) String() string

type HostIPv4

type HostIPv4 net.IP

func (HostIPv4) Copy

func (h HostIPv4) Copy() HostAddr

func (HostIPv4) IP

func (h HostIPv4) IP() net.IP

func (HostIPv4) Pack

func (h HostIPv4) Pack() common.RawBytes

func (HostIPv4) Size

func (h HostIPv4) Size() int

func (HostIPv4) String

func (h HostIPv4) String() string

func (HostIPv4) Type

func (h HostIPv4) Type() HostAddrType

type HostIPv6

type HostIPv6 net.IP

func (HostIPv6) Copy

func (h HostIPv6) Copy() HostAddr

func (HostIPv6) IP

func (h HostIPv6) IP() net.IP

func (HostIPv6) Pack

func (h HostIPv6) Pack() common.RawBytes

func (HostIPv6) Size

func (h HostIPv6) Size() int

func (HostIPv6) String

func (h HostIPv6) String() string

func (HostIPv6) Type

func (h HostIPv6) Type() HostAddrType

type HostNone

type HostNone net.IP

func (HostNone) Copy

func (h HostNone) Copy() HostAddr

func (HostNone) IP

func (h HostNone) IP() net.IP

func (HostNone) Pack

func (h HostNone) Pack() common.RawBytes

func (HostNone) Size

func (h HostNone) Size() int

func (HostNone) String

func (h HostNone) String() string

func (HostNone) Type

func (h HostNone) Type() HostAddrType

type HostSVC

type HostSVC uint16

func (HostSVC) Base

func (h HostSVC) Base() HostSVC

func (HostSVC) Copy

func (h HostSVC) Copy() HostAddr

func (HostSVC) IP

func (h HostSVC) IP() net.IP

func (HostSVC) IsMulticast

func (h HostSVC) IsMulticast() bool

func (HostSVC) Multicast

func (h HostSVC) Multicast() HostSVC

func (HostSVC) Pack

func (h HostSVC) Pack() common.RawBytes

func (HostSVC) Size

func (h HostSVC) Size() int

func (HostSVC) String

func (h HostSVC) String() string

func (HostSVC) Type

func (h HostSVC) Type() HostAddrType

type IAInt

type IAInt uint32

func (IAInt) IA

func (iaI IAInt) IA() *ISD_AS

type ISD_AS

type ISD_AS struct {
	I int
	A int
}

func IAFromRaw

func IAFromRaw(b common.RawBytes) *ISD_AS

func IAFromString

func IAFromString(s string) (*ISD_AS, error)

func (*ISD_AS) Copy

func (ia *ISD_AS) Copy() *ISD_AS

func (*ISD_AS) Eq

func (ia *ISD_AS) Eq(other *ISD_AS) bool

func (*ISD_AS) IAInt

func (ia *ISD_AS) IAInt() IAInt

func (ISD_AS) MarshalText

func (ia ISD_AS) MarshalText() ([]byte, error)

func (*ISD_AS) Parse

func (ia *ISD_AS) Parse(b common.RawBytes)

func (*ISD_AS) SizeOf

func (ia *ISD_AS) SizeOf() int

func (ISD_AS) String

func (ia ISD_AS) String() string

func (*ISD_AS) UnmarshalText

func (ia *ISD_AS) UnmarshalText(text []byte) error

allows ISD_AS to be used as a map key in JSON.

func (*ISD_AS) Write

func (ia *ISD_AS) Write(b common.RawBytes)

Jump to

Keyboard shortcuts

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