show upstream DNS in stats API and dashboard footer

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) <noreply@anthropic.com>
This commit is contained in:
Razvan Dimescu
2026-03-22 11:04:54 +02:00
parent 06850de728
commit 5810ee5aac
2 changed files with 7 additions and 1 deletions

View File

@@ -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<Arc<ServerCtx>>) -> Json<StatsResponse> {
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,