-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nodes): prevent nil pointers in node parsing (#23)
* fix(nodes): prevent nil pointers in node parsing * chore(docs): improve go doc * chore(lint): add godot to linters
- Loading branch information
1 parent
fd30700
commit 3a2f172
Showing
7 changed files
with
152 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
/* | ||
Package tlv holds all logic to decode TLV messages into `Nodes`. | ||
Package tlv holds all logic to decode TLV messages into [Nodes]. | ||
There are two ways to use this package: with the standard decoder or creating | ||
a custom Decoder with custom tag/length sizes and byte order. The standard | ||
decoder uses 2-byte tags, 2-byte lengths and big endian byte order. | ||
a custom [Decoder] with custom tag/length sizes and byte order. The standard | ||
decoder uses 2-byte tags, 2-byte lengths and big endian [binary.ByteOrder]. | ||
Nodes are a representation of a collection of decoded TLV messages. | ||
Specific messages can be filtered by Tag and indexes can be accessed | ||
[Nodes] are a representation of a collection of decoded TLV messages. | ||
Specific messages can be filtered by [Tag] and indexes can be accessed | ||
directly in an array-like syntax: | ||
firstNode := nodes[0] | ||
Node is a representation of a single TLV message, comprised of a Tag, | ||
a Length and a Value. The struct has many helper methods to parse the | ||
[Node] is a representation of a single TLV message, comprised of a [Tag], | ||
a [Length] and a Value. The struct has many helper methods to parse the | ||
value as different types (e.g. integers, strings, dates and booleans), | ||
as well as nested TLV Nodes. | ||
as well as nested TLV [Nodes]. | ||
node.GetNodes() | ||
node.GetPaddedUint8() | ||
Note: Nodes decoded with a custom configuration retain the configuration | ||
when parsing their values as nodes, so messages always have consistent | ||
Note: [Nodes] decoded with a custom configuration retain the configuration | ||
when parsing their values as other nodes, so messages always have consistent | ||
tag/length sizes and byte order. | ||
*/ | ||
package tlv |
Oops, something went wrong.