Documentation ¶
Overview ¶
Package util provides utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSerialNumberForAccessoryName ¶
GetSerialNumberForAccessoryName returns the serial for a specific name stored in storage. When no serial number is stored for this name yet, a new one is created using RandomHexString()
func MAC48Address ¶
MAC48Address returns a MAC-48-like address from the argument string
Types ¶
type Container ¶
type Container interface { // SetByte sets one byte for a key SetByte(key, value byte) // SetBytes sets bytes for a key SetBytes(key byte, value []byte) // SetString sets a string for a key SetString(key byte, value string) // GetByte returns one byte for a key GetByte(key byte) byte // GetBytes returns bytes for a key GetBytes(key byte) []byte // GetString return a string for a key GetString(key byte) string // BytesBuffer returns the raw bytes BytesBuffer() *bytes.Buffer }
Container is a dictionary using byte keys and values.
func NewTLV8Container ¶
func NewTLV8Container() Container
NewTLV8Container returns a type-length-value container which implements the Container interface. Packets which value exceed a length of 8 bit (255) will be split up in multiple packets.
type Storage ¶
type Storage interface { // Set sets bytes for a key Set(key string, value []byte) error // Delete removes bytes for a key Delete(key string) error // Get returns bytes for a key Get(key string) ([]byte, error) // KeysWithSuffix returns all keys with a specific suffix KeysWithSuffix(suffix string) ([]string, error) }
Storage stores bytes for a key.
func NewFileStorage ¶
NewFileStorage create a file storage for the specified directory. The folder is created if necessary. Every key-value pair is stored in a seperate file.
func NewTempFileStorage ¶
NewTempFileStorage returns a new storage inside temporary folder.