Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 1.91 KB

README.md

File metadata and controls

40 lines (25 loc) · 1.91 KB

gnabglib-go

Basic tools for any app

Checksum

CodeGen

  • BytesToHexSep: Format a byte slice in rows of bytesPerSection values, formatted in hexadecimal format
  • BytesToString: Format a byte slice as a utf8 string, useful for constants in go
  • BytesToStringSep: Format a byte slice in rows of bytesPerSection UTF8 strings

Encoding

  • hex: Convert byte slices to/from hex strings. Includes a tag:tiny version that doesn't use a 256 byte lookup table for use on embedded devices (~50% slower than regular). Similar to go's built-in hex encoded, except errors include location and value of invalid hex-values on decode.

Endian

  • Detect platform endianness

Hash

Net

  • CIDR, IPv4, Mask types
  • IpTree: Add CIDR and IP addresses to a collection and get back the shortest description of the composition (repeat/overlapping CIDR will merge, sequential CIDR will join into larger sets). Useful for eg firewall rules

Testing

go test ./...