Module tor_netdoc::types::version

source ·
Expand description

Parsing and comparison for Tor versions

Tor versions use a slightly unusual encoding described in Tor’s version-spec.txt. Briefly, version numbers are of the form

MAJOR.MINOR.MICRO[.PATCHLEVEL][-STATUS_TAG][ (EXTRA_INFO)]*

Here we parse everything up to the first space, but ignore the “EXTRA_INFO” component.

Why does Arti have to care about Tor versions? Sometimes a given Tor version is broken for one purpose or another, and it’s important to avoid using them for certain kinds of traffic. (For planned incompatibilities, you should use protocol versions instead.)

§Examples

use tor_netdoc::types::version::TorVersion;
let older: TorVersion = "0.3.5.8".parse()?;
let latest: TorVersion = "0.4.3.4-rc".parse()?;
assert!(older < latest);

§Limitations

This module handles the version format which Tor has used ever since 0.1.0.1-rc. Earlier versions used a different format, also documented in version-spec.txt. Fortunately, those versions are long obsolete, and there’s not much reason to parse them.

TODO: Possibly, this module should be extracted into a crate of its own. I’m not 100% sure though – does anything need versions but not network docs?

Structs§