types

package
v3.11.4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package types contains basic types that are used in The Things Network's protobuf messages.

Index

Examples

Constants

This section is empty.

Variables

View Source
var MaxDevAddr = DevAddr{0xFF, 0xFF, 0xFF, 0xFF}

MaxDevAddr is the highest value possible for a DevAddr.

View Source
var MinDevAddr = DevAddr{0x00, 0x00, 0x00, 0x00}

MinDevAddr is the lowest value possible for a DevAddr.

Functions

func NwkAddrBits

func NwkAddrBits(netID NetID) uint

NwkAddrBits returns the length of NwkAddr field of netID in bits.

func NwkAddrLength

func NwkAddrLength(netID NetID) int

NwkAddrLength returns the length of NwkAddr field of netID in bytes.

Types

type AES128Key

type AES128Key [16]byte

AES128Key is an 128-bit AES key.

func NewPopulatedAES128Key

func NewPopulatedAES128Key(r randy) *AES128Key

NewPopulatedAES128Key returns a random AES128Key.

func (*AES128Key) DecodeMsgpack added in v3.11.0

func (key *AES128Key) DecodeMsgpack(dec *msgpack.Decoder) error

DecodeMsgpack implements msgpack.CustomDecoder interface.

func (AES128Key) EncodeMsgpack added in v3.11.0

func (key AES128Key) EncodeMsgpack(enc *msgpack.Encoder) error

EncodeMsgpack implements msgpack.CustomEncoder interface.

func (AES128Key) Equal

func (key AES128Key) Equal(other AES128Key) bool

Equal returns true iff keys are equal.

func (AES128Key) GoString

func (key AES128Key) GoString() string

GoString implements the GoStringer interface.

func (*AES128Key) IsZero

func (key *AES128Key) IsZero() bool

IsZero returns true iff the type is zero.

func (AES128Key) Marshal

func (key AES128Key) Marshal() ([]byte, error)

Marshal implements the proto.Marshaler interface.

func (AES128Key) MarshalBinary

func (key AES128Key) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (AES128Key) MarshalJSON

func (key AES128Key) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (AES128Key) MarshalText

func (key AES128Key) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (AES128Key) MarshalTo

func (key AES128Key) MarshalTo(data []byte) (int, error)

MarshalTo implements the MarshalerTo function required by generated protobuf.

func (AES128Key) Size

func (key AES128Key) Size() int

Size implements the Sizer interface.

func (AES128Key) String

func (key AES128Key) String() string

String implements the Stringer interface.

func (*AES128Key) Unmarshal

func (key *AES128Key) Unmarshal(data []byte) error

Unmarshal implements the proto.Unmarshaler interface.

func (*AES128Key) UnmarshalBinary

func (key *AES128Key) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*AES128Key) UnmarshalJSON

func (key *AES128Key) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*AES128Key) UnmarshalText

func (key *AES128Key) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type DevAddr

type DevAddr [4]byte

DevAddr is a 32-bit LoRaWAN device address.

func NewDevAddr

func NewDevAddr(netID NetID, nwkAddr []byte) (addr DevAddr, err error)

NewDevAddr returns new DevAddr.

func NewPopulatedDevAddr

func NewPopulatedDevAddr(r randy) *DevAddr

NewPopulatedDevAddr returns a random DevAddr.

func (DevAddr) Copy

func (addr DevAddr) Copy(x *DevAddr) *DevAddr

Copy stores a copy of addr in x and returns it.

func (DevAddr) Equal

func (addr DevAddr) Equal(other DevAddr) bool

Equal returns true iff addresses are equal.

func (DevAddr) GoString

func (addr DevAddr) GoString() string

GoString implements the GoStringer interface.

func (DevAddr) HasPrefix

func (addr DevAddr) HasPrefix(prefix DevAddrPrefix) bool

HasPrefix returns true iff the DevAddr has a prefix of given length.

func (DevAddr) HasValidNetIDType

func (addr DevAddr) HasValidNetIDType() bool

HasValidNetIDType returns true if the DevAddr has NetID type, which is valid and compliant with LoRaWAN specification.

func (DevAddr) IsZero

func (addr DevAddr) IsZero() bool

IsZero returns true iff the type is zero.

func (DevAddr) Marshal

func (addr DevAddr) Marshal() ([]byte, error)

Marshal implements the proto.Marshaler interface.

func (DevAddr) MarshalBinary

func (addr DevAddr) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (DevAddr) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

func (DevAddr) MarshalNumber

func (addr DevAddr) MarshalNumber() uint32

MarshalNumber returns the DevAddr in a decimal form.

func (DevAddr) MarshalText

func (addr DevAddr) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

Example
devAddr := DevAddr{0x26, 0x01, 0x26, 0xB4}
text, err := devAddr.MarshalText()
if err != nil {
	panic(err)
}

fmt.Println(string(text))
Output:

260126B4

func (DevAddr) MarshalTo

func (addr DevAddr) MarshalTo(data []byte) (int, error)

MarshalTo implements the MarshalerTo function required by generated protobuf.

func (DevAddr) Mask

func (addr DevAddr) Mask(bits uint8) (masked DevAddr)

Mask returns a copy of the DevAddr with only the first "bits" bits.

Example
devAddr := DevAddr{0x26, 0x01, 0x26, 0xB4}
devAddrMasked := devAddr.Mask(16)
devAddr2 := DevAddr{0x26, 0x01, 0x00, 0x00}

fmt.Println(devAddrMasked == devAddr2)
Output:

true

func (DevAddr) NetIDType

func (addr DevAddr) NetIDType() byte

NetIDType returns the NetID type of the DevAddr.

func (DevAddr) NwkAddr

func (addr DevAddr) NwkAddr() []byte

NwkAddr returns NwkAddr of the DevAddr.

func (DevAddr) NwkID

func (addr DevAddr) NwkID() []byte

NwkID returns NwkID of the DevAddr.

Example
devAddr := DevAddr{0x26, 0x01, 0x26, 0xB4}
fmt.Printf("%#x", devAddr.NwkID())
Output:

0x13

func (DevAddr) Size

func (addr DevAddr) Size() int

Size implements the Sizer interface.

func (DevAddr) String

func (addr DevAddr) String() string

String implements the Stringer interface.

func (*DevAddr) Unmarshal

func (addr *DevAddr) Unmarshal(data []byte) error

Unmarshal implements the proto.Unmarshaler interface.

func (*DevAddr) UnmarshalBinary

func (addr *DevAddr) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*DevAddr) UnmarshalJSON

func (addr *DevAddr) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*DevAddr) UnmarshalNumber

func (addr *DevAddr) UnmarshalNumber(n uint32)

UnmarshalNumber retrieves a DevAddr from a decimal form.

func (*DevAddr) UnmarshalText

func (addr *DevAddr) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

Example
var devAddr DevAddr
err := devAddr.UnmarshalText([]byte("2601A3C2"))
if err != nil {
	panic(err)
}

devAddr2 := DevAddr{0x26, 0x01, 0xa3, 0xc2}
fmt.Println(devAddr == devAddr2)
Output:

true

func (DevAddr) WithPrefix

func (addr DevAddr) WithPrefix(prefix DevAddrPrefix) (prefixed DevAddr)

WithPrefix returns the DevAddr, but with the first length bits replaced by the Prefix.

type DevAddrPrefix

type DevAddrPrefix struct {
	DevAddr DevAddr
	Length  uint8
}

DevAddrPrefix is a DevAddr with a prefix length.

func NewPopulatedDevAddrPrefix

func NewPopulatedDevAddrPrefix(r randy) *DevAddrPrefix

NewPopulatedDevAddrPrefix returns a random DevAddrPrefix.

func (DevAddrPrefix) ConfigString

func (prefix DevAddrPrefix) ConfigString() string

ConfigString implements the config.Stringer interface.

func (DevAddrPrefix) Equal

func (prefix DevAddrPrefix) Equal(other DevAddrPrefix) bool

Equal returns true iff prefixes are equal.

func (DevAddrPrefix) GoString

func (prefix DevAddrPrefix) GoString() string

GoString implements the GoStringer interface.

func (DevAddrPrefix) IsZero

func (prefix DevAddrPrefix) IsZero() bool

IsZero returns true iff the type is zero.

func (DevAddrPrefix) Marshal

func (prefix DevAddrPrefix) Marshal() ([]byte, error)

Marshal implements the proto.Marshaler interface.

func (DevAddrPrefix) MarshalBinary

func (prefix DevAddrPrefix) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (DevAddrPrefix) MarshalJSON

func (prefix DevAddrPrefix) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (DevAddrPrefix) MarshalText

func (prefix DevAddrPrefix) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (DevAddrPrefix) MarshalTo

func (prefix DevAddrPrefix) MarshalTo(data []byte) (int, error)

MarshalTo implements the MarshalerTo function required by generated protobuf.

func (DevAddrPrefix) Matches

func (prefix DevAddrPrefix) Matches(addr DevAddr) bool

Matches returns true iff the DevAddr matches the prefix.

Example
devAddr := DevAddr{0x26, 0x00, 0x26, 0xB4}
devAddr2 := DevAddr{0x26, 0x2a, 0x26, 0x8e}
devAddrPrefix := DevAddrPrefix{
	DevAddr: DevAddr{0x26, 0x00, 0x00, 0x00},
	Length:  16,
}
fmt.Println(devAddrPrefix.Matches(devAddr))
fmt.Println(devAddrPrefix.Matches(devAddr2))
Output:

true
false

func (DevAddrPrefix) Size

func (prefix DevAddrPrefix) Size() int

Size implements the Sizer interface.

func (DevAddrPrefix) String

func (prefix DevAddrPrefix) String() string

String implements the Stringer interface.

func (*DevAddrPrefix) Unmarshal

func (prefix *DevAddrPrefix) Unmarshal(data []byte) error

Unmarshal implements the proto.Unmarshaler interface.

func (*DevAddrPrefix) UnmarshalBinary

func (prefix *DevAddrPrefix) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*DevAddrPrefix) UnmarshalConfigString

func (prefix *DevAddrPrefix) UnmarshalConfigString(s string) error

UnmarshalConfigString implements the config.Configurable interface.

func (*DevAddrPrefix) UnmarshalJSON

func (prefix *DevAddrPrefix) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*DevAddrPrefix) UnmarshalText

func (prefix *DevAddrPrefix) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type DevNonce

type DevNonce [2]byte

DevNonce is device nonce used in the join procedure. - If LoRaWAN version <1.1 - it is randomly generated. - If LoRaWAN version >=1.1 - it is a scrictly increasing counter.

func NewPopulatedDevNonce

func NewPopulatedDevNonce(r randy) *DevNonce

NewPopulatedDevNonce returns a random DevNonce.

func (DevNonce) Equal

func (dn DevNonce) Equal(other DevNonce) bool

Equal returns true iff nonces are equal.

func (DevNonce) GoString

func (dn DevNonce) GoString() string

GoString implements the GoStringer interface.

func (DevNonce) IsZero

func (dn DevNonce) IsZero() bool

IsZero returns true iff the type is zero.

func (DevNonce) Marshal

func (dn DevNonce) Marshal() ([]byte, error)

Marshal implements the proto.Marshaler interface.

func (DevNonce) MarshalBinary

func (dn DevNonce) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (DevNonce) MarshalJSON

func (dn DevNonce) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (DevNonce) MarshalNumber

func (dn DevNonce) MarshalNumber() uint16

MarshalNumber returns the DevNonce in decimal form.

func (DevNonce) MarshalText

func (dn DevNonce) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (DevNonce) MarshalTo

func (dn DevNonce) MarshalTo(data []byte) (int, error)

MarshalTo implements the MarshalerTo function required by generated protobuf.

func (DevNonce) Size

func (dn DevNonce) Size() int

Size implements the Sizer interface.

func (DevNonce) String

func (dn DevNonce) String() string

String implements the Stringer interface.

func (*DevNonce) Unmarshal

func (dn *DevNonce) Unmarshal(data []byte) error

Unmarshal implements the proto.Unmarshaler interface.

func (*DevNonce) UnmarshalBinary

func (dn *DevNonce) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*DevNonce) UnmarshalJSON

func (dn *DevNonce) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*DevNonce) UnmarshalNumber

func (dn *DevNonce) UnmarshalNumber(n uint16)

UnmarshalNumber retrieves the DevNonce from decimal form.

func (*DevNonce) UnmarshalText

func (dn *DevNonce) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type EUI64

type EUI64 [8]byte

EUI64 is a 64-bit Extended Unique Identifier.

func NewPopulatedEUI64

func NewPopulatedEUI64(r randy) *EUI64

NewPopulatedEUI64 returns a random EUI64.

func (EUI64) Copy

func (eui EUI64) Copy(x *EUI64) *EUI64

Copy stores a copy of eui in x and returns it.

func (EUI64) Equal

func (eui EUI64) Equal(other EUI64) bool

Equal returns true iff EUIs are equal.

func (EUI64) GoString

func (eui EUI64) GoString() string

GoString implements the GoStringer interface.

func (EUI64) HasPrefix

func (eui EUI64) HasPrefix(prefix EUI64Prefix) bool

HasPrefix returns true iff the EUI64 has a prefix of given length.

func (EUI64) IsZero

func (eui EUI64) IsZero() bool

IsZero returns true iff the type is zero.

func (EUI64) Marshal

func (eui EUI64) Marshal() ([]byte, error)

Marshal implements the proto.Marshaler interface.

func (EUI64) MarshalBinary

func (eui EUI64) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (EUI64) MarshalJSON

func (eui EUI64) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (EUI64) MarshalNumber

func (eui EUI64) MarshalNumber() uint64

MarshalNumber returns the EUI64 in a decimal form.

func (EUI64) MarshalText

func (eui EUI64) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (EUI64) MarshalTo

func (eui EUI64) MarshalTo(data []byte) (int, error)

MarshalTo implements the MarshalerTo function required by generated protobuf.

func (EUI64) Mask

func (eui EUI64) Mask(bits uint8) (masked EUI64)

Mask returns a copy of the EUI64 with only the first "bits" bits.

func (EUI64) Size

func (eui EUI64) Size() int

Size implements the Sizer interface.

func (EUI64) String

func (eui EUI64) String() string

String implements the Stringer interface.

func (*EUI64) Unmarshal

func (eui *EUI64) Unmarshal(data []byte) error

Unmarshal implements the proto.Unmarshaler interface.

func (*EUI64) UnmarshalBinary

func (eui *EUI64) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*EUI64) UnmarshalJSON

func (eui *EUI64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*EUI64) UnmarshalNumber

func (eui *EUI64) UnmarshalNumber(n uint64)

UnmarshalNumber retrieves a EUI64 from a decimal form.

func (*EUI64) UnmarshalText

func (eui *EUI64) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (EUI64) WithPrefix

func (eui EUI64) WithPrefix(prefix EUI64Prefix) (prefixed EUI64)

WithPrefix returns the EUI64, but with the first length bits replaced by the Prefix.

type EUI64Prefix

type EUI64Prefix struct {
	EUI64  EUI64
	Length uint8
}

EUI64Prefix is an EUI64 with a prefix length.

func NewPopulatedEUI64Prefix added in v3.10.5

func NewPopulatedEUI64Prefix(r randy) *EUI64Prefix

NewPopulatedEUI64Prefix returns a random EUI64Prefix.

func (EUI64Prefix) ConfigString

func (prefix EUI64Prefix) ConfigString() string

ConfigString implements the config.Stringer interface.

func (EUI64Prefix) Equal

func (prefix EUI64Prefix) Equal(other EUI64Prefix) bool

Equal returns true iff prefixes are equal.

func (EUI64Prefix) GoString

func (prefix EUI64Prefix) GoString() string

GoString implements the GoStringer interface.

func (EUI64Prefix) IsZero

func (prefix EUI64Prefix) IsZero() bool

IsZero returns true iff the type is zero.

func (EUI64Prefix) Marshal

func (prefix EUI64Prefix) Marshal() ([]byte, error)

Marshal implements the proto.Marshaler interface.

func (EUI64Prefix) MarshalBinary

func (prefix EUI64Prefix) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (EUI64Prefix) MarshalJSON

func (prefix EUI64Prefix) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (EUI64Prefix) MarshalText

func (prefix EUI64Prefix) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (EUI64Prefix) MarshalTo

func (prefix EUI64Prefix) MarshalTo(data []byte) (int, error)

MarshalTo implements the MarshalerTo function required by generated protobuf.

func (EUI64Prefix) Matches

func (prefix EUI64Prefix) Matches(eui EUI64) bool

Matches returns true iff the EUI64 matches the prefix.

func (EUI64Prefix) Size

func (prefix EUI64Prefix) Size() int

Size implements the Sizer interface.

func (EUI64Prefix) String

func (prefix EUI64Prefix) String() string

String implements the Stringer interface.

func (*EUI64Prefix) Unmarshal

func (prefix *EUI64Prefix) Unmarshal(data []byte) error

Unmarshal implements the proto.Unmarshaler interface.

func (*EUI64Prefix) UnmarshalBinary

func (prefix *EUI64Prefix) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*EUI64Prefix) UnmarshalConfigString

func (prefix *EUI64Prefix) UnmarshalConfigString(s string) error

UnmarshalConfigString implements the config.Configurable interface.

func (*EUI64Prefix) UnmarshalJSON

func (prefix *EUI64Prefix) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*EUI64Prefix) UnmarshalText

func (prefix *EUI64Prefix) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type Interface

type Interface interface {
	IsZero() bool
	String() string
	GoString() string
	Size() int
	Marshal() ([]byte, error)
	MarshalTo(data []byte) (int, error)
	Unmarshal(data []byte) error
	MarshalJSON() ([]byte, error)
	UnmarshalJSON(data []byte) error
	MarshalBinary() ([]byte, error)
	UnmarshalBinary(data []byte) error
	MarshalText() ([]byte, error)
	UnmarshalText(data []byte) error
}

Interface all types in pkg/types must implement.

type JoinNonce

type JoinNonce [3]byte

JoinNonce is Join Server nonce used in the join procedure. - If LoRaWAN version <1.1 - it is randomly generated. - If LoRaWAN version >=1.1 - it is a scrictly increasing counter.

func NewPopulatedJoinNonce

func NewPopulatedJoinNonce(r randy) *JoinNonce

NewPopulatedJoinNonce returns a random JoinNonce.

func (JoinNonce) Equal

func (jn JoinNonce) Equal(other JoinNonce) bool

Equal returns true iff nonces are equal.

func (JoinNonce) GoString

func (jn JoinNonce) GoString() string

GoString implements the GoStringer interface.

func (JoinNonce) IsZero

func (jn JoinNonce) IsZero() bool

IsZero returns true iff the type is zero.

func (JoinNonce) Marshal

func (jn JoinNonce) Marshal() ([]byte, error)

Marshal implements the proto.Marshaler interface.

func (JoinNonce) MarshalBinary

func (jn JoinNonce) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (JoinNonce) MarshalJSON

func (jn JoinNonce) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (JoinNonce) MarshalText

func (jn JoinNonce) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (JoinNonce) MarshalTo

func (jn JoinNonce) MarshalTo(data []byte) (int, error)

MarshalTo implements the MarshalerTo function required by generated protobuf.

func (JoinNonce) Size

func (jn JoinNonce) Size() int

Size implements the Sizer interface.

func (JoinNonce) String

func (jn JoinNonce) String() string

String implements the Stringer interface.

func (*JoinNonce) Unmarshal

func (jn *JoinNonce) Unmarshal(data []byte) error

Unmarshal implements the proto.Unmarshaler interface.

func (*JoinNonce) UnmarshalBinary

func (jn *JoinNonce) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*JoinNonce) UnmarshalJSON

func (jn *JoinNonce) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*JoinNonce) UnmarshalText

func (jn *JoinNonce) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type NetID

type NetID [3]byte

NetID is issued by the LoRa Alliance.

func NewNetID

func NewNetID(typ byte, id []byte) (netID NetID, err error)

NewNetID returns new NetID.

func NewPopulatedNetID

func NewPopulatedNetID(r randy) *NetID

NewPopulatedNetID returns a random NetID.

func (NetID) Copy

func (id NetID) Copy(x *NetID) *NetID

Copy stores a copy of id in x and returns it.

func (NetID) Equal

func (id NetID) Equal(other NetID) bool

Equal returns true iff IDs are equal.

func (NetID) GoString

func (id NetID) GoString() string

GoString implements the GoStringer interface.

func (NetID) ID

func (id NetID) ID() []byte

ID returns ID contained in the NetID.

func (NetID) IDBits

func (id NetID) IDBits() uint

IDBits returns the bit-length of ID represented by the NetID.

func (NetID) IsZero

func (id NetID) IsZero() bool

IsZero returns true iff the type is zero.

func (NetID) Marshal

func (id NetID) Marshal() ([]byte, error)

Marshal implements the proto.Marshaler interface.

func (NetID) MarshalBinary

func (id NetID) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (NetID) MarshalJSON

func (id NetID) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (NetID) MarshalNumber

func (id NetID) MarshalNumber() uint32

MarshalNumber returns the numeric value.

func (NetID) MarshalText

func (id NetID) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (NetID) MarshalTo

func (id NetID) MarshalTo(data []byte) (int, error)

MarshalTo implements the MarshalerTo function required by generated protobuf.

func (NetID) Size

func (id NetID) Size() int

Size implements the Sizer interface.

func (NetID) String

func (id NetID) String() string

String implements the Stringer interface.

func (NetID) Type

func (id NetID) Type() byte

Type returns NetID type.

func (*NetID) Unmarshal

func (id *NetID) Unmarshal(data []byte) error

Unmarshal implements the proto.Unmarshaler interface.

func (*NetID) UnmarshalBinary

func (id *NetID) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*NetID) UnmarshalJSON

func (id *NetID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*NetID) UnmarshalNumber

func (id *NetID) UnmarshalNumber(netID uint32) error

UnmarshalNumber unmarshals the NetID from a numeric value.

func (*NetID) UnmarshalText

func (id *NetID) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

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