Skip to content
This repository was archived by the owner on Mar 2, 2022. It is now read-only.

Commit 2b25b6a

Browse files
authored
Merge pull request #104 from juga0/feature/minimal_code
Temporally remove all code that is not used in bwscan cli
2 parents 4e55c1d + 99b5eb5 commit 2b25b6a

12 files changed

Lines changed: 2 additions & 2024 deletions

bwscanner/circuit.py

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def random_path_to_exit(exit_relay, relays):
3131
class 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-
7045
class 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()

bwscanner/fetcher.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from twisted.internet import reactor, defer, protocol
55
from twisted.internet.endpoints import TCP4ClientEndpoint
66
from twisted.web.client import (ResponseDone, PotentialDataLoss, PartialDownloadError)
7-
87
from bwscanner.logger import log
98

109

bwscanner/listener.py

Lines changed: 0 additions & 151 deletions
This file was deleted.

bwscanner/partition_scan.py

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)