feat(client): include gateway presence in diagnostics
PLAN.md calls for user-facing diagnostics that can say whether the remote client is connected to the LAN gateway. Startup already reported the initial welcome bit, but periodic diagnostics only carried relay reachability and route pinning. Add gateway_connected to RelayDiagnostics and seed the client status from the welcome. The client control-event logger now updates that status when gateway join and leave events arrive, so later diagnostics reflect relay lifecycle changes while the tunnel is running. Test Plan: - cargo fmt --check - cargo test -p lanparty-obs -p lanparty-client-win - cargo test --workspace - cargo clippy --workspace --all-targets -- -D warnings - git diff --check Refs: PLAN.md
This commit is contained in:
@@ -196,14 +196,16 @@ impl TunnelStats {
|
||||
pub struct RelayDiagnostics {
|
||||
reachable: bool,
|
||||
route_pinned: bool,
|
||||
gateway_connected: bool,
|
||||
}
|
||||
|
||||
impl RelayDiagnostics {
|
||||
#[must_use]
|
||||
pub const fn new(reachable: bool, route_pinned: bool) -> Self {
|
||||
pub const fn new(reachable: bool, route_pinned: bool, gateway_connected: bool) -> Self {
|
||||
Self {
|
||||
reachable,
|
||||
route_pinned,
|
||||
gateway_connected,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +218,11 @@ impl RelayDiagnostics {
|
||||
pub const fn route_pinned(&self) -> bool {
|
||||
self.route_pinned
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub const fn gateway_connected(&self) -> bool {
|
||||
self.gateway_connected
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
|
||||
@@ -428,7 +435,7 @@ mod tests {
|
||||
let mac = MacAddr::new([0x02, 1, 2, 3, 4, 5]);
|
||||
let stats = TunnelStats::new(1, 2, 3, 4, 5, 6);
|
||||
let diagnostics = ClientDiagnostics::new(
|
||||
RelayDiagnostics::new(true, true),
|
||||
RelayDiagnostics::new(true, true, true),
|
||||
QuicDiagnostics::new(true, Some(1400)),
|
||||
TapDiagnostics::new(
|
||||
true,
|
||||
@@ -441,6 +448,7 @@ mod tests {
|
||||
|
||||
assert!(diagnostics.relay().reachable());
|
||||
assert!(diagnostics.relay().route_pinned());
|
||||
assert!(diagnostics.relay().gateway_connected());
|
||||
assert!(diagnostics.quic().datagram_supported());
|
||||
assert_eq!(diagnostics.quic().max_datagram_size(), Some(1400));
|
||||
assert!(diagnostics.tap().adapter_found());
|
||||
|
||||
Reference in New Issue
Block a user