Documentation ¶
Overview ¶
Package inform handles data encoding/decoding for the UniFi inform request/response cycle such that payload information can be successfully exchanged.
Index ¶
Constants ¶
const InformContentType string = "application/x-binary"
InformContentType is the content type used for inform messages
Variables ¶
var ErrNoMagic = errors.New("missing magic header")
ErrNoMagic is returned when magic header is missing
var ErrNotImplemented = errors.New("functionality required is not yet implemented")
ErrNotImplemented is returned when we have not yet implemented functionality but know how to recognize it
var ErrTruncatedPacket = errors.New("truncated packet")
ErrTruncatedPacket is returned when packet is too short
var ErrUnhandledVer = errors.New("unhandled payload version")
ErrUnhandledVer is returned when payload version in header does not match version known compatible with this library
Functions ¶
This section is empty.
Types ¶
type Header ¶
type Header struct { Version uint32 HardwareAddr net.HardwareAddr EncryptedAES bool ZLibCompressed bool SnappyCompressed bool EncryptedGCM bool // contains filtered or unexported fields }
Header represents header of inform message from Ubiquiti UniFi device
func DecodeHeader ¶
DecodeHeader parses a ubiquiti inform message
func (*Header) DecodePayload ¶
DecodePayload decodes information from a UniFi inform payload (usually json text) using params from Header
func (*Header) NewResponse ¶
NewResponse serializes a unifi inform response
type NoOpResponse ¶
type NoOpResponse struct { Kind string `json:"_type"` IntervalSeconds uint64 `json:"interval"` ServerTime string `json:"server_time_in_utc"` }
NoOpResponse is a noop response...
func NewNoOpResponse ¶
func NewNoOpResponse(sleepSeconds uint64) NoOpResponse
NewNoOpResponse generates a new NoOpResponse bundle
func (NoOpResponse) JSON ¶
func (r NoOpResponse) JSON() (response []byte, err error)
JSON returns json representation of response