Stem Docs

Version

Version

Tor versioning information and requirements for its features. These can be easily parsed and compared, for instance...

>>> from stem.version import get_system_tor_version, Requirement
>>> my_version = get_system_tor_version()
>>> print(my_version)
0.2.1.30
>>> my_version >= Requirement.TORRC_CONTROL_SOCKET
True

Module Overview:

get_system_tor_version - gets the version of our system's tor installation

Version - Tor versioning information
stem.version.Requirement(enum)

Enumerations for the version requirements of features.

Deprecated since version 1.6.0: Requirement entries belonging to tor versions which have been obsolete for at least six months will be removed when we break backward compatibility in the 2.x stem release.

Requirement Description
AUTH_SAFECOOKIE SAFECOOKIE authentication method
DESCRIPTOR_COMPRESSION Expanded compression support for ZSTD and LZMA
DORMANT_MODE DORMANT and ACTIVE Signal
DROPGUARDS DROPGUARDS requests
EVENT_AUTHDIR_NEWDESCS AUTHDIR_NEWDESC events
EVENT_BUILDTIMEOUT_SET BUILDTIMEOUT_SET events
EVENT_CIRC_MINOR CIRC_MINOR events
EVENT_CLIENTS_SEEN CLIENTS_SEEN events
EVENT_CONF_CHANGED CONF_CHANGED events
EVENT_DESCCHANGED DESCCHANGED events
EVENT_GUARD GUARD events
EVENT_HS_DESC_CONTENT HS_DESC_CONTENT events
EVENT_NETWORK_LIVENESS NETWORK_LIVENESS events
EVENT_NEWCONSENSUS NEWCONSENSUS events
EVENT_NS NS events
EVENT_SIGNAL SIGNAL events
EVENT_STATUS STATUS_GENERAL, STATUS_CLIENT, and STATUS_SERVER events
EVENT_STREAM_BW STREAM_BW events
EVENT_TRANSPORT_LAUNCHED TRANSPORT_LAUNCHED events
EVENT_CONN_BW CONN_BW events
EVENT_CIRC_BW CIRC_BW events
EVENT_CELL_STATS CELL_STATS events
EVENT_TB_EMPTY TB_EMPTY events
EVENT_HS_DESC HS_DESC events
EXTENDCIRCUIT_PATH_OPTIONAL EXTENDCIRCUIT queries can omit the path if the circuit is zero
FEATURE_EXTENDED_EVENTS 'EXTENDED_EVENTS' optional feature
FEATURE_VERBOSE_NAMES 'VERBOSE_NAMES' optional feature
GETINFO_CONFIG_TEXT 'GETINFO config-text' query
GETINFO_GEOIP_AVAILABLE 'GETINFO ip-to-country/ipv4-available' query and its ipv6 counterpart
GETINFO_MICRODESCRIPTORS 'GETINFO md/all' query
GETINFO_UPTIME 'GETINFO uptime' query
HIDDEN_SERVICE_V3 Support for v3 hidden services
HSFETCH HSFETCH requests
HSFETCH_V3 HSFETCH for version 3 hidden services
HSPOST HSPOST requests
ADD_ONION ADD_ONION and DEL_ONION requests
ADD_ONION_BASIC_AUTH ADD_ONION supports basic authentication
ADD_ONION_NON_ANONYMOUS ADD_ONION supports non-anonymous mode
ADD_ONION_MAX_STREAMS ADD_ONION support for MaxStreamsCloseCircuit
LOADCONF LOADCONF requests
MICRODESCRIPTOR_IS_DEFAULT Tor gets microdescriptors by default rather than server descriptors
SAVECONF_FORCE Added the 'FORCE' flag to SAVECONF
TAKEOWNERSHIP TAKEOWNERSHIP requests
TORRC_CONTROL_SOCKET 'ControlSocket <path>' config option
TORRC_PORT_FORWARDING 'PortForwarding' config option
TORRC_DISABLE_DEBUGGER_ATTACHMENT 'DisableDebuggerAttachment' config option
TORRC_VIA_STDIN Allow torrc options via 'tor -f -' (ticket 13865)
ONION_SERVICE_AUTH_ADD For adding ClientAuthV3 to a v3 onion service via ADD_ONION
stem.version.get_system_tor_version(tor_cmd='tor')[source]

Queries tor for its version. This is os dependent, only working on linux, osx, and bsd.

Parameters:tor_cmd (str) -- command used to run tor
Returns:Version provided by the tor command
Raises :IOError if unable to query or parse the version
class stem.version.Version(version_str)[source]

Bases: object

Comparable tor version. These are constructed from strings that conform to the 'new' style in the tor version-spec, such as "0.1.4" or "0.2.2.23-alpha (git-7dcd105be34a4f44)".

Changed in version 1.6.0: Added all_extra parameter.

Variables:
  • major (int) -- major version
  • minor (int) -- minor version
  • micro (int) -- micro version
  • patch (int) -- patch level (None if undefined)
  • status (str) -- status tag such as 'alpha' or 'beta-dev' (None if undefined)
  • extra (str) -- first extra information without its parentheses such as 'git-8be6058d8f31e578' (None if undefined)
  • all_extra (list) -- all extra information entries, without their parentheses
  • git_commit (str) -- git commit id (None if it wasn't provided)
Parameters:

version_str (str) -- version to be parsed

Raises :

ValueError if input isn't a valid tor version