Bandwidth Files¶
Bandwidth files.
-
class
bushel.bandwidth.file.
BandwidthFileLineError
[source]¶ Enumeration of forgivable errors that may be encountered during parsing of lines in a bandwidth file.
Name
Description
SHORT_TERMINATOR
A terminator with 4 = instead of 5. https://bugs.torproject.org/28379
NO_TERMINATOR
No terminator present, for pre-1.0.0 compatibility.
-
class
bushel.bandwidth.file.
BandwidthFileLiner
(allowed_errors=None)[source]¶ Parses
BandwidthFileToken
s intoBandwidthFileTimestamp
,BandwidthFileHeaderLine
s andBandwidthFileRelayLine
. By default this is a strict implementation of the Tor Bandwidth File Specification version 1.4.0 [bandwidth-file-spec], but this can be relaxed to account for parsing older versions, or for known bugs in Tor implementations.Lines are produced by processing tokens according to a state machine:
State transitions shown in red would ideally not be needed as they are protocol violations, but implementations of the protocol exist that produce documents requiring these transitions and we need to be bug compatible.
- Parameters
allowed_errors (list(BandwidthFileLineError)) – A list of errors that will be considered non-fatal during itemization.