Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
Broadcaster sends identity packets over UDP to advertise the local device.
func NewBroadcaster ¶
func NewBroadcaster(identity *protocol.Packet, interval time.Duration, logger *zap.Logger) *Broadcaster
NewBroadcaster creates a UDP discovery broadcaster.
func (*Broadcaster) Run ¶
func (b *Broadcaster) Run(ctx context.Context, shouldReduce func() bool)
Run periodically sends the identity packet to 255.255.255.255:1716. If shouldReduce is provided and returns true, the broadcast frequency is reduced to 60 seconds to save CPU and network resources while idle.
type BroadcasterController ¶ added in v1.10.0
type BroadcasterController struct {
// contains filtered or unexported fields
}
BroadcasterController manages the broadcast lifecycle — start/stop on demand. Starts in stopped state. Broadcast is only active while Start() is in effect.
func NewBroadcasterController ¶ added in v1.10.0
func NewBroadcasterController(identity *protocol.Packet, interval time.Duration, logger *zap.Logger, shouldReduce func() bool) *BroadcasterController
NewBroadcasterController creates a controller that starts in stopped state.
func (*BroadcasterController) IsRunning ¶ added in v1.10.0
func (bc *BroadcasterController) IsRunning() bool
IsRunning reports whether the broadcast loop is currently active.
func (*BroadcasterController) Start ¶ added in v1.10.0
func (bc *BroadcasterController) Start(parentCtx context.Context)
Start launches the UDP broadcaster loop in a background goroutine using a child of parentCtx. No-op if already running.
func (*BroadcasterController) Stop ¶ added in v1.10.0
func (bc *BroadcasterController) Stop()
Stop cancels the broadcast loop. No-op if not running.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener listens for UDP identity packets from other devices.