Replace two-node-udp with Docker network test harness, fix dead code warnings

Replace examples/two-node-udp/ (netns-based) with examples/docker-network/
(Docker compose, 5 nodes, mesh + chain topologies). The new harness uses
auto-detecting build script and includes SVG topology diagrams.

Remove unused get_session_mut, remote_addr(), remote_pubkey() methods.
Gate test-only accessors with #[cfg(test)]. Zero warnings in release build.
This commit is contained in:
Johnathan Corgan
2026-02-14 18:38:26 +00:00
parent 801a5ab222
commit 5236fd02bf
23 changed files with 983 additions and 395 deletions
+2 -5
View File
@@ -806,16 +806,13 @@ impl Node {
// === End-to-End Sessions ===
/// Get a session by remote NodeAddr.
#[cfg(test)]
pub(crate) fn get_session(&self, remote: &NodeAddr) -> Option<&SessionEntry> {
self.sessions.get(remote)
}
/// Get a mutable session by remote NodeAddr.
pub(crate) fn get_session_mut(&mut self, remote: &NodeAddr) -> Option<&mut SessionEntry> {
self.sessions.get_mut(remote)
}
/// Remove a session.
#[cfg(test)]
pub(crate) fn remove_session(&mut self, remote: &NodeAddr) -> Option<SessionEntry> {
self.sessions.remove(remote)
}
+5 -10
View File
@@ -42,12 +42,15 @@ impl EndToEndState {
/// The state is `None` only transiently during handler processing.
pub(crate) struct SessionEntry {
/// Remote node's address (session table key).
#[allow(dead_code)]
remote_addr: NodeAddr,
/// Remote node's static public key (for Noise IK).
#[allow(dead_code)]
remote_pubkey: PublicKey,
/// Current session state. `None` only during state transitions.
state: Option<EndToEndState>,
/// When the session was created (Unix milliseconds).
#[cfg_attr(not(test), allow(dead_code))]
created_at: u64,
/// Last activity timestamp (Unix milliseconds).
last_activity: u64,
@@ -70,16 +73,6 @@ impl SessionEntry {
}
}
/// Get the remote node address.
pub(crate) fn remote_addr(&self) -> &NodeAddr {
&self.remote_addr
}
/// Get the remote node's public key.
pub(crate) fn remote_pubkey(&self) -> &PublicKey {
&self.remote_pubkey
}
/// Get the current session state.
pub(crate) fn state(&self) -> &EndToEndState {
self.state.as_ref().expect("session state taken but not restored")
@@ -114,11 +107,13 @@ impl SessionEntry {
}
/// Get creation time.
#[cfg(test)]
pub(crate) fn created_at(&self) -> u64 {
self.created_at
}
/// Get last activity time.
#[cfg(test)]
pub(crate) fn last_activity(&self) -> u64 {
self.last_activity
}