fix(daemon): distinguish a socket main listener in Tailscale status

This commit is contained in:
Mohamed Boudra
2026-11-25 14:53:06 +01:00
parent 2c639b0be0
commit 8ce42b4da7
3 changed files with 28 additions and 1 deletions
+2
View File
@@ -5591,6 +5591,8 @@ const TailscaleStatusSchema = z.object({
address: z.string().nullable(),
state: z.enum(["unavailable", "off", "waiting", "on"]),
lockedBy: z.enum(["main", "launch"]).optional(),
// COMPAT(tailscale): keep lockedBy "main" for older clients when the main listener is a socket.
mainIsSocket: z.literal(true).optional(),
// Whether turning off Tailscale would disconnect the source of this request.
disconnectsCurrentConnection: z.boolean().optional(),
});
@@ -80,6 +80,25 @@ test.each(["100.101.102.103", "0.0.0.0"])(
},
);
test.each([
{ type: "socket", path: "/tmp/paseo.sock" },
{ type: "pipe", path: String.raw`\\.\pipe\paseo` },
] as const)("reports a $type main listener separately from TCP", (main) => {
const listeners = createDaemonListeners({
http: createServer(),
listen: main.path,
overridden: false,
getMain: () => main,
getTailscaleAddress: () => "100.101.102.103",
});
expect(listeners.status().tailscale).toMatchObject({
state: "off",
address: null,
lockedBy: "main",
mainIsSocket: true,
});
});
test("shows the saved Tailscale listener waiting when the host has no Tailscale interface yet", async () => {
const address = "100.127.255.254:6767";
const listen = `127.0.0.1:6767,${address}`;
+7 -1
View File
@@ -212,7 +212,13 @@ export function createDaemonListeners(options: {
return {
main,
configured,
tailscale: { ip, address, state, ...(lockedBy ? { lockedBy } : {}) },
tailscale: {
ip,
address,
state,
...(lockedBy ? { lockedBy } : {}),
...(main && main.type !== "tcp" ? { mainIsSocket: true as const } : {}),
},
extraListeners,
};
}