mdns

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mdns wraps github.com/hashicorp/mdns to advertise and discover Omaclip instances on the local network.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDiscoverableIPs = fmt.Errorf("mdns: no discoverable IPs, skipping registering to the network")

Functions

This section is empty.

Types

type Discoverer

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

Discoverer registers this instance via mDNS and continuously browses for peers.

func New

func New(log *slog.Logger, browsePeriod time.Duration, hostname string, ps *passphrase.Store) *Discoverer

New creates a Discoverer. Call Register then Start to begin advertising and browsing.

func (*Discoverer) Peers

func (d *Discoverer) Peers() []Peer

Peers returns a snapshot of currently known peers.

func (*Discoverer) Register

func (d *Discoverer) Register(port int) error

Register advertises this Omaclip instance at the given port via mDNS.

func (*Discoverer) Shutdown

func (d *Discoverer) Shutdown()

Shutdown tears down the mDNS server.

func (*Discoverer) Start

func (d *Discoverer) Start(ctx context.Context)

Start begins the periodic browse loop until ctx is cancelled.

type Peer

type Peer struct {
	Name string `json:"name"`
	Addr string `json:"addr"`
	Port int    `json:"port"`
}

Peer describes a discovered remote Omaclip instance.

Jump to

Keyboard shortcuts

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