types

package
v3.27.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 12 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 GetDevAddrPrefixSliceFromFlag added in v3.19.2

func GetDevAddrPrefixSliceFromFlag(fs *pflag.FlagSet, name string) (value [][]byte, set bool, err error)

GetDevAddrPrefixSliceFromFlag gets a DevAddrPrefix slice from a named flag in the flag set.

func MarshalDevAddrPrefixSlice added in v3.21.2

func MarshalDevAddrPrefixSlice(s *jsonplugin.MarshalState, bs [][]byte)

MarshalDevAddrPrefixSlice marshals a slice of DevAddrPrefixes to JSON.

func MarshalHEXBytes added in v3.19.2

func MarshalHEXBytes(s *jsonplugin.MarshalState, b []byte)

MarshalHEXBytes marshals bytes to JSON as HEX.

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.

func Unmarshal16Bytes added in v3.19.2

func Unmarshal16Bytes(s *jsonplugin.UnmarshalState) []byte

Unmarshal16Bytes unmarshals 16 bytes from JSON. It accepts both hex and base64 encoding.

func Unmarshal2Bytes added in v3.19.2

func Unmarshal2Bytes(s *jsonplugin.UnmarshalState) []byte

Unmarshal2Bytes unmarshals 2 bytes from JSON. It accepts both hex and base64 encoding.

func Unmarshal3Bytes added in v3.19.2

func Unmarshal3Bytes(s *jsonplugin.UnmarshalState) []byte

Unmarshal3Bytes unmarshals 3 bytes from JSON. It accepts both hex and base64 encoding.

func Unmarshal4Bytes added in v3.19.2

func Unmarshal4Bytes(s *jsonplugin.UnmarshalState) []byte

Unmarshal4Bytes unmarshals 4 bytes from JSON. It accepts both hex and base64 encoding.

func Unmarshal8Bytes added in v3.19.2

func Unmarshal8Bytes(s *jsonplugin.UnmarshalState) []byte

Unmarshal8Bytes unmarshals 8 bytes from JSON. It accepts both hex and base64 encoding.

func UnmarshalDevAddrPrefixSlice added in v3.21.2

func UnmarshalDevAddrPrefixSlice(s *jsonplugin.UnmarshalState) [][]byte

UnmarshalDevAddrPrefixSlice unmarshals a slice of DevAddrPrefixes from JSON.

Types

type AES128Key

type AES128Key [16]byte

AES128Key is an 128-bit AES key.

func GetAES128Key added in v3.19.1

func GetAES128Key(b []byte) (*AES128Key, error)

GetAES128Key gets a typed AES128Key from the bytes. It returns nil, nil if b is nil. It returns an error if unmarshaling fails.

func GetAES128KeyFromFlag added in v3.19.2

func GetAES128KeyFromFlag(fs *pflag.FlagSet, name string) (value AES128Key, set bool, err error)

GetAES128KeyFromFlag gets an AES128Key from a named flag in the flag set.

func MustAES128Key added in v3.19.2

func MustAES128Key(b []byte) *AES128Key

MustAES128Key returns a typed AES128Key from the bytes. It returns nil if the bytes are empty. It panics if unmarshaling results in an error.

func (AES128Key) Bytes added in v3.19.2

func (key AES128Key) Bytes() []byte

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

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) MarshalProtoJSON added in v3.19.2

func (key *AES128Key) MarshalProtoJSON(s *jsonplugin.MarshalState)

MarshalProtoJSON implements the jsonplugin.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) OrZero added in v3.19.2

func (key *AES128Key) OrZero() AES128Key

OrZero returns the key value, or a zero value if the key was nil.

func (AES128Key) Size

func (key AES128Key) Size() int

Size implements the Sizer interface.

func (AES128Key) String

func (key AES128Key) String() string

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) UnmarshalProtoJSON added in v3.19.2

func (key *AES128Key) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)

UnmarshalProtoJSON implements the jsonplugin.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 GetDevAddr added in v3.19.1

func GetDevAddr(b []byte) (*DevAddr, error)

GetDevAddr gets a typed DevAddr from the bytes. It returns nil, nil if b is nil. It returns an error if unmarshaling fails.

func GetDevAddrFromFlag added in v3.19.2

func GetDevAddrFromFlag(fs *pflag.FlagSet, name string) (value DevAddr, set bool, err error)

GetDevAddrFromFlag gets a DevAddr from a named flag in the flag set.

func MustDevAddr added in v3.19.2

func MustDevAddr(b []byte) *DevAddr

MustDevAddr returns a typed DevAddr from the bytes. It returns nil if the bytes are empty. It panics if unmarshaling results in an error.

func NewDevAddr

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

NewDevAddr returns new DevAddr.

func (DevAddr) Bytes added in v3.19.2

func (addr DevAddr) Bytes() []byte

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

func (DevAddr) HasPrefix

func (addr DevAddr) HasPrefix(prefix DevAddrPrefix) bool

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

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) MarshalProtoJSON added in v3.15.1

func (addr *DevAddr) MarshalProtoJSON(s *jsonplugin.MarshalState)

MarshalProtoJSON implements the jsonplugin.Marshaler interface.

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) NetID added in v3.19.1

func (addr DevAddr) NetID() (NetID, bool)

NetID returns NetID of the DevAddr.

Example
devAddr := DevAddr{0x26, 0x01, 0x26, 0xB4}
netID, ok := devAddr.NetID()
if ok {
	fmt.Printf("%#x", netID[:])
}
Output:

0x000013

func (DevAddr) NetIDType

func (addr DevAddr) NetIDType() (byte, bool)

NetIDType returns the NetID type of the DevAddr.

func (DevAddr) NwkAddr

func (addr DevAddr) NwkAddr() ([]byte, bool)

NwkAddr returns NwkAddr of the DevAddr.

func (*DevAddr) OrZero added in v3.19.2

func (addr *DevAddr) OrZero() DevAddr

OrZero returns the DevAddr value, or a zero value if the DevAddr was nil.

func (DevAddr) Size

func (addr DevAddr) Size() int

Size implements the Sizer interface.

func (DevAddr) String

func (addr DevAddr) String() string

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) UnmarshalProtoJSON added in v3.15.1

func (addr *DevAddr) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)

UnmarshalProtoJSON implements the jsonplugin.Unmarshaler interface.

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 GetDevAddrPrefix added in v3.19.2

func GetDevAddrPrefix(b []byte) (*DevAddrPrefix, error)

GetDevAddrPrefix gets a typed DevAddrPrefix from the bytes. It returns nil, nil if b is nil. It returns an error if unmarshaling fails.

func MustDevAddrPrefix added in v3.19.2

func MustDevAddrPrefix(b []byte) *DevAddrPrefix

MustDevAddrPrefix returns a typed DevAddrPrefix from the bytes. It returns nil if the bytes are empty. It panics if unmarshaling results in an error.

func (DevAddrPrefix) Bytes added in v3.19.2

func (prefix DevAddrPrefix) Bytes() []byte

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

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) OrZero added in v3.19.2

func (prefix *DevAddrPrefix) OrZero() DevAddrPrefix

OrZero returns the DevAddr prefix value, or a zero value if the DevAddr prefix was nil.

func (DevAddrPrefix) Size

func (prefix DevAddrPrefix) Size() int

Size implements the Sizer interface.

func (DevAddrPrefix) String

func (prefix DevAddrPrefix) String() string

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 GetDevNonce added in v3.19.2

func GetDevNonce(b []byte) (*DevNonce, error)

GetDevNonce gets a typed DevNonce from the bytes. It returns nil, nil if b is nil. It returns an error if unmarshaling fails.

func MustDevNonce added in v3.19.2

func MustDevNonce(b []byte) *DevNonce

MustDevNonce returns a typed DevNonce from the bytes. It returns nil, nil if b is nil. It panics if unmarshaling results in an error.

func (DevNonce) Bytes added in v3.19.2

func (dn DevNonce) Bytes() []byte

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

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) MarshalProtoJSON added in v3.15.1

func (dn *DevNonce) MarshalProtoJSON(s *jsonplugin.MarshalState)

MarshalProtoJSON implements the jsonplugin.Marshaler interface.

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) OrZero added in v3.19.2

func (dn *DevNonce) OrZero() DevNonce

OrZero returns the nonce value, or a zero value if the nonce was nil.

func (DevNonce) Size

func (dn DevNonce) Size() int

Size implements the Sizer interface.

func (DevNonce) String

func (dn DevNonce) String() string

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) UnmarshalProtoJSON added in v3.15.1

func (dn *DevNonce) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)

UnmarshalProtoJSON implements the jsonplugin.Unmarshaler interface.

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 GetEUI64 added in v3.19.1

func GetEUI64(b []byte) (*EUI64, error)

GetEUI64 gets a typed EUI64 from the bytes. It returns nil, nil if b is nil. It returns an error if unmarshaling fails.

func GetEUI64FromFlag added in v3.19.2

func GetEUI64FromFlag(fs *pflag.FlagSet, name string) (value EUI64, set bool, err error)

GetEUI64FromFlag gets an EUI64 from a named flag in the flag set.

func GetEUI64SliceFromFlag added in v3.19.2

func GetEUI64SliceFromFlag(fs *pflag.FlagSet, name string) (value []EUI64, set bool, err error)

GetEUI64SliceFromFlag gets an EUI64 slice from a named flag in the flag set.

func MustEUI64 added in v3.19.2

func MustEUI64(b []byte) *EUI64

MustEUI64 returns a typed EUI64 from the bytes. It returns nil if the bytes are empty. It panics if unmarshaling results in an error.

func (EUI64) Bytes added in v3.19.2

func (eui EUI64) Bytes() []byte

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

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) MarshalProtoJSON added in v3.15.1

func (eui *EUI64) MarshalProtoJSON(s *jsonplugin.MarshalState)

MarshalProtoJSON implements the jsonplugin.Marshaler interface.

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) OrZero added in v3.19.2

func (eui *EUI64) OrZero() EUI64

OrZero returns the EUI value, or a zero value if the EUI was nil.

func (EUI64) Size

func (eui EUI64) Size() int

Size implements the Sizer interface.

func (EUI64) String

func (eui EUI64) String() string

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) UnmarshalProtoJSON added in v3.15.1

func (eui *EUI64) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)

UnmarshalProtoJSON implements the jsonplugin.Unmarshaler interface.

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 GetEUI64Prefix added in v3.19.2

func GetEUI64Prefix(b []byte) (*EUI64Prefix, error)

GetEUI64Prefix gets a typed EUI64Prefix from the bytes. It returns nil, nil if b is nil. It returns an error if unmarshaling fails.

func GetEUI64PrefixSliceFromFlag added in v3.19.2

func GetEUI64PrefixSliceFromFlag(fs *pflag.FlagSet, name string) (value []EUI64Prefix, set bool, err error)

GetEUI64PrefixSliceFromFlag gets an EUI64 prefix slice from a named flag in the flag set.

func MustEUI64Prefix added in v3.19.2

func MustEUI64Prefix(b []byte) *EUI64Prefix

MustEUI64Prefix returns a typed EUI64Prefix from the bytes. It returns nil if the bytes are empty. It panics if unmarshaling results in an error.

func (EUI64Prefix) Bytes added in v3.19.2

func (prefix EUI64Prefix) Bytes() []byte

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

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) OrZero added in v3.19.2

func (prefix *EUI64Prefix) OrZero() EUI64Prefix

OrZero returns the EUI prefix value, or a zero value if the EUI prefix was nil.

func (EUI64Prefix) Size

func (prefix EUI64Prefix) Size() int

Size implements the Sizer interface.

func (EUI64Prefix) String

func (prefix EUI64Prefix) String() string

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
	Bytes() []byte
	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 GetJoinNonce added in v3.19.2

func GetJoinNonce(b []byte) (*JoinNonce, error)

GetJoinNonce gets a typed JoinNonce from the bytes. It returns nil, nil if b is nil. It returns an error if unmarshaling fails.

func MustJoinNonce added in v3.19.2

func MustJoinNonce(b []byte) *JoinNonce

MustJoinNonce returns a typed JoinNonce from the bytes. It returns nil, nil if b is nil. It panics if unmarshaling results in an error.

func (JoinNonce) Bytes added in v3.19.2

func (jn JoinNonce) Bytes() []byte

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

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) MarshalProtoJSON added in v3.15.1

func (jn *JoinNonce) MarshalProtoJSON(s *jsonplugin.MarshalState)

MarshalProtoJSON implements the jsonplugin.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) OrZero added in v3.19.2

func (jn *JoinNonce) OrZero() JoinNonce

OrZero returns the nonce value, or a zero value if the nonce was nil.

func (JoinNonce) Size

func (jn JoinNonce) Size() int

Size implements the Sizer interface.

func (JoinNonce) String

func (jn JoinNonce) String() string

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) UnmarshalProtoJSON added in v3.15.1

func (jn *JoinNonce) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)

UnmarshalProtoJSON implements the jsonplugin.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 GetNetID added in v3.19.1

func GetNetID(b []byte) (*NetID, error)

GetNetID gets a typed NetID from the bytes. It returns nil, nil if b is nil. It returns an error if unmarshaling fails.

func GetNetIDFromFlag added in v3.19.2

func GetNetIDFromFlag(fs *pflag.FlagSet, name string) (value NetID, set bool, err error)

GetNetIDFromFlag gets a NetID from a named flag in the flag set.

func MustNetID added in v3.19.2

func MustNetID(b []byte) *NetID

MustNetID returns a typed NetID from the bytes. It returns nil if the bytes are empty. It panics if unmarshaling results in an error.

func NewNetID

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

NewNetID returns new NetID.

func (NetID) Bytes added in v3.19.2

func (id NetID) Bytes() []byte

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

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) MarshalProtoJSON added in v3.15.1

func (id *NetID) MarshalProtoJSON(s *jsonplugin.MarshalState)

MarshalProtoJSON implements the jsonplugin.Marshaler interface.

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) OrZero added in v3.19.2

func (id *NetID) OrZero() NetID

OrZero returns the NetID value, or a zero value if the NetID was nil.

func (NetID) Size

func (id NetID) Size() int

Size implements the Sizer interface.

func (NetID) String

func (id NetID) String() string

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) UnmarshalProtoJSON added in v3.15.1

func (id *NetID) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)

UnmarshalProtoJSON implements the jsonplugin.Unmarshaler interface.

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