Skip to content

Commit

Permalink
add purpose= to build_circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
meejah committed Dec 10, 2018
1 parent 6c0fd1b commit b1db4ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion txtorcon/torstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def _find_circuit_after_extend(self, x):
circ.update([str(circ_id), 'EXTENDED'])
return circ

def build_circuit(self, routers=None, using_guards=True):
def build_circuit(self, routers=None, using_guards=True, purpose=None):
"""
Builds a circuit consisting of exactly the routers specified,
in order. This issues an EXTENDCIRCUIT call to Tor with all
Expand Down Expand Up @@ -586,6 +586,9 @@ def build_circuit(self, routers=None, using_guards=True):
cmd += router.decode('utf8')
else:
cmd += router.id_hex[1:]

if purpose is not None:
cmd += " purpose={}".format(purpose)
d = self.protocol.queue_command(cmd)
d.addCallback(self._find_circuit_after_extend)
return d
Expand Down

0 comments on commit b1db4ae

Please sign in to comment.