feat(server): add --mdns-domain flag to customize mDNS hostname (#11796)

This commit is contained in:
Luiz Guilherme D'Abruzzo Pereira
2026-02-02 17:52:32 -03:00
committed by GitHub
parent 824165eb79
commit a9fca05d8b
5 changed files with 21 additions and 6 deletions

View File

@@ -7,17 +7,18 @@ export namespace MDNS {
let bonjour: Bonjour | undefined
let currentPort: number | undefined
export function publish(port: number) {
export function publish(port: number, domain?: string) {
if (currentPort === port) return
if (bonjour) unpublish()
try {
const host = domain ?? "opencode.local"
const name = `opencode-${port}`
bonjour = new Bonjour()
const service = bonjour.publish({
name,
type: "http",
host: "opencode.local",
host,
port,
txt: { path: "/" },
})