fix: include tailnetDns in wide-area beacons

This commit is contained in:
Peter Steinberger
2025-12-20 15:02:23 +01:00
parent 554d9bc6ce
commit 044f525eb8
5 changed files with 23 additions and 1 deletions

View File

@@ -2096,6 +2096,7 @@ export async function startGatewayServer(
displayName: formatBonjourInstanceName(machineDisplayName),
tailnetIPv4,
tailnetIPv6: tailnetIPv6 ?? undefined,
tailnetDns,
});
defaultRuntime.log(
`discovery: wide-area DNS-SD ${result.changed ? "updated" : "unchanged"} (${WIDE_AREA_DISCOVERY_DOMAIN}${result.zonePath})`,

View File

@@ -28,4 +28,20 @@ describe("wide-area DNS-SD zone rendering", () => {
);
expect(txt).toContain(`displayName=Mac Studio (Clawdis)`);
});
it("includes tailnetDns when provided", () => {
const txt = renderWideAreaBridgeZoneText({
serial: 2025121701,
bridgePort: 18790,
displayName: "Mac Studio (Clawdis)",
tailnetIPv4: "100.123.224.76",
tailnetDns: "peters-mac-studio-1.sheep-coho.ts.net",
hostLabel: "studio-london",
instanceLabel: "studio-london",
});
expect(txt).toContain(
`tailnetDns=peters-mac-studio-1.sheep-coho.ts.net`,
);
});
});

View File

@@ -75,6 +75,7 @@ export type WideAreaBridgeZoneOpts = {
tailnetIPv6?: string;
instanceLabel?: string;
hostLabel?: string;
tailnetDns?: string;
};
function renderZone(opts: WideAreaBridgeZoneOpts & { serial: number }): string {
@@ -90,6 +91,9 @@ function renderZone(opts: WideAreaBridgeZoneOpts & { serial: number }): string {
`transport=bridge`,
`bridgePort=${opts.bridgePort}`,
];
if (opts.tailnetDns?.trim()) {
txt.push(`tailnetDns=${opts.tailnetDns.trim()}`);
}
const records: string[] = [];