Opened 9 months ago

Last modified 3 months ago

#26902 needs_information enhancement

Download and parse bwauth files

Reported by: atagar Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Normal Keywords: descriptor, tor-bwauth
Cc: juga Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by juga)

Recently tor added its bandwidth authority files to the DirPort...

https://gitweb.torproject.org/torspec.git/commit/?id=365d371

We should add a parser and support in stem.descriptor.remote. This feature was added in tor 0.3.5 which the dirauths aren't yet running #26694 will update dir-spec.txt with the Tor version that add this feature once it's merged (#21377). Gonna wait to see this working in practice before we add stem support.

Child Tickets

Change History (7)

comment:1 Changed 5 months ago by irl

This wasn't actually added in 0.3.5. It was meant to be but missed the release.

comment:2 Changed 3 months ago by juga

Cc: juga added

CC myself

comment:4 Changed 3 months ago by juga

Description: modified (diff)
Keywords: tor-bwauth added

comment:5 Changed 3 months ago by juga

Description: modified (diff)

comment:6 Changed 3 months ago by juga

It should include a test that do something similar to:

>>> 
... import stem.descriptor
... import stem.descriptor.remote
... import stem.directory
>>> downloader = stem.descriptor.remote.DescriptorDownloader(
...   document_handler = stem.descriptor.DocumentHandler.DOCUMENT,
... )
>>> resource = '/tor/status-vote/next/bandwidth'
>>> query_args = {'endpoints': [('127.10.0.1', 2003)]}
>>> bw = downloader.query(resource, **query_args)
>>> bw.content
b'1544811454\nversion=1.2.0\nearliest_bandwidth=2018-12-12T15:02:35\nfile_created=2018-12-15T08:09:48\ngenerator_started=2018-12-15T08:06:50\nlatest_bandwidth=2018-12-14T18:17:34\nminimum_number_eligible_relays=3820\nminimum_percent_eligible_relays=60\nnumber_consensus_relays=6366\nnumber_eligible_relays=0\npercent_eligible_relays=0\nsoftware=sbws\nsoftware_version=1.0.3-dev0\n====='
>>> bw.compression
['identity']
>>> resource = '/tor/status-vote/next/bandwidth.z'
>>> bw = downloader.query(resource, **query_args)
>>> bw.content
b'1544811454\nversion=1.2.0\nearliest_bandwidth=2018-12-12T15:02:35\nfile_created=2018-12-15T08:09:48\ngenerator_started=2018-12-15T08:06:50\nlatest_bandwidth=2018-12-14T18:17:34\nminimum_number_eligible_relays=3820\nminimum_percent_eligible_relays=60\nnumber_consensus_relays=6366\nnumber_eligible_relays=0\npercent_eligible_relays=0\nsoftware=sbws\nsoftware_version=1.0.3-dev0\n====='
>>> bw.compression
['gzip']

As commented in comment:48:ticket:21377

comment:7 Changed 3 months ago by atagar

Status: newneeds_information

Hi juga. Stem support and test coverage for bandwidth file DirPort downloads will need to await its implementation within tor (ticket #21377). Is there anything in my court here at present?

comment:8 in reply to:  7 Changed 3 months ago by juga

Replying to atagar:

Hi juga. Stem support and test coverage for bandwidth file DirPort downloads will need to await its implementation within tor (ticket #21377). Is there anything in my court here at present?

Nope, you're right, we need to wait for #21377.

Note: See TracTickets for help on using tickets.