1.6 KiB
1.6 KiB
Bonjour/mDNS Discovery Checklist
Date: 2026-02-16 Status: completed
Scope
- Add optional LAN service advertisement/discovery for the Flynn gateway.
- Keep discovery disabled by default and safe for production deployments.
Completed
- Added
server.discoveryconfig schema insrc/config/schema.ts:enabled(defaultfalse)service_name(defaultflynn-gateway)service_type(default_flynn._tcp)txt(default{})
- Added gateway discovery runtime in
src/gateway/discovery.ts:- starts mDNS advertisement via
avahi-publish-service(Linux) with fallback todns-sd(macOS) - supports graceful shutdown (
SIGTERMwith fallbackSIGKILL)
- starts mDNS advertisement via
- Wired discovery into gateway lifecycle in
src/gateway/server.ts:- starts advertisement after gateway listen
- stops advertisement during shutdown
- injects non-secret TXT metadata (
instance,version) plus optional configtxt - skips advertisement when bound to loopback (
server.localhost: true)
- Wired config into gateway construction in
src/daemon/services.ts. - Updated docs:
README.mdwith Bonjour/mDNS configuration and behavior notesconfig/default.yamlwith discovery defaults and LAN safety comment
- Added tests:
src/config/schema.test.ts(discovery defaults + custom config)src/gateway/discovery.test.ts(spawn path, fallback path, hard failure path)src/gateway/server.discovery.test.ts(gateway lifecycle start/stop + loopback skip)
Tests
Verification
pnpm test:run src/config/schema.test.ts src/gateway/discovery.test.ts src/gateway/server.discovery.test.tspnpm typecheck