mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-26 02:05:31 +00:00
fix(daemon): distinguish a socket main listener in Tailscale status
This commit is contained in:
@@ -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}`;
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user