From 2b64e30bf72cec1ee2cb7dfe5e3e98e26d9057e4 Mon Sep 17 00:00:00 2001 From: Razvan Dimescu Date: Sun, 22 Mar 2026 11:04:54 +0200 Subject: [PATCH] show upstream DNS in stats API and dashboard footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Expose current upstream address in /stats response. Dashboard footer now shows "Upstream: x.x.x.x:53" — updates live when the network watcher swaps the upstream. Co-Authored-By: Claude Opus 4.6 (1M context) --- site/dashboard.html | 4 +++- src/api.rs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/site/dashboard.html b/site/dashboard.html index f600a0a..a0434a1 100644 --- a/site/dashboard.html +++ b/site/dashboard.html @@ -873,6 +873,7 @@ async function refresh() { document.getElementById('totalQueries').textContent = formatNumber(q.total); document.getElementById('uptime').textContent = formatUptime(stats.uptime_secs); document.getElementById('uptimeSub').textContent = formatUptimeSub(stats.uptime_secs); + document.getElementById('footerUpstream').textContent = stats.upstream || ''; document.getElementById('overrideCount').textContent = stats.overrides.active; document.getElementById('blockedCount').textContent = formatNumber(q.blocked); const bl = stats.blocking; @@ -1150,7 +1151,8 @@ setInterval(refresh, 2000);
- Logs: macOS: /usr/local/var/log/numa.log · Linux: journalctl -u numa -f + Upstream: + · Logs: macOS: /usr/local/var/log/numa.log · Linux: journalctl -u numa -f · GitHub
diff --git a/src/api.rs b/src/api.rs index 0c6bc54..b3ae490 100644 --- a/src/api.rs +++ b/src/api.rs @@ -126,6 +126,7 @@ struct QueryLogResponse { #[derive(Serialize)] struct StatsResponse { uptime_secs: u64, + upstream: String, queries: QueriesStats, cache: CacheStats, overrides: OverrideStats, @@ -435,8 +436,11 @@ async fn stats(State(ctx): State>) -> Json { let override_count = ctx.overrides.lock().unwrap().active_count(); let bl_stats = ctx.blocklist.lock().unwrap().stats(); + let upstream = ctx.upstream.lock().unwrap().to_string(); + Json(StatsResponse { uptime_secs: snap.uptime_secs, + upstream, queries: QueriesStats { total: snap.total, forwarded: snap.forwarded,