feat: transport protocol tracking (UDP/TCP/DoT/DoH) with dashboard visualization

Thread Transport enum through resolve pipeline, record per-query
transport in stats and query log. Dashboard gets bar chart panel
with encryption %, transport column in query log, and filter dropdown.
This commit is contained in:
Razvan Dimescu
2026-04-12 22:14:26 +03:00
parent 8085c10687
commit 2101dfcf17
8 changed files with 156 additions and 24 deletions

View File

@@ -152,6 +152,7 @@ struct QueryLogResponse {
domain: String,
query_type: String,
path: String,
transport: String,
rescode: String,
latency_ms: f64,
dnssec: String,
@@ -167,6 +168,7 @@ struct StatsResponse {
dnssec: bool,
srtt: bool,
queries: QueriesStats,
transport: TransportStats,
cache: CacheStats,
overrides: OverrideStats,
blocking: BlockingStatsResponse,
@@ -175,6 +177,14 @@ struct StatsResponse {
memory: MemoryStats,
}
#[derive(Serialize)]
struct TransportStats {
udp: u64,
tcp: u64,
dot: u64,
doh: u64,
}
#[derive(Serialize)]
struct MobileStatsResponse {
enabled: bool,
@@ -483,6 +493,7 @@ async fn query_log(
domain: e.domain.clone(),
query_type: e.query_type.as_str().to_string(),
path: e.path.as_str().to_string(),
transport: e.transport.as_str().to_string(),
rescode: e.rescode.as_str().to_string(),
latency_ms: e.latency_us as f64 / 1000.0,
dnssec: e.dnssec.as_str().to_string(),
@@ -545,6 +556,12 @@ async fn stats(State(ctx): State<Arc<ServerCtx>>) -> Json<StatsResponse> {
blocked: snap.blocked,
errors: snap.errors,
},
transport: TransportStats {
udp: snap.transport_udp,
tcp: snap.transport_tcp,
dot: snap.transport_dot,
doh: snap.transport_doh,
},
cache: CacheStats {
entries: cache_len,
max_entries: cache_max,