[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] More succinct exit policy check in get_type
commit 3fc8251c7becac0bd3416d4a6486c964ce1c3aec
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Sep 23 18:58:50 2017 -0700
More succinct exit policy check in get_type
---
nyx/panel/connection.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py
index 4683dcc..39a99b6 100644
--- a/nyx/panel/connection.py
+++ b/nyx/panel/connection.py
@@ -190,18 +190,14 @@ class ConnectionEntry(Entry):
return Category.HIDDEN
fingerprint = nyx.tracker.get_consensus_tracker().get_relay_fingerprints(self._connection.remote_address).get(self._connection.remote_port)
+ exit_policy = controller.get_exit_policy(None)
if fingerprint and LAST_RETRIEVED_CIRCUITS:
for circ in LAST_RETRIEVED_CIRCUITS:
if circ.path and len(circ.path) == 1 and circ.path[0][0] == fingerprint and circ.status == 'BUILT':
return Category.DIRECTORY # one-hop circuit to retrieve directory information
- else:
- # not a known relay, might be an exit connection
-
- exit_policy = controller.get_exit_policy(None)
-
- if exit_policy and exit_policy.can_exit_to(self._connection.remote_address, self._connection.remote_port):
- return Category.EXIT
+ elif exit_policy and exit_policy.can_exit_to(self._connection.remote_address, self._connection.remote_port):
+ return Category.EXIT
return Category.OUTBOUND
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits