leekspin.netstatus

Functions for creating mock networkstatus documents.

generateBridgeNetstatus(nickname, idkey_digest, server_desc_digest, timestamp, ipv4, orport, ipv6=None, dirport=None, flags=u'Fast Guard Running Stable Valid', bandwidth_line=None)[source]

Generate an @type bridge network-status 1.0 document (unsigned).

This function will generate a networkstatus document for a bridge relay, similar to the following:

r StingilyScampers Wdtrb4h8QVqqbDH4gMmVnAn2nYg 1BEVkVjixzVMFu7OK46GklhYtkg 2014-08-06 20:40:21 39.102.19.106 36286 0
a [72be:7d50:9c91:1170:2bf9:d760:bee1:66e1]:36286
s Fast Guard Running Stable Valid
w Bandwidth=1481409
p reject 1-65535
Parameters:
  • nickname (str) – The router’s nickname.
  • idkey_digest (str) – The SHA-1 digest of the router’s public identity key.
  • server_desc_digest (str) – The SHA-1 digest of the router’s @type [bridge-]server-descriptor, before the descriptor is signed.
  • timestamp (str) – An ISO 8601 timestamp, with a space as the separator.
  • ipv4 (str) – The IP address for router’s main ORAddress.
  • orport (str) – The port for the router’s main ORAddress.
  • ipv6 (str or None) – Any IPv6 ORAddress es for this router.
  • dirport (str or None) – The router’s DirPort.
  • flags (str) – A space-separated list of flags assigned to this router.
  • bandwidth_line (str) – A weighted bandwidth line for this router.