discovery

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 9 Imported by: 0

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 Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener listens for UDP identity packets from other devices.

func NewListener

func NewListener(port int, localDeviceID string, callback func(ip net.IP, tcpPort int, identity *protocol.Packet), logger *zap.Logger) *Listener

NewListener creates a UDP discovery listener.

func (*Listener) Run

func (l *Listener) Run(ctx context.Context)

Run starts the UDP listener loop to parse incoming discovery broadcasts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL