tadd --noonion option to filter out onion servers - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit f64062b6f13dfc340fedcdfdf24156ae21414c1c DIR parent 32f5feff8f9c3eaabdffd77825c4a31ab79e71a9 HTML Author: SomberNight <somber.night@protonmail.com> Date: Tue, 31 Jul 2018 20:25:53 +0200 add --noonion option to filter out onion servers closes #4531 Diffstat: M electrum/commands.py | 1 + M electrum/network.py | 6 ++++++ 2 files changed, 7 insertions(+), 0 deletions(-) --- DIR diff --git a/electrum/commands.py b/electrum/commands.py t@@ -826,6 +826,7 @@ def add_network_options(parser): parser.add_argument("-1", "--oneserver", action="store_true", dest="oneserver", default=None, help="connect to one server only") parser.add_argument("-s", "--server", dest="server", default=None, help="set server host:port:protocol, where protocol is either t (tcp) or s (ssl)") parser.add_argument("-p", "--proxy", dest="proxy", default=None, help="set proxy [type:]host[:port], where type is socks4,socks5 or http") + parser.add_argument("--noonion", action="store_true", dest="noonion", default=None, help="do not try to connect to onion servers") def add_global_options(parser): group = parser.add_argument_group('global options') DIR diff --git a/electrum/network.py b/electrum/network.py t@@ -89,6 +89,10 @@ def filter_version(servers): return {k: v for k, v in servers.items() if is_recent(v.get('version'))} +def filter_noonion(servers): + return {k: v for k, v in servers.items() if not k.endswith('.onion')} + + def filter_protocol(hostmap, protocol='s'): '''Filters the hostmap for those implementing protocol. The result is a list in serialized form.''' t@@ -409,6 +413,8 @@ class Network(util.DaemonThread): continue if host not in out: out[host] = {protocol: port} + if self.config.get('noonion'): + out = filter_noonion(out) return out @with_interface_lock