[tor-commits] [sbws/master] relaylist: add method to check and exit has some flags

juga at torproject.org juga at torproject.org
Mon Dec 3 22:33:03 UTC 2018


commit 5796572a204c9723a165de7eb2d7fe471d41fcd8
Author: juga0 <juga at riseup.net>
Date:   Thu Nov 22 14:21:10 2018 +0000

    relaylist: add method to check and exit has some flags
    
    The flags are: not having a badexit and the policy allows to exit
    to a port.
---
 sbws/lib/relaylist.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index 9d5c050..979ae7f 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -138,6 +138,11 @@ class Relay:
             return False
         return self.exit_policy.can_exit_to(port=port)
 
+    def is_exit_not_bad_allowing_port(self, port):
+        return (Flag.BADEXIT not in self.flags and
+                Flag.EXIT in self.flags and
+                self.can_exit_to_port(port))
+
 
 class RelayList:
     ''' Keeps a list of all relays in the current Tor network and updates it





More information about the tor-commits mailing list