commit 79520a8290578d5fd96eaf06c8080f91ace0bddf Merge: 76e8eb5f 0d0a018d Author: Damian Johnson atagar@torproject.org Date: Wed Feb 7 11:21:03 2018 -0800
Building blocks for basic circuit requests
Low-level building blocks for circuit requests. This is *not* the API we'll vend to end users (it's much too raw), but we now have everything from Endosome [1] we need to download descriptors...
import stem.client
with stem.client.Relay.connect('127.0.0.1', 12345, [3]) as relay: circ = relay.create_circuit() circ.send('RELAY_BEGIN_DIR', stream_id = 1) desc = circ.send('RELAY_DATA', 'GET /tor/server/authority HTTP/1.0\r\n\r\n', stream_id = 1).data circ.close()
print(desc)
When run this prints our own descriptor...
% python demo.py HTTP/1.0 200 OK Date: Wed, 07 Feb 2018 18:42:41 GMT Content-Type: text/plain Content-Encoding: identity Expires: Fri, 09 Feb 2018 18:42:41 GMT
router Unnamed 97.113.177.53 12345 0 23456 identity-ed25519 -----BEGIN ED25519 CERT----- AQQABm/qAazUltT1iUUbIMw8VNNhGb50FDHKJz6S94FLQNxL0LObAQAgBAAapbO9 iLFD0l9SEiEMFQWIT2VnbLyCZKvbrxTs5ULC1l1hQPoui6Y/lEd3yjrQhIs/vl6R 1S6FbwSFDmiXOzq47mFrse4C71ht3TpLOD0F3wiyjWtsqU1k7iPmmpejUgs= -----END ED25519 CERT----- master-key-ed25519 GqWzvYixQ9JfUhIhDBUFiE
Next steps are to...
a. Support ORPort downloads in 'stem.descriptor.remote'. b. Add more integration tests. c. Give more thought to the API we'd like to vend. d. Brainstorm a GSoC project idea that expands these capabilities.
However, first there's some other projects (in particular v3 hidden services) that need my time.
[1] https://github.com/teor2345/endosome
stem/__init__.py | 1 + stem/client/__init__.py | 440 +++++++++++++++-------------------- stem/client/cell.py | 419 ++++++++++++++++++++++------------ stem/client/datatype.py | 482 +++++++++++++++++++++++++++++++++++++++ stem/control.py | 9 +- stem/socket.py | 1 + test/integ/__init__.py | 1 + test/integ/client/__init__.py | 7 + test/integ/client/connection.py | 66 ++++++ test/integ/control/controller.py | 4 +- test/runner.py | 4 +- test/settings.cfg | 4 +- test/unit/client/__init__.py | 1 + test/unit/client/address.py | 27 ++- test/unit/client/cell.py | 146 +++++++++--- test/unit/client/certificate.py | 2 +- test/unit/client/kdf.py | 27 +++ test/unit/client/size.py | 2 +- 18 files changed, 1178 insertions(+), 465 deletions(-)
tor-commits@lists.torproject.org