From 1f7cb4b85368ac15609f36e7b8bb9615936515a1 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 20 Jan 2026 15:10:02 +0000 Subject: [PATCH] fix: shorten bonjour gateway service type --- CHANGELOG.md | 1 + apps/android/README.md | 2 +- .../android/gateway/GatewayDiscovery.kt | 2 +- apps/ios/Sources/Info.plist | 2 +- apps/ios/Tests/GatewayEndpointIDTests.swift | 6 +++--- apps/ios/project.yml | 2 +- .../WideAreaGatewayDiscovery.swift | 6 +++--- .../WideAreaGatewayDiscoveryTests.swift | 2 +- .../Sources/ClawdbotKit/BonjourTypes.swift | 2 +- docs/cli/gateway.md | 2 +- docs/gateway/bonjour.md | 18 ++++++++--------- docs/gateway/configuration.md | 2 +- docs/gateway/discovery.md | 2 +- docs/platforms/android.md | 4 ++-- src/infra/bonjour-discovery.test.ts | 20 +++++++++---------- src/infra/bonjour-discovery.ts | 18 ++++++++--------- src/infra/bonjour.test.ts | 3 ++- src/infra/bonjour.ts | 2 +- src/infra/widearea-dns.test.ts | 4 ++-- src/infra/widearea-dns.ts | 10 ++++------ 20 files changed, 55 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dddfbdccb..35bddccfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Docs: https://docs.clawd.bot - Plugins/UI: let channel plugin metadata drive UI labels/icons and cron channel options. (#1306) — thanks @steipete. - Zalouser: add channel dock metadata, config schema, setup wiring, probe, and status issues. (#1219) — thanks @suminhthanh. ### Fixes +- Discovery: shorten Bonjour DNS-SD service type to `_clawdbot-gw._tcp` and update discovery clients/docs. - Web search: infer Perplexity base URL from API key source (direct vs OpenRouter). - TUI: keep thinking blocks ordered before content during streaming and isolate per-run assembly. (#1202) — thanks @aaronveklabs. - TUI: align custom editor initialization with the latest pi-tui API. (#1298) — thanks @sibbl. diff --git a/apps/android/README.md b/apps/android/README.md index 29a8d585b..ca0967643 100644 --- a/apps/android/README.md +++ b/apps/android/README.md @@ -1,6 +1,6 @@ ## Clawdbot Node (Android) (internal) -Modern Android node app: connects to the **Gateway WebSocket** (`_clawdbot-gateway._tcp`) and exposes **Canvas + Chat + Camera**. +Modern Android node app: connects to the **Gateway WebSocket** (`_clawdbot-gw._tcp`) and exposes **Canvas + Chat + Camera**. Notes: - The node keeps the connection alive via a **foreground service** (persistent notification with a Disconnect action). diff --git a/apps/android/app/src/main/java/com/clawdbot/android/gateway/GatewayDiscovery.kt b/apps/android/app/src/main/java/com/clawdbot/android/gateway/GatewayDiscovery.kt index fb178624a..121a95485 100644 --- a/apps/android/app/src/main/java/com/clawdbot/android/gateway/GatewayDiscovery.kt +++ b/apps/android/app/src/main/java/com/clawdbot/android/gateway/GatewayDiscovery.kt @@ -51,7 +51,7 @@ class GatewayDiscovery( private val nsd = context.getSystemService(NsdManager::class.java) private val connectivity = context.getSystemService(ConnectivityManager::class.java) private val dns = DnsResolver.getInstance() - private val serviceType = "_clawdbot-gateway._tcp." + private val serviceType = "_clawdbot-gw._tcp." private val wideAreaDomain = "clawdbot.internal." private val logTag = "Clawdbot/GatewayDiscovery" diff --git a/apps/ios/Sources/Info.plist b/apps/ios/Sources/Info.plist index 72e0901d7..fbc2d085c 100644 --- a/apps/ios/Sources/Info.plist +++ b/apps/ios/Sources/Info.plist @@ -29,7 +29,7 @@ NSBonjourServices - _clawdbot-gateway._tcp + _clawdbot-gw._tcp NSCameraUsageDescription Clawdbot can capture photos or short video clips when requested via the gateway. diff --git a/apps/ios/Tests/GatewayEndpointIDTests.swift b/apps/ios/Tests/GatewayEndpointIDTests.swift index 173adf8b6..37dbba5b3 100644 --- a/apps/ios/Tests/GatewayEndpointIDTests.swift +++ b/apps/ios/Tests/GatewayEndpointIDTests.swift @@ -7,11 +7,11 @@ import Testing @Test func stableIDForServiceDecodesAndNormalizesName() { let endpoint = NWEndpoint.service( name: "Clawdbot\\032Gateway \\032 Node\n", - type: "_clawdbot-gateway._tcp", + type: "_clawdbot-gw._tcp", domain: "local.", interface: nil) - #expect(GatewayEndpointID.stableID(endpoint) == "_clawdbot-gateway._tcp|local.|Clawdbot Gateway Node") + #expect(GatewayEndpointID.stableID(endpoint) == "_clawdbot-gw._tcp|local.|Clawdbot Gateway Node") } @Test func stableIDForNonServiceUsesEndpointDescription() { @@ -22,7 +22,7 @@ import Testing @Test func prettyDescriptionDecodesBonjourEscapes() { let endpoint = NWEndpoint.service( name: "Clawdbot\\032Gateway", - type: "_clawdbot-gateway._tcp", + type: "_clawdbot-gw._tcp", domain: "local.", interface: nil) diff --git a/apps/ios/project.yml b/apps/ios/project.yml index ae00eca02..9c99d15e7 100644 --- a/apps/ios/project.yml +++ b/apps/ios/project.yml @@ -92,7 +92,7 @@ targets: NSAppTransportSecurity: NSAllowsArbitraryLoadsInWebContent: true NSBonjourServices: - - _clawdbot-gateway._tcp + - _clawdbot-gw._tcp NSCameraUsageDescription: Clawdbot can capture photos or short video clips when requested via the gateway. NSLocationWhenInUseUsageDescription: Clawdbot uses your location when you allow location sharing. NSLocationAlwaysAndWhenInUseUsageDescription: Clawdbot can share your location in the background when you enable Always. diff --git a/apps/macos/Sources/ClawdbotDiscovery/WideAreaGatewayDiscovery.swift b/apps/macos/Sources/ClawdbotDiscovery/WideAreaGatewayDiscovery.swift index b0240f05c..64d9353c2 100644 --- a/apps/macos/Sources/ClawdbotDiscovery/WideAreaGatewayDiscovery.swift +++ b/apps/macos/Sources/ClawdbotDiscovery/WideAreaGatewayDiscovery.swift @@ -52,7 +52,7 @@ enum WideAreaGatewayDiscovery { let domain = ClawdbotBonjour.wideAreaGatewayServiceDomain let domainTrimmed = domain.trimmingCharacters(in: CharacterSet(charactersIn: ".")) - let probeName = "_clawdbot-gateway._tcp.\(domainTrimmed)" + let probeName = "_clawdbot-gw._tcp.\(domainTrimmed)" guard let ptrLines = context.dig( ["+short", "+time=1", "+tries=1", "@\(nameserver)", probeName, "PTR"], min(defaultTimeoutSeconds, remaining()))?.split(whereSeparator: \.isNewline), @@ -66,7 +66,7 @@ enum WideAreaGatewayDiscovery { let ptr = raw.trimmingCharacters(in: .whitespacesAndNewlines) if ptr.isEmpty { continue } let ptrName = ptr.hasSuffix(".") ? String(ptr.dropLast()) : ptr - let suffix = "._clawdbot-gateway._tcp.\(domainTrimmed)" + let suffix = "._clawdbot-gw._tcp.\(domainTrimmed)" let rawInstanceName = ptrName.hasSuffix(suffix) ? String(ptrName.dropLast(suffix.count)) : ptrName @@ -156,7 +156,7 @@ enum WideAreaGatewayDiscovery { { let domain = ClawdbotBonjour.wideAreaGatewayServiceDomain let domainTrimmed = domain.trimmingCharacters(in: CharacterSet(charactersIn: ".")) - let probeName = "_clawdbot-gateway._tcp.\(domainTrimmed)" + let probeName = "_clawdbot-gw._tcp.\(domainTrimmed)" let ips = candidates candidates.removeAll(keepingCapacity: true) diff --git a/apps/macos/Tests/ClawdbotIPCTests/WideAreaGatewayDiscoveryTests.swift b/apps/macos/Tests/ClawdbotIPCTests/WideAreaGatewayDiscoveryTests.swift index 95f1e003c..d1dbf7962 100644 --- a/apps/macos/Tests/ClawdbotIPCTests/WideAreaGatewayDiscoveryTests.swift +++ b/apps/macos/Tests/ClawdbotIPCTests/WideAreaGatewayDiscoveryTests.swift @@ -20,7 +20,7 @@ struct WideAreaGatewayDiscoveryTests { let nameserver = args.first(where: { $0.hasPrefix("@") }) ?? "" if recordType == "PTR" { if nameserver == "@100.123.224.76" { - return "steipetacstudio-gateway._clawdbot-gateway._tcp.clawdbot.internal.\n" + return "steipetacstudio-gateway._clawdbot-gw._tcp.clawdbot.internal.\n" } return "" } diff --git a/apps/shared/ClawdbotKit/Sources/ClawdbotKit/BonjourTypes.swift b/apps/shared/ClawdbotKit/Sources/ClawdbotKit/BonjourTypes.swift index 664013830..4af6c5668 100644 --- a/apps/shared/ClawdbotKit/Sources/ClawdbotKit/BonjourTypes.swift +++ b/apps/shared/ClawdbotKit/Sources/ClawdbotKit/BonjourTypes.swift @@ -2,7 +2,7 @@ import Foundation public enum ClawdbotBonjour { // v0: internal-only, subject to rename. - public static let gatewayServiceType = "_clawdbot-gateway._tcp" + public static let gatewayServiceType = "_clawdbot-gw._tcp" public static let gatewayServiceDomain = "local." public static let wideAreaGatewayServiceDomain = "clawdbot.internal." diff --git a/docs/cli/gateway.md b/docs/cli/gateway.md index f0832452c..21538deef 100644 --- a/docs/cli/gateway.md +++ b/docs/cli/gateway.md @@ -116,7 +116,7 @@ clawdbot gateway call logs.tail --params '{"sinceMs": 60000}' ## Discover gateways (Bonjour) -`gateway discover` scans for Gateway beacons (`_clawdbot-gateway._tcp`). +`gateway discover` scans for Gateway beacons (`_clawdbot-gw._tcp`). - Multicast DNS-SD: `local.` - Unicast DNS-SD (Wide-Area Bonjour): `clawdbot.internal.` (requires split DNS + DNS server; see [/gateway/bonjour](/gateway/bonjour)) diff --git a/docs/gateway/bonjour.md b/docs/gateway/bonjour.md index 8d650ba4e..bb2c6de98 100644 --- a/docs/gateway/bonjour.md +++ b/docs/gateway/bonjour.md @@ -19,7 +19,7 @@ boundary. You can keep the same discovery UX by switching to **unicast DNS‑SD* High‑level steps: 1) Run a DNS server on the gateway host (reachable over Tailnet). -2) Publish DNS‑SD records for `_clawdbot-bridge._tcp` under a dedicated zone +2) Publish DNS‑SD records for `_clawdbot-gw._tcp` under a dedicated zone (example: `clawdbot.internal.`). 3) Configure Tailscale **split DNS** so `clawdbot.internal` resolves via that DNS server for clients (including iOS). @@ -49,8 +49,8 @@ This installs CoreDNS and configures it to: Validate from a tailnet‑connected machine: ```bash -dns-sd -B _clawdbot-bridge._tcp clawdbot.internal. -dig @ -p 53 _clawdbot-bridge._tcp.clawdbot.internal PTR +short +dns-sd -B _clawdbot-gw._tcp clawdbot.internal. +dig @ -p 53 _clawdbot-gw._tcp.clawdbot.internal PTR +short ``` ### Tailscale DNS settings @@ -61,7 +61,7 @@ In the Tailscale admin console: - Add split DNS so the domain `clawdbot.internal` uses that nameserver. Once clients accept tailnet DNS, iOS nodes can browse -`_clawdbot-bridge._tcp` in `clawdbot.internal.` without multicast. +`_clawdbot-gw._tcp` in `clawdbot.internal.` without multicast. ### Bridge listener security (recommended) @@ -74,11 +74,11 @@ For tailnet‑only setups: ## What advertises -Only the Gateway (when the **bridge is enabled**) advertises `_clawdbot-bridge._tcp`. +Only the Gateway advertises `_clawdbot-gw._tcp`. ## Service types -- `_clawdbot-bridge._tcp` — bridge transport beacon (used by macOS/iOS/Android nodes). +- `_clawdbot-gw._tcp` — gateway transport beacon (used by macOS/iOS/Android nodes). ## TXT keys (non‑secret hints) @@ -101,11 +101,11 @@ Useful built‑in tools: - Browse instances: ```bash - dns-sd -B _clawdbot-bridge._tcp local. + dns-sd -B _clawdbot-gw._tcp local. ``` - Resolve one instance (replace ``): ```bash - dns-sd -L "" _clawdbot-bridge._tcp local. + dns-sd -L "" _clawdbot-gw._tcp local. ``` If browsing works but resolving fails, you’re usually hitting a LAN policy or @@ -122,7 +122,7 @@ The Gateway writes a rolling log file (printed on startup as ## Debugging on iOS node -The iOS node uses `NWBrowser` to discover `_clawdbot-bridge._tcp`. +The iOS node uses `NWBrowser` to discover `_clawdbot-gw._tcp`. To capture logs: - Settings → Bridge → Advanced → **Discovery Debug Logs** diff --git a/docs/gateway/configuration.md b/docs/gateway/configuration.md index d5ae37426..742fd53a4 100644 --- a/docs/gateway/configuration.md +++ b/docs/gateway/configuration.md @@ -2988,7 +2988,7 @@ Auto-generated certs require `openssl` on PATH; if generation fails, the bridge ### `discovery.wideArea` (Wide-Area Bonjour / unicast DNS‑SD) -When enabled, the Gateway writes a unicast DNS-SD zone for `_clawdbot-bridge._tcp` under `~/.clawdbot/dns/` using the standard discovery domain `clawdbot.internal.` +When enabled, the Gateway writes a unicast DNS-SD zone for `_clawdbot-gw._tcp` under `~/.clawdbot/dns/` using the standard discovery domain `clawdbot.internal.` To make iOS/Android discover across networks (Vienna ⇄ London), pair this with: - a DNS server on the gateway host serving `clawdbot.internal.` (CoreDNS is recommended) diff --git a/docs/gateway/discovery.md b/docs/gateway/discovery.md index ebfc1d630..400107d2f 100644 --- a/docs/gateway/discovery.md +++ b/docs/gateway/discovery.md @@ -51,7 +51,7 @@ Troubleshooting and beacon details: [Bonjour](/gateway/bonjour). #### Service beacon details - Service types: - - `_clawdbot-bridge._tcp` (bridge transport beacon) + - `_clawdbot-gw._tcp` (gateway transport beacon) - TXT keys (non-secret): - `role=gateway` - `lanHost=.local` diff --git a/docs/platforms/android.md b/docs/platforms/android.md index 7ad4107ea..55b3589b9 100644 --- a/docs/platforms/android.md +++ b/docs/platforms/android.md @@ -52,7 +52,7 @@ For tailnet-only setups (recommended for Vienna ⇄ London), bind the gateway to From the gateway machine: ```bash -dns-sd -B _clawdbot-gateway._tcp local. +dns-sd -B _clawdbot-gw._tcp local. ``` More debugging notes: [Bonjour](/gateway/bonjour). @@ -61,7 +61,7 @@ More debugging notes: [Bonjour](/gateway/bonjour). Android NSD/mDNS discovery won’t cross networks. If your Android node and the gateway are on different networks but connected via Tailscale, use Wide-Area Bonjour / unicast DNS-SD instead: -1) Set up a DNS-SD zone (example `clawdbot.internal.`) on the gateway host and publish `_clawdbot-gateway._tcp` records. +1) Set up a DNS-SD zone (example `clawdbot.internal.`) on the gateway host and publish `_clawdbot-gw._tcp` records. 2) Configure Tailscale split DNS for `clawdbot.internal` pointing at that DNS server. Details and example CoreDNS config: [Bonjour](/gateway/bonjour). diff --git a/src/infra/bonjour-discovery.test.ts b/src/infra/bonjour-discovery.test.ts index a151729fc..f2dcf055c 100644 --- a/src/infra/bonjour-discovery.test.ts +++ b/src/infra/bonjour-discovery.test.ts @@ -17,8 +17,8 @@ describe("bonjour-discovery", () => { if (domain === "local.") { return { stdout: [ - "Add 2 3 local. _clawdbot-gateway._tcp. Peter\\226\\128\\153s Mac Studio Gateway", - "Add 2 3 local. _clawdbot-gateway._tcp. Laptop Gateway", + "Add 2 3 local. _clawdbot-gw._tcp. Peter\\226\\128\\153s Mac Studio Gateway", + "Add 2 3 local. _clawdbot-gw._tcp. Laptop Gateway", "", ].join("\n"), stderr: "", @@ -30,7 +30,7 @@ describe("bonjour-discovery", () => { if (domain === WIDE_AREA_DISCOVERY_DOMAIN) { return { stdout: [ - `Add 2 3 ${WIDE_AREA_DISCOVERY_DOMAIN} _clawdbot-gateway._tcp. Tailnet Gateway`, + `Add 2 3 ${WIDE_AREA_DISCOVERY_DOMAIN} _clawdbot-gw._tcp. Tailnet Gateway`, "", ].join("\n"), stderr: "", @@ -65,7 +65,7 @@ describe("bonjour-discovery", () => { return { stdout: [ - `${instance}._clawdbot-gateway._tcp. can be reached at ${host}:18789`, + `${instance}._clawdbot-gw._tcp. can be reached at ${host}:18789`, txtParts.join(" "), "", ].join("\n"), @@ -112,7 +112,7 @@ describe("bonjour-discovery", () => { const domain = argv[3] ?? ""; if (argv[0] === "dns-sd" && argv[1] === "-B" && domain === "local.") { return { - stdout: ["Add 2 3 local. _clawdbot-gateway._tcp. Studio Gateway", ""].join("\n"), + stdout: ["Add 2 3 local. _clawdbot-gw._tcp. Studio Gateway", ""].join("\n"), stderr: "", code: 0, signal: null, @@ -123,7 +123,7 @@ describe("bonjour-discovery", () => { if (argv[0] === "dns-sd" && argv[1] === "-L") { return { stdout: [ - "Studio Gateway._clawdbot-gateway._tcp. can be reached at studio.local:18789", + "Studio Gateway._clawdbot-gw._tcp. can be reached at studio.local:18789", "txtvers=1 displayName=Peter\\226\\128\\153s\\032Mac\\032Studio lanHost=studio.local gatewayPort=18789 sshPort=22", "", ].join("\n"), @@ -203,10 +203,10 @@ describe("bonjour-discovery", () => { if ( server === "100.123.224.76" && qtype === "PTR" && - qname === "_clawdbot-gateway._tcp.clawdbot.internal" + qname === "_clawdbot-gw._tcp.clawdbot.internal" ) { return { - stdout: `studio-gateway._clawdbot-gateway._tcp.clawdbot.internal.\n`, + stdout: `studio-gateway._clawdbot-gw._tcp.clawdbot.internal.\n`, stderr: "", code: 0, signal: null, @@ -217,7 +217,7 @@ describe("bonjour-discovery", () => { if ( server === "100.123.224.76" && qtype === "SRV" && - qname === "studio-gateway._clawdbot-gateway._tcp.clawdbot.internal" + qname === "studio-gateway._clawdbot-gw._tcp.clawdbot.internal" ) { return { stdout: `0 0 18789 studio.clawdbot.internal.\n`, @@ -231,7 +231,7 @@ describe("bonjour-discovery", () => { if ( server === "100.123.224.76" && qtype === "TXT" && - qname === "studio-gateway._clawdbot-gateway._tcp.clawdbot.internal" + qname === "studio-gateway._clawdbot-gw._tcp.clawdbot.internal" ) { return { stdout: [ diff --git a/src/infra/bonjour-discovery.ts b/src/infra/bonjour-discovery.ts index 5bd120c99..6626790d5 100644 --- a/src/infra/bonjour-discovery.ts +++ b/src/infra/bonjour-discovery.ts @@ -166,9 +166,9 @@ function parseDnsSdBrowse(stdout: string): string[] { const instances = new Set(); for (const raw of stdout.split("\n")) { const line = raw.trim(); - if (!line || !line.includes("_clawdbot-gateway._tcp")) continue; + if (!line || !line.includes("_clawdbot-gw._tcp")) continue; if (!line.includes("Add")) continue; - const match = line.match(/_clawdbot-gateway\._tcp\.?\s+(.+)$/); + const match = line.match(/_clawdbot-gw\._tcp\.?\s+(.+)$/); if (match?.[1]) { instances.add(decodeDnsSdEscapes(match[1].trim())); } @@ -225,13 +225,13 @@ async function discoverViaDnsSd( timeoutMs: number, run: typeof runCommandWithTimeout, ): Promise { - const browse = await run(["dns-sd", "-B", "_clawdbot-gateway._tcp", domain], { + const browse = await run(["dns-sd", "-B", "_clawdbot-gw._tcp", domain], { timeoutMs, }); const instances = parseDnsSdBrowse(browse.stdout); const results: GatewayBonjourBeacon[] = []; for (const instance of instances) { - const resolved = await run(["dns-sd", "-L", instance, "_clawdbot-gateway._tcp", domain], { + const resolved = await run(["dns-sd", "-L", instance, "_clawdbot-gw._tcp", domain], { timeoutMs, }); const parsed = parseDnsSdResolve(resolved.stdout, instance); @@ -268,7 +268,7 @@ async function discoverWideAreaViaTailnetDns( // Keep scans bounded: this is a fallback and should not block long. ips = ips.slice(0, 40); - const probeName = `_clawdbot-gateway._tcp.${domain.replace(/\.$/, "")}`; + const probeName = `_clawdbot-gw._tcp.${domain.replace(/\.$/, "")}`; const concurrency = 6; let nextIndex = 0; @@ -312,7 +312,7 @@ async function discoverWideAreaViaTailnetDns( if (budget <= 0) break; const ptrName = ptr.trim().replace(/\.$/, ""); if (!ptrName) continue; - const instanceName = ptrName.replace(/\.?_clawdbot-gateway\._tcp\..*$/, ""); + const instanceName = ptrName.replace(/\.?_clawdbot-gw\._tcp\..*$/, ""); const srv = await run(["dig", "+short", "+time=1", "+tries=1", nameserverArg, ptrName, "SRV"], { timeoutMs: Math.max(1, Math.min(350, budget)), @@ -371,9 +371,9 @@ function parseAvahiBrowse(stdout: string): GatewayBonjourBeacon[] { for (const raw of stdout.split("\n")) { const line = raw.trimEnd(); if (!line) continue; - if (line.startsWith("=") && line.includes("_clawdbot-gateway._tcp")) { + if (line.startsWith("=") && line.includes("_clawdbot-gw._tcp")) { if (current) results.push(current); - const marker = " _clawdbot-gateway._tcp"; + const marker = " _clawdbot-gw._tcp"; const idx = line.indexOf(marker); const left = idx >= 0 ? line.slice(0, idx).trim() : line; const parts = left.split(/\s+/); @@ -429,7 +429,7 @@ async function discoverViaAvahi( timeoutMs: number, run: typeof runCommandWithTimeout, ): Promise { - const args = ["avahi-browse", "-rt", "_clawdbot-gateway._tcp"]; + const args = ["avahi-browse", "-rt", "_clawdbot-gw._tcp"]; if (domain && domain !== "local.") { // avahi-browse wants a plain domain (no trailing dot) args.push("-d", domain.replace(/\.$/, "")); diff --git a/src/infra/bonjour.test.ts b/src/infra/bonjour.test.ts index e3c35ab99..6e0a8d167 100644 --- a/src/infra/bonjour.test.ts +++ b/src/infra/bonjour.test.ts @@ -116,7 +116,8 @@ describe("gateway bonjour advertiser", () => { expect(createService).toHaveBeenCalledTimes(1); const [gatewayCall] = createService.mock.calls as Array<[Record]>; - expect(gatewayCall?.[0]?.type).toBe("clawdbot-gateway"); + expect(gatewayCall?.[0]?.type).toBe("clawdbot-gw"); + expect(String(gatewayCall?.[0]?.type ?? "").length).toBeLessThanOrEqual(15); expect(gatewayCall?.[0]?.port).toBe(18789); expect(gatewayCall?.[0]?.domain).toBe("local"); expect(gatewayCall?.[0]?.hostname).toBe("test-host"); diff --git a/src/infra/bonjour.ts b/src/infra/bonjour.ts index dd50ab3c5..302717116 100644 --- a/src/infra/bonjour.ts +++ b/src/infra/bonjour.ts @@ -123,7 +123,7 @@ export async function startGatewayBonjourAdvertiser( const gateway = responder.createService({ name: safeServiceName(instanceName), - type: "clawdbot-gateway", + type: "clawdbot-gw", protocol: Protocol.TCP, port: opts.gatewayPort, domain: "local", diff --git a/src/infra/widearea-dns.test.ts b/src/infra/widearea-dns.test.ts index f9e170db5..4f1dbf43d 100644 --- a/src/infra/widearea-dns.test.ts +++ b/src/infra/widearea-dns.test.ts @@ -19,8 +19,8 @@ describe("wide-area DNS-SD zone rendering", () => { expect(txt).toContain(`$ORIGIN ${WIDE_AREA_DISCOVERY_DOMAIN}`); expect(txt).toContain(`studio-london IN A 100.123.224.76`); expect(txt).toContain(`studio-london IN AAAA fd7a:115c:a1e0::8801:e04c`); - expect(txt).toContain(`_clawdbot-gateway._tcp IN PTR studio-london._clawdbot-gateway._tcp`); - expect(txt).toContain(`studio-london._clawdbot-gateway._tcp IN SRV 0 0 18789 studio-london`); + expect(txt).toContain(`_clawdbot-gw._tcp IN PTR studio-london._clawdbot-gw._tcp`); + expect(txt).toContain(`studio-london._clawdbot-gw._tcp IN SRV 0 0 18789 studio-london`); expect(txt).toContain(`displayName=Mac Studio (Clawdbot)`); expect(txt).toContain(`gatewayPort=18789`); expect(txt).toContain(`sshPort=22`); diff --git a/src/infra/widearea-dns.ts b/src/infra/widearea-dns.ts index 231578b4c..5426bdb5c 100644 --- a/src/infra/widearea-dns.ts +++ b/src/infra/widearea-dns.ts @@ -82,7 +82,7 @@ export type WideAreaGatewayZoneOpts = { function renderZone(opts: WideAreaGatewayZoneOpts & { serial: number }): string { const hostname = os.hostname().split(".")[0] ?? "clawdbot"; const hostLabel = dnsLabel(opts.hostLabel ?? hostname, "clawdbot"); - const instanceLabel = dnsLabel(opts.instanceLabel ?? `${hostname}-gateway`, "clawdbot-gateway"); + const instanceLabel = dnsLabel(opts.instanceLabel ?? `${hostname}-gateway`, "clawdbot-gw"); const txt = [ `displayName=${opts.displayName.trim() || hostname}`, @@ -119,11 +119,9 @@ function renderZone(opts: WideAreaGatewayZoneOpts & { serial: number }): string records.push(`${hostLabel} IN AAAA ${opts.tailnetIPv6}`); } - records.push(`_clawdbot-gateway._tcp IN PTR ${instanceLabel}._clawdbot-gateway._tcp`); - records.push( - `${instanceLabel}._clawdbot-gateway._tcp IN SRV 0 0 ${opts.gatewayPort} ${hostLabel}`, - ); - records.push(`${instanceLabel}._clawdbot-gateway._tcp IN TXT ${txt.map(txtQuote).join(" ")}`); + records.push(`_clawdbot-gw._tcp IN PTR ${instanceLabel}._clawdbot-gw._tcp`); + records.push(`${instanceLabel}._clawdbot-gw._tcp IN SRV 0 0 ${opts.gatewayPort} ${hostLabel}`); + records.push(`${instanceLabel}._clawdbot-gw._tcp IN TXT ${txt.map(txtQuote).join(" ")}`); const contentBody = `${records.join("\n")}\n`; const hashBody = `${records