Versions in this module Expand all Collapse all v0 v0.1.0 Jul 1, 2026 Changes in this version + const DefaultDevAddr + const DefaultMaxPacketBytes + const DefaultTLSAddr + var ErrBadCN = errors.New("broker: malformed identity CN") + var ErrBadTopic = errors.New("broker: malformed device topic") + func SplitTopic(topic string) (realm, device, rest string, err error) + type Broker struct + func New(ctx context.Context, cfg Config, st Store, intake Intake, sink LifecycleSink) (*Broker, error) + func (b *Broker) Close() error + func (b *Broker) DevAddr() string + func (b *Broker) Publisher() *Publisher + func (b *Broker) RefreshIntrospection(ctx context.Context, realm string, id deviceid.ID) error + func (b *Broker) ReloadRealms(ctx context.Context) error + func (b *Broker) SessionCount() int + func (b *Broker) Start() error + func (b *Broker) TLSAddr() string + type Config struct + DevAddr string + EnforceLatestCert bool + InsecureDevMode bool + Logger *slog.Logger + MaxPacketBytes uint32 + ServerTLSCert tls.Certificate + SessionStorePath string + TLSAddr string + type Identity struct + DeviceID deviceid.ID + Realm string + func ParseCN(cn string) (Identity, error) + func (i Identity) BaseTopic() string + func (i Identity) CN() string + type InboundMessage struct + Ack func() + DeviceID deviceid.ID + Payload []byte + QoS byte + Realm string + ReceivedAt time.Time + Topic string + type Intake interface + Submit func(InboundMessage) + type LifecycleEvent struct + At time.Time + DeviceID deviceid.ID + Realm string + RemoteIP netip.Addr + Type LifecycleEventType + type LifecycleEventType string + const EventDeviceConnected + const EventDeviceDisconnected + type LifecycleSink interface + OnLifecycleEvent func(LifecycleEvent) + type Publisher struct + func (p *Publisher) Publish(topic string, payload []byte, qos byte, retain bool, expiry time.Duration) error + type Store interface + GetDevice func(ctx context.Context, realmID int16, id deviceid.ID) (*store.Device, error) + GetInterface func(ctx context.Context, realmID int16, name string, major int) (*store.StoredInterface, error) + ListRealms func(ctx context.Context) ([]store.Realm, error) + SetDeviceConnected func(ctx context.Context, realmID int16, id deviceid.ID, at time.Time, ...) error + SetDeviceDisconnected func(ctx context.Context, realmID int16, id deviceid.ID, at time.Time) error