
commit 305e75d40b12054e23ac19eba2e4828f48bd7252 Author: Matt Traudt <sirmatt@ksu.edu> Date: Fri Jun 29 09:17:59 2018 -0400 Measure Exit+BadExit relays as non-exits --- CHANGELOG.md | 4 ++++ sbws/core/scanner.py | 3 ++- sbws/lib/relaylist.py | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77fb16a..1c3e372 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Measure relays that have both Exit and BadExit as non-exits, which is how + clients would use them. (GH#217) ## [0.5.0] - 2018-06-26 diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py index 25c1dd3..249d8d4 100644 --- a/sbws/core/scanner.py +++ b/sbws/core/scanner.py @@ -178,7 +178,8 @@ def measure_relay(args, conf, destinations, cb, rl, relay): # exit, then pick a non-exit. Otherwise pick an exit. helper = None circ_fps = None - if relay.can_exit_to(dest.hostname, dest.port): + if relay.can_exit_to(dest.hostname, dest.port) and \ + relay not in rl.bad_exits: helper = _pick_ideal_second_hop( relay, dest, rl, cb.controller, is_exit=False) if helper: diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py index ddd982a..c3bb745 100644 --- a/sbws/lib/relaylist.py +++ b/sbws/lib/relaylist.py @@ -164,6 +164,10 @@ class RelayList: return self._relays_with_flag(Flag.EXIT) @property + def bad_exits(self): + return self._relays_without_flag(Flag.BADEXIT) + + @property def non_exits(self): return self._relays_without_flag(Flag.EXIT)