// The single source for tunnel/preview hostnames and scheme, shared by the CLI, platform API, daemon and browser; pure // string builders, no node imports, so the browser can derive identical names. All four must agree, or a divergence // resolves to a negative-cached NXDOMAIN. // The sandbox daemon's subdomain + hostname: `sandbox-` / `sandbox-.`. const SANDBOX_PREFIX = "sandbox-"; export const sandboxSubdomain = (id: string): string => `${SANDBOX_PREFIX}${id}`; export const sandboxHostname = (id: string, zone: string): string => `${sandboxSubdomain(id)}.${zone}`; // The container sshd hostname the desktop-sync (Mutagen) reaches over the sandbox tunnel: `ssh-.`. export const sshHostname = (id: string, zone: string): string => `ssh-${id}.${zone}`; // A public HTTPS name for 127.0.0.1, needed since Safari refuses http from an https page. One label deeper than other // names, so a single `*.local.` wildcard covers every sandbox rather than needing a record each. export const localHostname = (id: string, zone: string): string => `${id}.${LOCAL_LABEL}.${zone}`; // The label the loopback names live under, so the wildcard has something to be a wildcard OF. export const LOCAL_LABEL = "local"; // The single record that answers for all of them. Never per-sandbox, never reaped. export const localWildcardHostname = (zone: string): string => `*.${LOCAL_LABEL}.${zone}`; // What that record points at, and the reason it is safe to publish: every resolver on earth gets 127.0.0.1. export const LOCAL_ADDRESS = "127.0.0.1"; // A per-host SSH tunnel's Cloudflare tunnel name; its hostname reuses sshHostname with the host-ssh id. export const hostSshTunnelName = (id: string): string => `host-ssh-${id}`; // The proxied-CNAME target every tunnel points its DNS record at. export const cfargotunnelCname = (tunnelId: string): string => `${tunnelId}.cfargotunnel.com`; // The cloudflared ingress catch-all; must be the last rule. export const CATCH_ALL = { service: "http_status:404" } as const; // Three schemes share one shape, `