[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/main] Add support for vanilla bridges



commit 09a7fcc2611fa004a7bec3e9f4d0323328bdeeca
Author: meskio <meskio@xxxxxxxxxxxxxx>
Date:   Tue Nov 30 13:20:40 2021 +0100

    Add support for vanilla bridges
    
    Vanilla bridges doesn't have transports, don't add any transport for
    vanilla bridges.
---
 bridgedb/bridges.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/bridgedb/bridges.py b/bridgedb/bridges.py
index 83d6e95..91fa7f6 100644
--- a/bridgedb/bridges.py
+++ b/bridgedb/bridges.py
@@ -1554,7 +1554,6 @@ class Bridge(BridgeBackwardsCompatibility):
         """
         self.fingerprint = resource["fingerprint"]
         self.address = resource["address"]
-        self.orPort = resource["port"]
 
         self.flags.running = resource["flags"]["running"]
         self.flags.stable = resource["flags"]["stable"]
@@ -1567,14 +1566,17 @@ class Bridge(BridgeBackwardsCompatibility):
                 if validatedAddress:
                     self.orAddresses.append( (validatedAddress, oa["port"], oa["ip-version"],) )
 
-        transport = PluggableTransport(
-                fingerprint=self.fingerprint,
-                methodname=resource["type"],
-                address=self.address,
-                port=self.port,
-                arguments=resource.get("params", {})
-                )
-        self.transports = [transport]
+        if resource["type"] == "vanilla":
+            self.orPort = resource["port"]
+        else:
+            transport = PluggableTransport(
+                    fingerprint=self.fingerprint,
+                    methodname=resource["type"],
+                    address=self.address,
+                    port=resource["port"],
+                    arguments=resource.get("params", {})
+                    )
+            self.transports = [transport]
 
     def updateFromNetworkStatus(self, descriptor, ignoreNetworkstatus=False):
         """Update this bridge's attributes from a parsed networkstatus



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits