Browse Source

hosts: Skip Arti inbound connections on register_channel()

parazyd 1 year ago
parent
commit
40cbbfd325
2 changed files with 6 additions and 1 deletions
  1. 1 1
      src/net/channel.rs
  2. 5 0
      src/net/hosts.rs

+ 1 - 1
src/net/channel.rs

@@ -480,7 +480,7 @@ impl Channel {
         session.type_id()
     }
 
-    fn p2p(&self) -> P2pPtr {
+    pub(in crate::net) fn p2p(&self) -> P2pPtr {
         self.session().p2p()
     }
 

+ 5 - 0
src/net/hosts.rs

@@ -1098,6 +1098,11 @@ impl Hosts {
     pub(in crate::net) async fn register_channel(&self, channel: ChannelPtr) {
         let address = channel.address().clone();
 
+        // This is an attempt to skip any Tor (and similar-behaving) inbound connections
+        if channel.p2p().settings().read().await.inbound_addrs.contains(&address) {
+            return
+        }
+
         // This will panic if we are already connected to this peer, this peer
         // is suspended, or this peer is currently being inserted into the hostlist.
         // None of these scenarios should ever happen.