commit 9632155b7c2cbf202a0604227ae977949b07574f Author: aagbsn aagbsn@extc.org Date: Wed Jun 20 04:44:36 2012 -0700
4568 - Add extra-info parser to load()
BridgeDB will now also parse extra-info descriptors if the configuration option 'EXTRA_INFO_FILE' is specified --- lib/bridgedb/Main.py | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/lib/bridgedb/Main.py b/lib/bridgedb/Main.py index befb4ed..69a4761 100644 --- a/lib/bridgedb/Main.py +++ b/lib/bridgedb/Main.py @@ -172,15 +172,18 @@ def load(cfg, splitter, clear=False): for ID, running, stable, or_addresses in Bridges.parseStatusFile(f): status[ID] = running, stable addresses[ID] = or_addresses + #transports[ID] = transports f.close() if hasattr(cfg, "COUNTRY_BLOCK_FILE"): f = open(cfg.COUNTRY_BLOCK_FILE, 'r') for fingerprint, countryCode in Bridges.parseCountryBlockFile(f): countryblock.insert(fingerprint, countryCode) f.close() + bridges = {} for fname in cfg.BRIDGE_FILES: f = open(fname, 'r') for bridge in Bridges.parseDescFile(f, cfg.BRIDGE_PURPOSE): + bridges[bridge.getID()] = bridge s = status.get(bridge.getID()) if s is not None: running, stable = s @@ -190,6 +193,17 @@ def load(cfg, splitter, clear=False): countryblock.getBlockingCountries(bridge.fingerprint)) splitter.insert(bridge) f.close() + # read pluggable transports from extra-info document + # XXX: should read from networkstatus after bridge-authority + # does a reachability test + if hasattr(cfg, "EXTRA_INFO_FILE"): + f = open(cfg.EXTRA_INFO_FILE, 'r') + for transport in Bridges.parseExtraInfoFile(f): + ID, method_name, address, port, argdict = transport + if bridges[ID].running: + bridges[ID].transports.append(Bridges.PluggableTransport(bridges[ID], + method_name, address, port, argdict)) + bridges = None
def loadProxyList(cfg): ipset = {}
tor-commits@lists.torproject.org