Update tunnel
This commit is contained in:
parent
e1db49190a
commit
cc971f2402
7 changed files with 22 additions and 20 deletions
|
|
@ -1,3 +1,8 @@
|
|||
# v0.4.46 (2026-05-15)
|
||||
|
||||
## Breaking Changes
|
||||
- Tunnel public URL changed — old tunnel links no longer work, please reconnect to get the new URL
|
||||
|
||||
# v0.4.44 (2026-05-15)
|
||||
|
||||
## Features
|
||||
|
|
|
|||
|
|
@ -1299,7 +1299,7 @@ Thanks to all contributors who helped make 9Router better!
|
|||
|
||||
Built on the shoulders of giants:
|
||||
|
||||
- **CLIProxyAPI** — original Go implementation that inspired this JavaScript port.
|
||||
- **CLIProxyAPI(https://github.com/router-for-me/CLIProxyAPI)** — original Go implementation that inspired this JavaScript port.
|
||||
- **[RTK](https://github.com/rtk-ai/rtk)**  — Rust token-saver. 9Router ports its compression pipeline to JS → **−20-40% input tokens** on every request.
|
||||
- **[Caveman](https://github.com/JuliusBrussee/caveman)**  by **[@JuliusBrussee](https://github.com/JuliusBrussee)** — viral *"why use many token when few token do trick"*. 9Router adapts its prompt → **−65% output tokens**.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "9router",
|
||||
"version": "0.4.45",
|
||||
"version": "0.4.46",
|
||||
"description": "9Router CLI - Start and manage 9Router server",
|
||||
"bin": {
|
||||
"9router": "./cli.js"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "9router-app",
|
||||
"version": "0.4.45",
|
||||
"version": "0.4.46",
|
||||
"description": "9Router web dashboard",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ export default function APIPageClient({ machineId }) {
|
|||
// "reachable" even when backend DNS (1.1.1.1) hiccups on *.ts.net or *.trycloudflare.com.
|
||||
useEffect(() => {
|
||||
const probeBoth = async () => {
|
||||
if (tunnelEnabled && (tunnelPublicUrl || tunnelUrl)) {
|
||||
const ok = await clientPingUrl(tunnelPublicUrl || tunnelUrl);
|
||||
if (tunnelEnabled && tunnelUrl) {
|
||||
const ok = await clientPingUrl(tunnelUrl);
|
||||
tunnelClientReachableRef.current = ok;
|
||||
if (ok) { tunnelMissRef.current = 0; setTunnelReachable(true); if (!tunnelEverReachableRef.current) { tunnelEverReachableRef.current = true; setTunnelEverReachable(true); } }
|
||||
} else {
|
||||
|
|
@ -143,7 +143,7 @@ export default function APIPageClient({ machineId }) {
|
|||
probeBoth();
|
||||
const id = setInterval(probeBoth, CLIENT_PING_INTERVAL_MS);
|
||||
return () => clearInterval(id);
|
||||
}, [tunnelEnabled, tunnelPublicUrl, tunnelUrl, tsEnabled, tsUrl]);
|
||||
}, [tunnelEnabled, tunnelUrl, tsEnabled, tsUrl]);
|
||||
|
||||
// Effective reachable = serverReachable OR clientReachable (1 of 2 is enough).
|
||||
// Miss-debounce: only flip to false after N consecutive misses on BOTH sides.
|
||||
|
|
@ -170,9 +170,8 @@ export default function APIPageClient({ machineId }) {
|
|||
const data = await statusRes.json();
|
||||
const tEnabled = data.tunnel?.settingsEnabled ?? data.tunnel?.enabled ?? false;
|
||||
const tUrl = data.tunnel?.tunnelUrl || "";
|
||||
const tPublicUrl = data.tunnel?.publicUrl || "";
|
||||
setTunnelUrl(tUrl);
|
||||
setTunnelPublicUrl(tPublicUrl);
|
||||
setTunnelPublicUrl(data.tunnel?.publicUrl || "");
|
||||
setTunnelEnabled(tEnabled);
|
||||
updateReachable(!!data.tunnel?.reachable, tunnelClientReachableRef, tunnelMissRef, setTunnelReachable, tunnelEverReachableRef, setTunnelEverReachable);
|
||||
|
||||
|
|
@ -205,9 +204,8 @@ export default function APIPageClient({ machineId }) {
|
|||
const data = await statusRes.json();
|
||||
const tEnabled = data.tunnel?.settingsEnabled ?? data.tunnel?.enabled ?? false;
|
||||
const tUrl = data.tunnel?.tunnelUrl || "";
|
||||
const tPublicUrl = data.tunnel?.publicUrl || "";
|
||||
setTunnelUrl(tUrl);
|
||||
setTunnelPublicUrl(tPublicUrl);
|
||||
setTunnelPublicUrl(data.tunnel?.publicUrl || "");
|
||||
setTunnelEnabled(tEnabled);
|
||||
updateReachable(!!data.tunnel?.reachable, tunnelClientReachableRef, tunnelMissRef, setTunnelReachable, tunnelEverReachableRef, setTunnelEverReachable);
|
||||
|
||||
|
|
@ -374,13 +372,13 @@ export default function APIPageClient({ machineId }) {
|
|||
return;
|
||||
}
|
||||
|
||||
const url = data.publicUrl || data.tunnelUrl;
|
||||
const url = data.tunnelUrl;
|
||||
if (!url) {
|
||||
setTunnelStatus({ type: "error", message: "No tunnel URL returned" });
|
||||
return;
|
||||
}
|
||||
|
||||
setTunnelUrl(data.tunnelUrl || "");
|
||||
setTunnelUrl(url);
|
||||
setTunnelPublicUrl(data.publicUrl || "");
|
||||
await pingTunnelHealth(url);
|
||||
} catch (error) {
|
||||
|
|
@ -401,7 +399,6 @@ export default function APIPageClient({ machineId }) {
|
|||
if (res.ok) {
|
||||
setTunnelEnabled(false);
|
||||
setTunnelUrl("");
|
||||
setTunnelPublicUrl("");
|
||||
setShowDisableTunnelModal(false);
|
||||
setTunnelStatus({ type: "success", message: "Tunnel disabled" });
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ async function safeRestartTunnel(reason) {
|
|||
// Alive check: process up + URL responds → skip
|
||||
if (isCloudflaredRunning()) {
|
||||
const state = loadState();
|
||||
const publicUrl = state?.shortId ? `https://r${state.shortId}.9router.com` : null;
|
||||
const publicUrl = state?.shortId ? `https://r${state.shortId}.abc-tunnel.us` : null;
|
||||
if (publicUrl && await probeUrlAlive(publicUrl)) return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue