Skip to content

Commit 9d54008

Browse files
committed
fix: exclude Tailscale CGNAT addresses from LAN endpoint selection
Tailscale IPs (100.64.0.0/10) were not excluded by isUsableLanIpv4Address, so when a Tailscale interface was enumerated before a real LAN interface, resolveLanAdvertisedHost would select the Tailscale IP as the LAN endpoint. This caused duplicate entries in getDesktopAdvertisedEndpoints (one as 'Local network' from core, one as 'Tailscale IP' from the addon) and the actual LAN IP would be missing entirely. Add isTailscaleIpv4Address check to isUsableLanIpv4Address to prevent Tailscale CGNAT addresses from being selected as LAN endpoints.
1 parent ddb27a7 commit 9d54008

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/desktop/src/serverExposure.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {
88
AdvertisedEndpointProvider,
99
DesktopServerExposureMode,
1010
} from "@t3tools/contracts";
11+
import { isTailscaleIpv4Address } from "./tailscaleEndpointProvider.ts";
1112

1213
const DESKTOP_LOOPBACK_HOST = "127.0.0.1";
1314
const DESKTOP_LAN_BIND_HOST = "0.0.0.0";
@@ -47,7 +48,9 @@ const normalizeOptionalHost = (value: string | undefined): string | undefined =>
4748
};
4849

4950
const isUsableLanIpv4Address = (address: string): boolean =>
50-
!address.startsWith("127.") && !address.startsWith("169.254.");
51+
!address.startsWith("127.") &&
52+
!address.startsWith("169.254.") &&
53+
!isTailscaleIpv4Address(address);
5154

5255
export function resolveLanAdvertisedHost(
5356
networkInterfaces: NodeJS.Dict<NetworkInterfaceInfo[]>,

0 commit comments

Comments
 (0)