Module btformats
source code
Functions for verifying debtorrent metainfo.
These functions all work on bdecoded debtorrent metainfo, and are used
to verify their conformance with the protocol.
regex
|
reg = re.compile(r'^[^/\\\.~][^/\\]*$')
a compiled regex for verifying the security of path names
|
tuple of types
|
ints = (<type 'long'>, <type 'int'>)
the types that are acceptable for integer values
|
Imports:
types.StringType,
types.LongType,
types.IntType,
types.ListType,
types.DictType,
re.compile,
bisect.bisect
|
Checks the info dictionary for conformance.
Verifies that the info dictionary of the metainfo conforms to the
debtorrent protocol.
- Parameters:
info (dictionary) - the info field from the metainfo dictionary
- Raises:
ValueError - if the info doesn't conform
|
|
Checks the metainfo dictionary for conformance.
Verifies that the metainfo dictionary conforms to the debtorrent
protocol.
- Parameters:
message (dictionary) - the bdecoded metainfo dictionary
- Raises:
ValueError - if the metainfo doesn't conform
|
|
Checks the peers dictionary returned by a tracker for conformance.
Verifies that the peers dictionary returned by a tracker conforms to
the debtorrent protocol.
- Parameters:
message (dictionary) - the bdecoded peers dictionary returned by a tracker
- Raises:
ValueError - if the info doesn't conform
|