Overview of fxamacker/cbor
masterfxamacker/cbor
fxamacker/cbor is a high-performance Go library for encoding and decoding CBOR (IETF STD 94 / RFC 8949) and CBOR Sequences (RFC 8742). It also supports Extended Diagnostic Notation (Appendix G of RFC 8610).
Key Features:
- Full Conformance: Complies with IETF STD 94.
- Security: Includes configurable limits to defend against malicious/adversarial CBOR data, preventing resource exhaustion attacks (unlike
encoding/gob). - Performance: Fast encoding/decoding without using Go's
unsafepackage. Rejects malformed data very efficiently. - Data Size Optimization: Supports struct tags to reduce encoded size and can optionally shrink
float64tofloat32orfloat16if values fit. - Usability: The API is designed to be similar to
encoding/json, making it easy to adopt. Encoding and decoding modes can be created at startup and reused across goroutines.