Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: only consider onion addresses if onion is configured
✗ CI failure Fintan Halpenny committed 5 months ago
commit b70f054f818c1512f75c7f00e1f1fd4a425a744a
parent 28c8c1531ff5797c5877f94e6756cada530a8e0f
2 passed 4 failed (6 total) View logs
2 files changed +9 -0
modified crates/radicle-protocol/src/service.rs
@@ -2490,6 +2490,7 @@ where
                    .filter(|entry| !self.sessions.contains_key(&entry.node))
                    .filter(|entry| !self.config.external_addresses.contains(&entry.address.addr))
                    .filter(|entry| &entry.node != self.nid())
+
                    .filter(|entry| !entry.address.addr.is_onion() || self.config.onion.is_some())
                    .fold(HashMap::new(), |mut acc, entry| {
                        acc.entry(entry.node)
                            .and_modify(|e: &mut Peer| e.addresses.push(entry.address.clone()))
modified crates/radicle/src/node.rs
@@ -484,6 +484,14 @@ impl Address {
        &self.0.host
    }

+
    /// Returns `true` if the [`HostName`] is a Tor onion address.
+
    pub fn is_onion(&self) -> bool {
+
        match self.0.host {
+
            HostName::Tor(_) => true,
+
            _ => false,
+
        }
+
    }
+

    /// Return the port number of the [`Address`].
    pub fn port(&self) -> u16 {
        self.0.port