mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 14:45:24 +00:00
16 lines
448 B
TypeScript
16 lines
448 B
TypeScript
const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "::1"]);
|
|
|
|
export function resolveJumpTunnelEndpoint(
|
|
guacdHost: string,
|
|
tunnelHost = process.env.GUACD_TUNNEL_HOST,
|
|
): { bindHost: string; advertisedHost: string } {
|
|
if (LOOPBACK_HOSTS.has(guacdHost.toLowerCase())) {
|
|
return { bindHost: "127.0.0.1", advertisedHost: "127.0.0.1" };
|
|
}
|
|
|
|
return {
|
|
bindHost: "0.0.0.0",
|
|
advertisedHost: tunnelHost?.trim() || "termix",
|
|
};
|
|
}
|