discovery

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package discovery finds AmpliFi units on the local network using the Ubiquiti UDP discovery protocol on port 10001.

Index

Constants

View Source
const Port = 10001

Port is the UDP port the Ubiquiti discovery service listens on.

Variables

This section is empty.

Functions

This section is empty.

Types

type Unit

type Unit struct {
	IP       netip.Addr
	MAC      amplifi.MAC
	HostName string
	Model    string
	Firmware string

	// Strings are the printable string TLVs without a named field.
	Strings []string
}

Unit is a unit that answered a discovery probe.

func Probe

func Probe(ctx context.Context, host string) (*Unit, error)

Probe sends a probe directly to host and returns its reply, giving up when ctx is done. It is a quick way to learn the name and MAC of a unit whose address is already known. Units answer from an ephemeral port rather than 10001, so any reply from host's address is accepted.

func Scan

func Scan(ctx context.Context) ([]Unit, error)

Scan broadcasts a probe and collects replies until ctx is done, returning the units sorted by IP. Give ctx a deadline; a scan without one runs until ctx is cancelled.

func (Unit) String

func (u Unit) String() string

String describes the unit on one line.

Jump to

Keyboard shortcuts

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