Documentation ¶
Overview ¶
Package types contains basic types that are used in The Things Network's protobuf messages.
Index ¶
- Variables
- func GetDevAddrPrefixSliceFromFlag(fs *pflag.FlagSet, name string) (value [][]byte, set bool, err error)
- func MarshalDevAddrPrefixSlice(s *jsonplugin.MarshalState, bs [][]byte)
- func MarshalHEXBytes(s *jsonplugin.MarshalState, b []byte)
- func NwkAddrBits(netID NetID) uint
- func NwkAddrLength(netID NetID) int
- func Unmarshal16Bytes(s *jsonplugin.UnmarshalState) []byte
- func Unmarshal2Bytes(s *jsonplugin.UnmarshalState) []byte
- func Unmarshal3Bytes(s *jsonplugin.UnmarshalState) []byte
- func Unmarshal4Bytes(s *jsonplugin.UnmarshalState) []byte
- func Unmarshal8Bytes(s *jsonplugin.UnmarshalState) []byte
- func UnmarshalDevAddrPrefixSlice(s *jsonplugin.UnmarshalState) [][]byte
- type AES128Key
- func (key AES128Key) Bytes() []byte
- func (key AES128Key) Equal(other AES128Key) bool
- func (key AES128Key) GoString() string
- func (key AES128Key) IsZero() bool
- func (key AES128Key) Marshal() ([]byte, error)
- func (key AES128Key) MarshalBinary() ([]byte, error)
- func (key AES128Key) MarshalJSON() ([]byte, error)
- func (key *AES128Key) MarshalProtoJSON(s *jsonplugin.MarshalState)
- func (key AES128Key) MarshalText() ([]byte, error)
- func (key AES128Key) MarshalTo(data []byte) (int, error)
- func (key *AES128Key) OrZero() AES128Key
- func (key AES128Key) Size() int
- func (key AES128Key) String() string
- func (key *AES128Key) Unmarshal(data []byte) error
- func (key *AES128Key) UnmarshalBinary(data []byte) error
- func (key *AES128Key) UnmarshalJSON(data []byte) error
- func (key *AES128Key) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)
- func (key *AES128Key) UnmarshalText(data []byte) error
- type DevAddr
- func (addr DevAddr) Bytes() []byte
- func (addr DevAddr) Copy(x *DevAddr) *DevAddr
- func (addr DevAddr) Equal(other DevAddr) bool
- func (addr DevAddr) GoString() string
- func (addr DevAddr) HasPrefix(prefix DevAddrPrefix) bool
- func (addr DevAddr) IsZero() bool
- func (addr DevAddr) Marshal() ([]byte, error)
- func (addr DevAddr) MarshalBinary() ([]byte, error)
- func (addr DevAddr) MarshalJSON() ([]byte, error)
- func (addr DevAddr) MarshalNumber() uint32
- func (addr *DevAddr) MarshalProtoJSON(s *jsonplugin.MarshalState)
- func (addr DevAddr) MarshalText() ([]byte, error)
- func (addr DevAddr) MarshalTo(data []byte) (int, error)
- func (addr DevAddr) Mask(bits uint8) (masked DevAddr)
- func (addr DevAddr) NetID() (NetID, bool)
- func (addr DevAddr) NetIDType() (byte, bool)
- func (addr DevAddr) NwkAddr() ([]byte, bool)
- func (addr *DevAddr) OrZero() DevAddr
- func (addr DevAddr) Size() int
- func (addr DevAddr) String() string
- func (addr *DevAddr) Unmarshal(data []byte) error
- func (addr *DevAddr) UnmarshalBinary(data []byte) error
- func (addr *DevAddr) UnmarshalJSON(data []byte) error
- func (addr *DevAddr) UnmarshalNumber(n uint32)
- func (addr *DevAddr) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)
- func (addr *DevAddr) UnmarshalText(data []byte) error
- func (addr DevAddr) WithPrefix(prefix DevAddrPrefix) (prefixed DevAddr)
- type DevAddrPrefix
- func (prefix DevAddrPrefix) Bytes() []byte
- func (prefix DevAddrPrefix) ConfigString() string
- func (prefix DevAddrPrefix) Equal(other DevAddrPrefix) bool
- func (prefix DevAddrPrefix) GoString() string
- func (prefix DevAddrPrefix) IsZero() bool
- func (prefix DevAddrPrefix) Marshal() ([]byte, error)
- func (prefix DevAddrPrefix) MarshalBinary() ([]byte, error)
- func (prefix DevAddrPrefix) MarshalJSON() ([]byte, error)
- func (prefix DevAddrPrefix) MarshalText() ([]byte, error)
- func (prefix DevAddrPrefix) MarshalTo(data []byte) (int, error)
- func (prefix DevAddrPrefix) Matches(addr DevAddr) bool
- func (prefix *DevAddrPrefix) OrZero() DevAddrPrefix
- func (prefix DevAddrPrefix) Size() int
- func (prefix DevAddrPrefix) String() string
- func (prefix *DevAddrPrefix) Unmarshal(data []byte) error
- func (prefix *DevAddrPrefix) UnmarshalBinary(data []byte) error
- func (prefix *DevAddrPrefix) UnmarshalConfigString(s string) error
- func (prefix *DevAddrPrefix) UnmarshalJSON(data []byte) error
- func (prefix *DevAddrPrefix) UnmarshalText(data []byte) error
- type DevNonce
- func (dn DevNonce) Bytes() []byte
- func (dn DevNonce) Equal(other DevNonce) bool
- func (dn DevNonce) GoString() string
- func (dn DevNonce) IsZero() bool
- func (dn DevNonce) Marshal() ([]byte, error)
- func (dn DevNonce) MarshalBinary() ([]byte, error)
- func (dn DevNonce) MarshalJSON() ([]byte, error)
- func (dn DevNonce) MarshalNumber() uint16
- func (dn *DevNonce) MarshalProtoJSON(s *jsonplugin.MarshalState)
- func (dn DevNonce) MarshalText() ([]byte, error)
- func (dn DevNonce) MarshalTo(data []byte) (int, error)
- func (dn *DevNonce) OrZero() DevNonce
- func (dn DevNonce) Size() int
- func (dn DevNonce) String() string
- func (dn *DevNonce) Unmarshal(data []byte) error
- func (dn *DevNonce) UnmarshalBinary(data []byte) error
- func (dn *DevNonce) UnmarshalJSON(data []byte) error
- func (dn *DevNonce) UnmarshalNumber(n uint16)
- func (dn *DevNonce) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)
- func (dn *DevNonce) UnmarshalText(data []byte) error
- type EUI64
- func (eui EUI64) Bytes() []byte
- func (eui EUI64) Copy(x *EUI64) *EUI64
- func (eui EUI64) Equal(other EUI64) bool
- func (eui EUI64) GoString() string
- func (eui EUI64) HasPrefix(prefix EUI64Prefix) bool
- func (eui EUI64) IsZero() bool
- func (eui EUI64) Marshal() ([]byte, error)
- func (eui EUI64) MarshalBinary() ([]byte, error)
- func (eui EUI64) MarshalJSON() ([]byte, error)
- func (eui EUI64) MarshalNumber() uint64
- func (eui *EUI64) MarshalProtoJSON(s *jsonplugin.MarshalState)
- func (eui EUI64) MarshalText() ([]byte, error)
- func (eui EUI64) MarshalTo(data []byte) (int, error)
- func (eui EUI64) Mask(bits uint8) (masked EUI64)
- func (eui *EUI64) OrZero() EUI64
- func (eui EUI64) Size() int
- func (eui EUI64) String() string
- func (eui *EUI64) Unmarshal(data []byte) error
- func (eui *EUI64) UnmarshalBinary(data []byte) error
- func (eui *EUI64) UnmarshalJSON(data []byte) error
- func (eui *EUI64) UnmarshalNumber(n uint64)
- func (eui *EUI64) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)
- func (eui *EUI64) UnmarshalText(data []byte) error
- func (eui EUI64) WithPrefix(prefix EUI64Prefix) (prefixed EUI64)
- type EUI64Prefix
- func (prefix EUI64Prefix) Bytes() []byte
- func (prefix EUI64Prefix) ConfigString() string
- func (prefix EUI64Prefix) Equal(other EUI64Prefix) bool
- func (prefix EUI64Prefix) GoString() string
- func (prefix EUI64Prefix) IsZero() bool
- func (prefix EUI64Prefix) Marshal() ([]byte, error)
- func (prefix EUI64Prefix) MarshalBinary() ([]byte, error)
- func (prefix EUI64Prefix) MarshalJSON() ([]byte, error)
- func (prefix EUI64Prefix) MarshalText() ([]byte, error)
- func (prefix EUI64Prefix) MarshalTo(data []byte) (int, error)
- func (prefix EUI64Prefix) Matches(eui EUI64) bool
- func (prefix *EUI64Prefix) OrZero() EUI64Prefix
- func (prefix EUI64Prefix) Size() int
- func (prefix EUI64Prefix) String() string
- func (prefix *EUI64Prefix) Unmarshal(data []byte) error
- func (prefix *EUI64Prefix) UnmarshalBinary(data []byte) error
- func (prefix *EUI64Prefix) UnmarshalConfigString(s string) error
- func (prefix *EUI64Prefix) UnmarshalJSON(data []byte) error
- func (prefix *EUI64Prefix) UnmarshalText(data []byte) error
- type Interface
- type JoinNonce
- func (jn JoinNonce) Bytes() []byte
- func (jn JoinNonce) Equal(other JoinNonce) bool
- func (jn JoinNonce) GoString() string
- func (jn JoinNonce) IsZero() bool
- func (jn JoinNonce) Marshal() ([]byte, error)
- func (jn JoinNonce) MarshalBinary() ([]byte, error)
- func (jn JoinNonce) MarshalJSON() ([]byte, error)
- func (jn *JoinNonce) MarshalProtoJSON(s *jsonplugin.MarshalState)
- func (jn JoinNonce) MarshalText() ([]byte, error)
- func (jn JoinNonce) MarshalTo(data []byte) (int, error)
- func (jn *JoinNonce) OrZero() JoinNonce
- func (jn JoinNonce) Size() int
- func (jn JoinNonce) String() string
- func (jn *JoinNonce) Unmarshal(data []byte) error
- func (jn *JoinNonce) UnmarshalBinary(data []byte) error
- func (jn *JoinNonce) UnmarshalJSON(data []byte) error
- func (jn *JoinNonce) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)
- func (jn *JoinNonce) UnmarshalText(data []byte) error
- type NetID
- func (id NetID) Bytes() []byte
- func (id NetID) Copy(x *NetID) *NetID
- func (id NetID) Equal(other NetID) bool
- func (id NetID) GoString() string
- func (id NetID) ID() []byte
- func (id NetID) IDBits() uint
- func (id NetID) IsZero() bool
- func (id NetID) Marshal() ([]byte, error)
- func (id NetID) MarshalBinary() ([]byte, error)
- func (id NetID) MarshalJSON() ([]byte, error)
- func (id NetID) MarshalNumber() uint32
- func (id *NetID) MarshalProtoJSON(s *jsonplugin.MarshalState)
- func (id NetID) MarshalText() ([]byte, error)
- func (id NetID) MarshalTo(data []byte) (int, error)
- func (id *NetID) OrZero() NetID
- func (id NetID) Size() int
- func (id NetID) String() string
- func (id NetID) Type() byte
- func (id *NetID) Unmarshal(data []byte) error
- func (id *NetID) UnmarshalBinary(data []byte) error
- func (id *NetID) UnmarshalJSON(data []byte) error
- func (id *NetID) UnmarshalNumber(netID uint32) error
- func (id *NetID) UnmarshalProtoJSON(s *jsonplugin.UnmarshalState)
- func (id *NetID) UnmarshalText(data []byte) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var MaxDevAddr = DevAddr{0xFF, 0xFF, 0xFF, 0xFF}
MaxDevAddr is the highest value possible for a DevAddr.
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 ¶
NwkAddrBits returns the length of NwkAddr field of netID in bits.
func NwkAddrLength ¶
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
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
GetAES128KeyFromFlag gets an AES128Key from a named flag in the flag set.
func MustAES128Key ¶ added in v3.19.2
MustAES128Key returns a typed AES128Key from the bytes. It returns nil if b is nil. It panics if unmarshaling results in an error.
func (AES128Key) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (AES128Key) MarshalJSON ¶
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 ¶
MarshalText implements the encoding.TextMarshaler interface.
func (AES128Key) MarshalTo ¶
MarshalTo implements the MarshalerTo function required by generated protobuf.
func (*AES128Key) OrZero ¶ added in v3.19.2
OrZero returns the key value, or a zero value if the key was nil.
func (*AES128Key) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*AES128Key) UnmarshalJSON ¶
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 ¶
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
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
GetDevAddrFromFlag gets a DevAddr from a named flag in the flag set.
func MustDevAddr ¶ added in v3.19.2
MustDevAddr returns a typed DevAddr from the bytes. It returns nil if b is nil. It panics if unmarshaling results in an error.
func NewDevAddr ¶
NewDevAddr returns new DevAddr.
func (DevAddr) HasPrefix ¶
func (addr DevAddr) HasPrefix(prefix DevAddrPrefix) bool
HasPrefix returns true iff the DevAddr has a prefix of given length.
func (DevAddr) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (DevAddr) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (DevAddr) MarshalNumber ¶
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 ¶
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 ¶
MarshalTo implements the MarshalerTo function required by generated protobuf.
func (DevAddr) Mask ¶
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
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) OrZero ¶ added in v3.19.2
OrZero returns the DevAddr value, or a zero value if the DevAddr was nil.
func (*DevAddr) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*DevAddr) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*DevAddr) UnmarshalNumber ¶
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 ¶
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 ¶
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 b is nil. 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
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
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) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (DevNonce) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (DevNonce) MarshalNumber ¶
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 ¶
MarshalText implements the encoding.TextMarshaler interface.
func (DevNonce) MarshalTo ¶
MarshalTo implements the MarshalerTo function required by generated protobuf.
func (*DevNonce) OrZero ¶ added in v3.19.2
OrZero returns the nonce value, or a zero value if the nonce was nil.
func (*DevNonce) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*DevNonce) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*DevNonce) UnmarshalNumber ¶
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 ¶
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
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
GetEUI64FromFlag gets an EUI64 from a named flag in the flag set.
func GetEUI64SliceFromFlag ¶ added in v3.19.2
GetEUI64SliceFromFlag gets an EUI64 slice from a named flag in the flag set.
func MustEUI64 ¶ added in v3.19.2
MustEUI64 returns a typed EUI64 from the bytes. It returns nil if b is nil. It panics if unmarshaling results in an error.
func (EUI64) HasPrefix ¶
func (eui EUI64) HasPrefix(prefix EUI64Prefix) bool
HasPrefix returns true iff the EUI64 has a prefix of given length.
func (EUI64) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (EUI64) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (EUI64) MarshalNumber ¶
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 ¶
MarshalText implements the encoding.TextMarshaler interface.
func (EUI64) MarshalTo ¶
MarshalTo implements the MarshalerTo function required by generated protobuf.
func (*EUI64) OrZero ¶ added in v3.19.2
OrZero returns the EUI value, or a zero value if the EUI was nil.
func (*EUI64) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*EUI64) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*EUI64) UnmarshalNumber ¶
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 ¶
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 ¶
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 b is nil. 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) 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
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
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) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (JoinNonce) MarshalJSON ¶
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 ¶
MarshalText implements the encoding.TextMarshaler interface.
func (JoinNonce) MarshalTo ¶
MarshalTo implements the MarshalerTo function required by generated protobuf.
func (*JoinNonce) OrZero ¶ added in v3.19.2
OrZero returns the nonce value, or a zero value if the nonce was nil.
func (*JoinNonce) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*JoinNonce) UnmarshalJSON ¶
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 ¶
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
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
GetNetIDFromFlag gets a NetID from a named flag in the flag set.
func MustNetID ¶ added in v3.19.2
MustNetID returns a typed NetID from the bytes. It returns nil if b is nil. It panics if unmarshaling results in an error.
func (NetID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (NetID) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (NetID) MarshalNumber ¶
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 ¶
MarshalText implements the encoding.TextMarshaler interface.
func (NetID) MarshalTo ¶
MarshalTo implements the MarshalerTo function required by generated protobuf.
func (*NetID) OrZero ¶ added in v3.19.2
OrZero returns the NetID value, or a zero value if the NetID was nil.
func (*NetID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*NetID) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*NetID) UnmarshalNumber ¶
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 ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.