diff options
| author | tv <tv@krebsco.de> | 2026-10-23 11:20:00 +0200 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-23 11:20:00 +0200 |
| commit | dd4454a163d2a2afbffdd62ee6008ac8ee86dc09 (patch) | |
| tree | 6eafdff013389d955299ebbf04ad1240b0e69844 /src | |
| parent | 55882636e3601c72af641c1096d96e7eff61b78b (diff) | |
consistently use the words node, peer, and seed
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 9 | ||||
| -rw-r--r-- | src/remake/mod.rs | 2 | ||||
| -rw-r--r-- | src/swarm/auth.rs | 2 | ||||
| -rw-r--r-- | src/swarm/bootstrap.rs | 6 | ||||
| -rw-r--r-- | src/transport/firewall.rs | 4 | ||||
| -rw-r--r-- | src/transport/mod.rs | 5 | ||||
| -rw-r--r-- | src/transport/mycelium.rs | 2 |
7 files changed, 18 insertions, 12 deletions
diff --git a/src/main.rs b/src/main.rs index e945fc0..1a9d68e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,15 +67,20 @@ struct Args { use_value_delimiter = true, default_value = "tls://127.0.0.1:9651" )] + /// Peers of the supervised Mycelium daemon (overlay links such as + /// `tls://host:9651`), not continuum peers. pub mycelium_peers: Vec<String>, + /// Seeds: how to reach a node of the swarm to join, as a Mycelium public key, a + /// Mycelium IPv6 address, or a host name with an AAAA record for one. Without seeds, + /// the node starts a new swarm (genesis). #[arg(long, value_name = "STRING,[STRING...]", value_delimiter = ',')] seeds: Option<Vec<String>>, #[arg(long, value_name = "PATH")] htpasswd: String, - /// Pre-shared swarm key: only peers that know it may join (raw bytes, at least 16; + /// Pre-shared swarm key: only nodes that know it may join (raw bytes, at least 16; /// e.g. `head -c 32 /dev/urandom`). Without it, anyone who knows the swarm ID can. #[arg(long, value_name = "PATH")] swarm_key_file: Option<PathBuf>, @@ -100,7 +105,7 @@ async fn main() -> Result<()> { let swarm_key = match &args.swarm_key_file { Some(path) => Some(Arc::new(swarm::auth::SwarmKey::from_file(path)?)), None => { - warn!("No swarm key: any peer that learns the swarm ID can join"); + warn!("No swarm key: any node that learns the swarm ID can join"); None } }; diff --git a/src/remake/mod.rs b/src/remake/mod.rs index e888d6d..2429ad7 100644 --- a/src/remake/mod.rs +++ b/src/remake/mod.rs @@ -52,7 +52,7 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { /// This node's in-memory remake state. fn remake(&self) -> &RemakeState; - /// This node's peer ID. + /// This node's ID (its peers know it by this). fn node_id(&self) -> String; /// The epoch of the local replica. diff --git a/src/swarm/auth.rs b/src/swarm/auth.rs index e88be30..ea95406 100644 --- a/src/swarm/auth.rs +++ b/src/swarm/auth.rs @@ -1,7 +1,7 @@ //! Swarm membership by pre-shared key. //! //! Mycelium authenticates the sender of every message (`src_pk` can't be forged), so we -//! always know *who* talks to us. With a swarm key configured, only peers that also know +//! always know *who* talks to us. With a swarm key configured, only nodes that also know //! the key may take part: HELLO and HELLO_REPLY carry a tag proving it, and until a peer //! has sent a valid one, everything else it sends is ignored. //! diff --git a/src/swarm/bootstrap.rs b/src/swarm/bootstrap.rs index 2bf110f..3b6e510 100644 --- a/src/swarm/bootstrap.rs +++ b/src/swarm/bootstrap.rs @@ -15,7 +15,7 @@ const BOOTSTRAP_RETRY: Duration = Duration::from_millis(500); pub(crate) async fn bootstrap(state: &AppState, seeds: &[String]) -> Result<()> { if seeds.is_empty() { - info!("Initializing genesis node (no seed peers configured)"); + info!("Initializing genesis node (no seeds configured)"); state.initial_sync_done.store(true, Ordering::Release); state.mark_ready(Uuid::new_v4().to_string()).await?; return Ok(()); @@ -29,9 +29,9 @@ pub(crate) async fn bootstrap(state: &AppState, seeds: &[String]) -> Result<()> let mut peers = Vec::new(); for seed in seeds { - match state.transport.resolve_peer(seed).await { + match state.transport.resolve_seed(seed).await { Ok(peer) => { - debug!(seed = %seed, peer = %peer, "Resolved seed to peer"); + debug!(seed = %seed, peer = %peer, "Resolved seed"); peers.push(peer) } Err(e) => warn!(seed = %seed, error = %e, "Ignoring seed argument"), diff --git a/src/transport/firewall.rs b/src/transport/firewall.rs index 917fe5f..84fdc59 100644 --- a/src/transport/firewall.rs +++ b/src/transport/firewall.rs @@ -69,8 +69,8 @@ impl Transport for FirewallTransport { self.inner.local_id() } - async fn resolve_peer(&self, hint: &str) -> Result<String> { - self.inner.resolve_peer(hint).await + async fn resolve_seed(&self, seed: &str) -> Result<String> { + self.inner.resolve_seed(seed).await } fn encode(&self, peer: &str, message: &ParsedMessage) -> Result<EncodedMessage> { diff --git a/src/transport/mod.rs b/src/transport/mod.rs index 58db611..69d9e70 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -82,8 +82,9 @@ pub trait Transport: Send + Sync { /// This node's identity on the transport (for Mycelium: its public key). fn local_id(&self) -> &str; - /// Resolves a user-supplied peer hint (e.g. a seed) to a peer identity. - async fn resolve_peer(&self, hint: &str) -> Result<String>; + /// Resolves a seed (anything that leads to a node, e.g. an address) to that node's + /// identity, as `local_id` gives it on that node. + async fn resolve_seed(&self, seed: &str) -> Result<String>; fn encode(&self, peer: &str, message: &ParsedMessage) -> Result<EncodedMessage>; async fn send_encoded(&self, message: &EncodedMessage) -> Result<()>; diff --git a/src/transport/mycelium.rs b/src/transport/mycelium.rs index 0c0093a..84a34ea 100644 --- a/src/transport/mycelium.rs +++ b/src/transport/mycelium.rs @@ -490,7 +490,7 @@ impl Transport for MyceliumTransport { &self.local_id } - async fn resolve_peer(&self, hint: &str) -> Result<String> { + async fn resolve_seed(&self, hint: &str) -> Result<String> { if is_pubkey(hint) { return Ok(hint.to_owned()); } |
