[or-cvs] r15444: class SelectionManager has been updated to include the varia (torflow/branches/gsoc2008/TorCtl)
fallon at seul.org
fallon at seul.org
Tue Jun 24 08:48:29 UTC 2008
Author: fallon
Date: 2008-06-24 04:48:28 -0400 (Tue, 24 Jun 2008)
New Revision: 15444
Modified:
torflow/branches/gsoc2008/TorCtl/PathSupport.py
Log:
class SelectionManager has been updated to include the variable 'restrict_guards_only'. When this is equal to True, PercentileRestriction will only apply to entry nodes. This is achieved through changes to SelectionManager.reconfigure().
class Connection has been updated to include an __init__ function. It calls the init function for TorCtl.Connection.
Modified: torflow/branches/gsoc2008/TorCtl/PathSupport.py
===================================================================
--- torflow/branches/gsoc2008/TorCtl/PathSupport.py 2008-06-24 08:00:30 UTC (rev 15443)
+++ torflow/branches/gsoc2008/TorCtl/PathSupport.py 2008-06-24 08:48:28 UTC (rev 15444)
@@ -163,6 +163,8 @@
class Connection(TorCtl.Connection):
"""Extended Connection class that provides a method for building circuits"""
+ def __init__(self, sock):
+ TorCtl.Connection.__init__(self,sock)
def build_circuit(self, pathlen, path_sel):
"Tell Tor to build a circuit chosen by the PathSelector 'path_sel'"
circ = Circuit()
@@ -724,7 +726,7 @@
"""
def __init__(self, pathlen, order_exits,
percent_fast, percent_skip, min_bw, use_all_exits,
- uniform, use_exit, use_guards, geoip_config=None):
+ uniform, use_exit, use_guards,restrict_guards, geoip_config=None):
self.__ordered_exit_gen = None
self.pathlen = pathlen
self.order_exits = order_exits
@@ -737,6 +739,8 @@
self.use_guards = use_guards
self.geoip_config = geoip_config
+ self.restrict_guards_only = restrict_guards
+
def reconfigure(self, sorted_r):
"""This function is called after a configuration change,
to rebuild the RestrictionLists."""
@@ -748,24 +752,35 @@
if self.use_guards: entry_flags = ["Guard", "Valid", "Running"]
else: entry_flags = ["Valid", "Running"]
-
+
+
+ if self.restrict_guards_only:
+ entry_flags = ["Guard","Valid","Running"]
+ nonentry_skip = 0
+ nonentry_fast = 100
+ else:
+ entry_flags = ["Valid","Running"]
+ nonentry_skip = self.percent_skip
+ nonentry_fast = self.percent_fast
+
entry_rstr = NodeRestrictionList(
[PercentileRestriction(self.percent_skip, self.percent_fast, sorted_r),
ConserveExitsRestriction(),
FlagsRestriction(entry_flags, [])]
)
mid_rstr = NodeRestrictionList(
- [PercentileRestriction(self.percent_skip, self.percent_fast, sorted_r),
+ [PercentileRestriction(nonentry_skip, nonentry_fast, sorted_r),
ConserveExitsRestriction(),
- FlagsRestriction(["Running"], [])]
+ FlagsRestriction(["Running","Fast"], [])]
+
)
if self.use_all_exits:
self.exit_rstr = NodeRestrictionList(
- [FlagsRestriction(["Valid", "Running"], ["BadExit"])])
+ [FlagsRestriction(["Valid", "Running","Fast"], ["BadExit"])])
else:
self.exit_rstr = NodeRestrictionList(
- [PercentileRestriction(self.percent_skip, self.percent_fast, sorted_r),
- FlagsRestriction(["Valid", "Running"], ["BadExit"])])
+ [PercentileRestriction(nonentry_skip, nonentry_fast, sorted_r),
+ FlagsRestriction(["Valid", "Running","Fast"], ["BadExit"])])
if self.exit_name:
self.exit_rstr.del_restriction(IdHexRestriction)
@@ -875,6 +890,7 @@
self.path = [] # routers
self.exit = None
self.built = False
+ self.failed = False
self.dirty = False
self.closed = False
self.detached_cnt = 0
More information about the tor-commits
mailing list