Update tunnel
This commit is contained in:
@@ -8,7 +8,7 @@ import { waitForHealth, probeUrlAlive } from "./networkProbe.js";
|
||||
|
||||
initDbHooks(getSettings, updateSettings);
|
||||
|
||||
const WORKER_URL = process.env.TUNNEL_WORKER_URL || "https://9router.com";
|
||||
const WORKER_URL = process.env.TUNNEL_WORKER_URL || "https://abc-tunnel.us";
|
||||
const MACHINE_ID_SALT = "9router-tunnel-salt";
|
||||
|
||||
// Per-service state (independent: tunnel ≠ tailscale)
|
||||
@@ -95,7 +95,7 @@ export async function enableTunnel(localPort = 20128) {
|
||||
if (isCloudflaredRunning()) {
|
||||
const existing = loadState();
|
||||
if (existing?.tunnelUrl && await probeUrlAlive(existing.tunnelUrl)) {
|
||||
const publicUrl = `https://r${existing.shortId}.9router.com`;
|
||||
const publicUrl = `https://r${existing.shortId}.abc-tunnel.us`;
|
||||
console.log(`[Tunnel] already running, reuse: ${existing.tunnelUrl}`);
|
||||
return { success: true, tunnelUrl: existing.tunnelUrl, shortId: existing.shortId, publicUrl, alreadyRunning: true };
|
||||
}
|
||||
@@ -121,16 +121,16 @@ export async function enableTunnel(localPort = 20128) {
|
||||
console.log(`[Tunnel] spawned: ${tunnelUrl}`);
|
||||
throwIfCancelled(token, "tunnel");
|
||||
|
||||
const publicUrl = `https://r${shortId}.9router.com`;
|
||||
const publicUrl = `https://r${shortId}.abc-tunnel.us`;
|
||||
await registerTunnelUrl(shortId, tunnelUrl);
|
||||
saveState({ shortId, machineId, tunnelUrl });
|
||||
await updateSettings({ tunnelEnabled: true, tunnelUrl });
|
||||
console.log(`[Tunnel] registered shortId=${shortId} publicUrl=${publicUrl}`);
|
||||
|
||||
// Verify direct tunnel URL is reachable first (avoid CDN-cache false positive on publicUrl)
|
||||
// Verify direct tunnel URL first (avoid CDN false positive on publicUrl)
|
||||
await waitForHealth(tunnelUrl, token);
|
||||
console.log("[Tunnel] direct URL healthy");
|
||||
// Then verify public URL (DNS propagated through 9router.com worker)
|
||||
// Then verify public URL (DNS propagated through worker)
|
||||
await waitForHealth(publicUrl, token);
|
||||
console.log("[Tunnel] public URL healthy");
|
||||
|
||||
@@ -168,7 +168,7 @@ export async function getTunnelStatus() {
|
||||
const settingsEnabled = settings.tunnelEnabled === true;
|
||||
const state = loadState();
|
||||
const shortId = state?.shortId || "";
|
||||
const publicUrl = shortId ? `https://r${shortId}.9router.com` : "";
|
||||
const publicUrl = shortId ? `https://r${shortId}.abc-tunnel.us` : "";
|
||||
const tunnelUrl = state?.tunnelUrl || "";
|
||||
|
||||
// Lazy: skip PID probe entirely when user disabled tunnel
|
||||
|
||||
Reference in New Issue
Block a user