@@ -31,6 +31,7 @@ def random_path_to_exit(exit_relay, relays):
3131class CircuitGenerator (object ):
3232 def __init__ (self , state ):
3333 self .state = state
34+ # FIXME: don't we want to remove the exits from the list of relays?
3435 self .relays = list (set (r for r in state .routers .values () if r ))
3536 self .exits = [relay for relay in self .relays if is_valid_exit (relay )]
3637
@@ -41,32 +42,6 @@ def next(self):
4142 raise NotImplementedError
4243
4344
44- class ExitScan (CircuitGenerator ):
45- """
46- Returns a generator that yields a set of circuits.
47-
48- The set of circuits contain each exit relay from a snapshot
49- of the consensus in the exit position once. The first and
50- second hops are selected randomly.
51- """
52- def __init__ (self , state ):
53- super (ExitScan , self ).__init__ (state )
54- random .shuffle (self .exits )
55-
56- def circuit_generator ():
57- """
58- Pick two other relays for a circuit while being sure not
59- to use the exit relay more than once.
60- """
61- for exit_relay in self .exits :
62- yield random_path_to_exit (exit_relay , self .relays )
63-
64- self ._circgen = circuit_generator ()
65-
66- def next (self ):
67- return self ._circgen .next ()
68-
69-
7045class TwoHop (CircuitGenerator ):
7146 """
7247 Select two hop circuits with the relay to be measured and a random exit
@@ -133,23 +108,3 @@ def exit_by_bw(self, relay):
133108
134109 def next (self ):
135110 return self ._circgen .next ()
136-
137-
138- class ThereAndBackAgain (CircuitGenerator ):
139- def __init__ (self , state , entry_exit_relay ):
140- super (ThereAndBackAgain , self ).__init__ (state )
141- random .shuffle (self .relays )
142-
143- def circuit_generator ():
144- """
145- Select a three hop path with the scanned relay as a middle relay.
146- """
147- for relay in self .relays :
148- yield [entry_exit_relay ,
149- relay ,
150- entry_exit_relay ]
151-
152- self ._circgen = circuit_generator ()
153-
154- def next (self ):
155- return self ._circgen .next ()
0 commit comments