[tor-dev] Status report - Stream-RTT

ra r_a at lavabit.com
Sun Jul 28 23:16:10 UTC 2013


On Saturday 27 July 2013 04:41:45 Damian Johnson wrote:
> Hi ra, glad to see that you're using stem! 

Sure, stem works really great!

> If you have any questions,
> suggestions, feature requests, 

These parts were a bit tricky to figure out for me:
-) When I wanted to check if a certain node is an exit node it took me some 
time to figure out that looking for an exit flag is not sufficient because some 
nodes are in fact exit nodes but don't have an exit flag. One has to look at 
the nodes exit policy which is unaccessible by default because of  
microdescriptors. Maybe returning some meaningful message when one uses 
get_server_descriptor() and microdescriptors are enabled would help..?
-) It is not safe to use extend_circuit in parallel for creating new circuits. 
I think this is not mentioned anywhere.
-) Router status V2/V3 also took me some time but this has already been fixed.

> or would like a code review then let me
> know. 

That would be awesome!

> As of just four weeks ago the Controller started providing v3
> responses

I missed that obviously. Fixed in [0].

> > circ.build_flags.count('IS_INTERNAL') == 0
>
> This would more commonly be done as...
> 'IS_INTERNAL' not in circ.build_flags

Fixed in [0].

> > try:
> >   controller.reset_conf("__DisablePredictedCircuits")
> >   controller.reset_conf("__LeaveStreamsUnattached")
> >   controller.close()
> > 
> > except NameError:
> >   pass
> 
> What raises a NameError?

This was a leftover where it has been possible that "controller" doesn't exist 
at that time. Fixed in [0].

> > # close circuit, but ignore if it does not exist anymore
> > 
> > try:
> >   self._controller.get_circuit(self._cid)
> >   self._controller.close_circuit(self._cid)
> > 
> > except (ValueError, InvalidArguments):
> >   pass
> 
> What is the purpose of the get_circuit() call? If it's not superfluous

It doesn't do any harm but is definitely superfluous. Fixed in [0].

> > try:
> >   controller = Controller.from_port()
> > 
> > except SocketError:
> >   sys.stderr.write("ERROR: Couldn't connect to Tor.\n")
> >   sys.exit(1)
> > 
> > controller.authenticate()
> 
> This is certainly a fine way of doing it, but you might want to also
> look at connection.connect_port()...
> 
> https://stem.torproject.org/api/connection.html#stem.connection.connect_por
> t
> 
> It is intended to be a quick and easy method of getting a Controller
> for command-line applications. For instance, it will present a
> password prompt if tor is configured to use password authentication.
> Just realized I should have included it in a tutorial somewhere...

I didn't know that. Since the script now depends on stem version > 1.0.1 
anyway, I integrated it.

Thank you for your feedback so far!

> Your code looks great! If you wouldn't mind I'd love to reference it
> on stem's examples page...

Sure, go ahead.

> Shall I reference 'https://bitbucket.org/ra_/tor-rtt/' or do you
> anticipate your project having a more permanent home? (this might be a
> question for Mike as much as you)

I would not mind but I don't have any plans for that. Mike only asked me to 
make the code accessible online.

Best,
Robert

[0] https://bitbucket.org/ra_/tor-
rtt/commits/666e0b173871ba3f699c8bc07bfb156f653adf7a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.torproject.org/pipermail/tor-dev/attachments/20130729/323f49b4/attachment.sig>


More information about the tor-dev mailing list