Versions in this module Expand all Collapse all v0 v0.2.0 Oct 11, 2026 v0.1.0 Oct 11, 2026 Changes in this version + const AbortBufferOverflow + const AbortOther + const AbortSegNotSupp + const Accumulator + const AnalogInput + const AnalogOutput + const AnalogValue + const B6AddrLen + const B6AddrRes + const B6AddrResACK + const B6DeleteFDTEntry + const B6DistributeBcast + const B6ForwardedNPDU + const B6FwdAddrRes + const B6OriginalBcast + const B6OriginalUnicast + const B6RegisterFD + const B6Result + const B6VirtAddrRes + const B6VirtAddrResACK + const BVLCDeleteFDT + const BVLCDistributeBcast + const BVLCForwardedNPDU + const BVLCOriginalBcast + const BVLCOriginalUnicast + const BVLCReadBDT + const BVLCReadBDTAck + const BVLCReadFDT + const BVLCReadFDTAck + const BVLCRegisterFD + const BVLCResult + const BVLCWriteBDT + const BinaryInput + const BinaryOutput + const BinaryValue + const DefaultPort + const ErrClassCommunication + const ErrClassServices + const ErrCodeBVLCFunctionUnknown + const ErrCodeHeaderNotUnderstood + const ErrCodeNodeDuplicateVMAC + const ErrCodeOptionalNotSupported + const ErrCodeTLSError + const ErrCodeUnknownSubscription + const ErrCodeWebsocketSchemeNotSupp + const MaxSegments + const MaxWindow + const MultiStateInput + const MultiStateOutput + const MultiStateValue + const NlIAmRouter + const NlWhoIsRouter + const ObjDevice + const ObjFile + const ObjNotificationCl + const PDUAbort + const PDUComplexACK + const PDUConfirmed + const PDUError + const PDUReject + const PDUSegmentACK + const PDUSimpleACK + const PDUUnconfirmed + const PropLogBuffer + const PropNumberOfStates + const PropOutOfService + const PropPresentValue + const PropPulseRate + const PropRecipientList + const PropRecordCount + const PropScale + const PropStateText + const PropStatusFlags + const PropTotalRecordCount + const PropUnits + const R6AddrResNAK + const R6DeleteFDTNAK + const R6DistributeNAK + const R6OK + const R6RegisterFDNAK + const RangeAll + const RangeByPosition + const RangeBySequence + const RangeByTime + const RejectUnrecognizedService + const ResultDeleteNAK + const ResultDistributeNAK + const ResultOK + const ResultReadBDTNAK + const ResultReadFDTNAK + const ResultRegisterFDNAK + const ResultWriteBDTNAK + const SCAddrResolution + const SCConnectAccept + const SCConnectRequest + const SCConnected + const SCDirectProtocol + const SCDisconnectACK + const SCDisconnectReq + const SCDisconnectedEr + const SCFailed + const SCHeartbeatACK + const SCHeartbeatReq + const SCHubProtocol + const SCMaxBVLC + const SCMaxNPDU + const SCNotConnected + const SCOptHello + const SCOptIdentity + const SCOptProprietary + const SCOptSecurePath + const SCResult + const SegBoth + const SegNone + const SegReceive + const SegTimeout + const SegTransmit + const SeqMax + const SvcAcknowledgeAlarm + const SvcAddListElement + const SvcAtomicReadFile + const SvcAtomicWriteFile + const SvcConfirmedCOV + const SvcDeviceCommControl + const SvcGetAlarmSummary + const SvcGetEventInformation + const SvcIAm + const SvcIHave + const SvcReadProperty + const SvcReadPropertyMultiple + const SvcReadRange + const SvcReinitializeDevice + const SvcSubscribeCOV + const SvcSubscribeCOVProperty + const SvcTimeSync + const SvcUTCTimeSync + const SvcUnconfirmedCOV + const SvcWhoHas + const SvcWhoIs + const SvcWriteProperty + const SvcWritePropertyMulti + const TagCharString + const TagDate + const TagObjectID + const TagSigned + const TagTime + const TrendLog + var DCCStates = map[string]uint64 + var EventStates = []string + var HubConnectorStates = [...]string + var ReinitStates = map[string]uint64 + func AppValue(t Tag) (any, error) + func B6Addr(a *net.UDPAddr) []byte + func BDTBytes(bdt []BDTEntry) []byte + func BIPAddr(a *net.UDPAddr) []byte + func BVLC(fn byte, payload []byte) []byte + func Be16(v uint16) []byte + func BeUnsigned(d []byte) (uint64, error) + func BitContent(x BitString) []byte + func ComplexACKSegment(invokeID, service, seq, window byte, more bool, part []byte) []byte + func Confirmed(invokeID, service byte, req []byte) []byte + func ConfirmedSegment(invokeID, service, seq, window byte, more bool, part []byte) []byte + func DateTimeFrom(d, t []byte, loc *time.Location) (time.Time, error) + func DecodeAtomicReadFileAck(b []byte) (fileRead, error) + func DecodeAtomicWriteFileAck(b []byte) (int64, bool, error) + func DecodeIHave(b []byte) (iHave, error) + func DecodeReadRangeAck(b []byte, loc *time.Location) (rangeResult, error) + func DecodeResult(b []byte) scResultInfo + func DecodeWPMError(b []byte) error + func EncodeAbort(invokeID, reason byte, srv bool) []byte + func EncodeAcknowledgeAlarm(process uint32, o ObjectID, state uint32, stamp []byte, source string, ...) []byte + func EncodeAddListElement(o ObjectID, prop uint32, elements []byte) []byte + func EncodeAtomicReadFile(file ObjectID, record bool, start int64, count uint64) []byte + func EncodeAtomicWriteFile(file ObjectID, start int64, data []byte, records [][]byte) []byte + func EncodeBVLC6(m BVLC6) []byte + func EncodeCOVNotification(n COVNotification, remaining uint32) ([]byte, error) + func EncodeDCC(minutes uint16, state uint64, password string) []byte + func EncodeDestination(d Destination) []byte + func EncodeGetEventInformation(last *ObjectID) []byte + func EncodeIAm(i IAm) []byte + func EncodeLogRecord(r LogRecord, loc *time.Location) ([]byte, error) + func EncodeNPDU(fn byte, n NPDU) []byte + func EncodeReadProperty(o ObjectID, prop uint32) []byte + func EncodeReadPropertyMultiple(refs []PropRef) []byte + func EncodeReadRange(o ObjectID, prop uint32, r ReadRange) []byte + func EncodeReinitialize(state uint64, password string) []byte + func EncodeSubscribeCOVProperty(process uint32, o ObjectID, confirmed bool, lifetime uint32, prop uint32, ...) []byte + func EncodeTimeSync(t time.Time, loc *time.Location) []byte + func EncodeWhoHas(low, high *uint32, name string, id *ObjectID) []byte + func EncodeWhoIs(instance uint32) []byte + func EncodeWriteProperty(o ObjectID, prop uint32, value any, priority int) ([]byte, error) + func EncodeWritePropertyMultiple(ws []PropWrite) ([]byte, error) + func EnumName(names []string, v uint32) string + func ErrorAPDU(id, svc byte, class, code uint32) []byte + func ErrorFrom(data []byte) error + func Frame(apdu []byte, expectReply bool) []byte + func FromResult6(code uint16) uint16 + func NPDUBytes(n NPDU) []byte + func NewBBMD(bdt []BDTEntry, own int, accept bool, maxFD int) *bbmdState + func NewUUID() [16]byte + func OwnEntry(bdt []BDTEntry, local *net.UDPAddr) (int, error) + func ParseUUID(s string) ([16]byte, error) + func RawConstructed(b []byte, num byte) ([]byte, []byte, error) + func RawPropertyValue(b []byte) ([]byte, error) + func ReplyLimit(a APDU) int + func SegmentACK(invokeID, seq, window byte, nak, srv bool) []byte + func SeqAdd(s, n uint64) uint64 + func SeqNext(s uint64) uint64 + func SequenceStamp(seq uint64) []byte + func SignedBytes(v int64) []byte + func SkipConstructed(b []byte, num byte) ([]byte, error) + func StampValue(raw []byte, loc *time.Location) any + func UUIDString(u [16]byte) string + func Unframe(b []byte) ([]byte, error) + func ValuesUntilClose(b []byte, num byte) ([]any, []byte, error) + func WithPort(a string) string + type APDU struct + Attrs []SCOption + Data []byte + InvokeID byte + MaxResp int + MaxSegs int + More bool + NAK bool + Reason byte + Sa bool + Seg bool + Seq byte + Service byte + Srv bool + Typ byte + Window byte + func ParseAPDU(b []byte) (APDU, error) + type AbortPDU struct + Reason byte + func (e *AbortPDU) Error() string + type AlarmSummary struct + Acked BitString + Enable *BitString + HasEventInfo bool + Notify *uint32 + Object ObjectID + Priorities []uint64 + Stamps [][]byte + State uint32 + func DecodeGetAlarmSummaryAck(b []byte) ([]AlarmSummary, error) + func DecodeGetEventInformationAck(b []byte) ([]AlarmSummary, bool, error) + type BDTEntry struct + Addr *net.UDPAddr + Mask [4]byte + func (e BDTEntry) ForwardTo() *net.UDPAddr + func (e BDTEntry) TwoHop() bool + type BIP6 struct + BBMD *net.UDPAddr + ByAddr map[string]VMAC6 + ByVMAC map[VMAC6]*net.UDPAddr + Clash chan struct{} + Conn *net.UDPConn + Deliver func(src net.Addr, n NPDU) + Group *net.UDPAddr + Learned chan struct{} + Log *slog.Logger + Mu sync.Mutex + Random bool + Result func(from *net.UDPAddr, code uint16) + Self VMAC6 + Timeout time.Duration + func (l *BIP6) Broadcast(np []byte) error + func (l *BIP6) Claim(ctx context.Context) + func (l *BIP6) Close() + func (l *BIP6) LocalAddr() *net.UDPAddr + func (l *BIP6) LookupAddr(a *net.UDPAddr) (VMAC6, bool) + func (l *BIP6) LookupVMAC(v VMAC6) *net.UDPAddr + func (l *BIP6) MyVMAC() VMAC6 + func (l *BIP6) Register(ttl uint16) error + func (l *BIP6) Resolve(ctx context.Context, v VMAC6) (*net.UDPAddr, error) + func (l *BIP6) Serve() + func (l *BIP6) Table() map[VMAC6]*net.UDPAddr + func (l *BIP6) Unicast(a *net.UDPAddr, np []byte) error + type BVLC6 struct + Dst VMAC6 + Fn byte + NPDU []byte + Origin *net.UDPAddr + Result uint16 + Src VMAC6 + Ttl uint16 + func DecodeBVLC6(b []byte) (BVLC6, error) + type BitString struct + Bits []bool + Len int + func AllTransitions() BitString + func AllWeek() BitString + type COVNotification struct + Device ObjectID + Object ObjectID + Process uint32 + Values map[uint32][]any + func DecodeCOVNotification(b []byte) (COVNotification, error) + type Client struct + BBMD *net.UDPAddr + BBMDRole *bbmdState + Bindings map[uint32]Dest + Broadcast *net.UDPAddr + Conn *net.UDPConn + Fanout []*net.UDPAddr + IAmLog iAmLog + IP6 *BIP6 + Iams map[uint32]chan IAm + Log *slog.Logger + MaxRespCode byte + Mu sync.Mutex + OnConfirmed func(from Dest, a APDU) []byte + OnUnconfirmed func(from Dest, a APDU) + Pending map[PendingKey]chan APDU + Results chan uint16 + RouterSeen chan struct{} + Routers map[uint16]net.Addr + SC *SCNode + func NewClient(local string, log *slog.Logger) (*Client, error) + func NewClient6(s *IPv6Settings, instance *uint32, timeout time.Duration, log *slog.Logger) (*Client, error) + func NewClientSC(n *SCNode, log *slog.Logger) *Client + func (c *Client) BroadcastNPDU(n NPDU) error + func (c *Client) Close() + func (c *Client) ForeignErr() error + func (c *Client) ReadMultiple(ctx context.Context, t Target, refs []PropRef) ([]PropResult, error) + func (c *Client) ReadProperty(ctx context.Context, t Target, o ObjectID, prop uint32) ([]any, error) + func (c *Client) ReadRange(ctx context.Context, t Target, o ObjectID, prop uint32, r ReadRange) (rangeResult, error) + func (c *Client) Receive(src net.Addr, f NPDU) + func (c *Client) RegisterForeign(ctx context.Context, ttl time.Duration, timeout time.Duration, retries int) error + func (c *Client) Request(ctx context.Context, t Target, service byte, data []byte) (APDU, error) + func (c *Client) SendAPDU(to net.Addr, d Dest, expectReply bool, a []byte) error + func (c *Client) Serve() + func (c *Client) SubscribeCOV(ctx context.Context, t Target, process uint32, o ObjectID, confirmed bool, ...) error + func (c *Client) Unconfirmed(ctx context.Context, t Target, svc byte, body []byte) error + func (c *Client) WhoHas(ctx context.Context, t Target, body []byte) ([]iHave, error) + func (c *Client) WhoIs(ctx context.Context, t Target, instance uint32) (IAm, error) + func (c *Client) WriteMultiple(ctx context.Context, t Target, ws []PropWrite) error + func (c *Client) WriteProperty(ctx context.Context, t Target, o ObjectID, prop uint32, v any, prio int) error + type ContextValue struct + Data []byte + Num byte + type Dest struct + Addr net.Addr + MAC []byte + Net uint16 + func (d Dest) Describe() string + func (d Dest) Key() string + type Destination struct + Confirmed bool + Days BitString + Device *ObjectID + From [4]byte + MAC []byte + Net uint16 + Process uint32 + To [4]byte + Trans BitString + func DecodeDestinations(b []byte) ([]Destination, error) + type DirectConnect struct + AcceptURIs []string + Initiate bool + Listen string + type Enc struct + B []byte + func (e *Enc) App(v any) error + func (e *Enc) Close(num byte) + func (e *Enc) CtxBool(num byte, v bool) + func (e *Enc) CtxEnum(num byte, v uint64) + func (e *Enc) CtxObjectID(num byte, o ObjectID) + func (e *Enc) CtxString(num byte, s string) + func (e *Enc) CtxUnsigned(num byte, v uint64) + func (e *Enc) Header(num byte, context bool, n int) + func (e *Enc) Octets(b []byte) + func (e *Enc) Open(num byte) + type Enumerated uint32 + type ErrorPDU struct + Class uint32 + Code uint32 + func (e *ErrorPDU) Error() string + type EventNotification struct + ACKRequired *bool + Class uint64 + Device ObjectID + EventType uint32 + From *uint32 + Notify uint32 + Object ObjectID + Priority uint64 + Process uint32 + Stamp []byte + Text string + To uint32 + func DecodeEventNotification(b []byte) (EventNotification, error) + type IAm struct + Device ObjectID + Irregular string + MaxAPDU uint64 + Segmentation Enumerated + Vendor uint64 + func DecodeIAm(b []byte) (IAm, error) + type IPv6Settings struct + BBMD string + DeviceInstance *uint32 + Interface string + Local string + Multicast string + func (s *IPv6Settings) BBMDAddr() *net.UDPAddr + func (s *IPv6Settings) Check() error + func (s *IPv6Settings) GroupAddr() *net.UDPAddr + func (s *IPv6Settings) NetInterface() *net.Interface + func (s *IPv6Settings) SetFanout(addrs []*net.UDPAddr) + type LogRecord struct + At time.Time + Flags *BitString + Kind string + Value any + func DecodeLogRecord(b []byte, loc *time.Location) (LogRecord, []byte, error) + type NPDU struct + DADR []byte + Data []byte + Dnet uint16 + ExpectReply bool + Fn byte + Hop byte + MsgType byte + NetMsg bool + Opts []SCOption + Origin *net.UDPAddr + Result uint16 + SADR []byte + Snet uint16 + func DecodeFrame(b []byte) (NPDU, error) + func DecodeNPDU(n NPDU, b []byte) (NPDU, error) + type NodeSwitch struct + Conns map[VMAC]*dcConn + Initiate bool + Listen string + Mu sync.Mutex + N *SCNode + Reconnect time.Duration + URIs []string + func (s *NodeSwitch) AcceptURIs() []string + func (s *NodeSwitch) Connected(v VMAC) bool + type ObjectID struct + Instance uint32 + Type uint16 + func ObjectIDFrom(v uint32) ObjectID + type Peer struct + MaxAPDU int + RecvSeg bool + type Peer6 struct + UDP *net.UDPAddr + VMAC VMAC6 + func (p Peer6) Network() string + func (p Peer6) String() string + type PendingKey struct + Addr string + ID byte + type PropRef struct + Object ObjectID + Prop uint32 + type PropResult struct + Err error + Values []any + func DecodeReadPropertyAck(b []byte) (PropResult, error) + func DecodeReadPropertyMultipleAck(b []byte) ([]PropResult, error) + type PropWrite struct + Object ObjectID + Priority int + Prop uint32 + Value any + type ReadRange struct + At time.Time + Count int32 + Kind byte + Loc *time.Location + Ref uint64 + type RejectPDU struct + Reason byte + func (e *RejectPDU) Error() string + type SCConn struct + KaHeartbeats atomic.Int64 + TLS *tlsx.Conn + URI string + WS *websocket.Conn + func (c *SCConn) Read(ctx context.Context) ([]byte, error) + func (c *SCConn) Send(ctx context.Context, m SCMsg) error + type SCConnStatus struct + Connected time.Time + Disconnected time.Time + Error string + ErrorCode uint16 + State string + type SCConnect struct + MaxBVLC uint16 + MaxNPDU uint16 + UUID [16]byte + VMAC VMAC + func DecodeConnect(b []byte) (SCConnect, error) + func (c SCConnect) Bytes() []byte + type SCFailedRequest struct + Error string + ErrorCode uint16 + Peer string + Time time.Time + UUID string + VMAC string + type SCHub struct + Failed []SCFailedRequest + Forwarded atomic.Int64 + Mu sync.Mutex + UUID [16]byte + VMAC VMAC + func NewHub(log *slog.Logger, creds *SCTLS, vmac VMAC, uuid [16]byte, ...) *SCHub + func (h *SCHub) Close() + func (h *SCHub) Connections() []SCHubConn + func (h *SCHub) Listen(addr string) (net.Addr, error) + func (h *SCHub) ServeHTTP(w http.ResponseWriter, r *http.Request) + type SCHubConn struct + Connected time.Time + Peer string + State string + UUID string + VMAC string + type SCMsg struct + DestOpts []SCOption + Fn byte + ID uint16 + Payload []byte + func DecodeSC(b []byte) (SCMsg, *scNAK) + func (m SCMsg) Encode() []byte + type SCNode struct + Conn *SCConn + ConnectWait time.Duration + Creds *SCTLS + DataOpts []SCOption + Dc *NodeSwitch + DisconnectWait time.Duration + Failover string + Heartbeat time.Duration + KeyUpdate time.Duration + Log *slog.Logger + MaxReconnect time.Duration + MinReconnect time.Duration + Mu sync.Mutex + NoHello bool + OnChange func() + OnNPDU func(from VMAC, npdu []byte, dataOpts []SCOption) + Primary string + RxResult []scResultInfo + UUID [16]byte + VMAC VMAC + func (n *SCNode) Broadcast(npdu []byte) error + func (n *SCNode) Close() + func (n *SCNode) MyVMAC() VMAC + func (n *SCNode) Start(ctx context.Context) + func (n *SCNode) State() SCStatus + func (n *SCNode) Unicast(to VMAC, npdu []byte) error + type SCOption struct + Data []byte + Flag bool + HasData bool + Typ byte + type SCStatus struct + Failover *SCConnStatus + HubConnectorState string + Primary SCConnStatus + UUID string + VMAC string + type SCTLS struct + Certificate tlsx.Certificate + CheckCertificate func(use string, c *x509.Certificate) error + CheckRevocation func(ctx context.Context, leaf, issuer *x509.Certificate) error + Issuers []*x509.Certificate + Now func() time.Time + TLS13CipherSuites func() []uint16 + VerifyHostname bool + func (s *SCTLS) Config(server bool, serverName string) *tlsx.Config + func (s *SCTLS) VerifyPeer(raw [][]byte) (*x509.Certificate, error) + type Tag struct + Close bool + Context bool + Data []byte + Lvt uint32 + Num byte + Open bool + func ReadTag(b []byte) (Tag, []byte, error) + type Target struct + Retries int + Timeout time.Duration + type VMAC [6]byte + func ParseVMAC(s string) (VMAC, error) + func RandomVMAC() VMAC + func (v VMAC) Network() string + func (v VMAC) String() string + type VMAC6 [3]byte + func RandomInstanceVMAC() VMAC6 + func VMACOfInstance(i uint32) VMAC6 + func (v VMAC6) Instance() uint32 + func (v VMAC6) Network() string + func (v VMAC6) String() string + type WPMError struct + Object ObjectID + Prop uint32 + func (e *WPMError) Error() string