#tor #arti

tor-netdoc

Network document formats used with the Tor protocols

4 releases

0.0.3 Jan 11, 2022
0.0.2 Nov 30, 2021
0.0.1 Oct 29, 2021
0.0.0 Jun 24, 2021

#182 in Parser implementations

Download history 4/week @ 2021-10-02 5/week @ 2021-10-09 3/week @ 2021-10-16 22/week @ 2021-10-23 19/week @ 2021-10-30 9/week @ 2021-11-06 10/week @ 2021-11-13 8/week @ 2021-11-20 33/week @ 2021-11-27 21/week @ 2021-12-04 14/week @ 2021-12-11 20/week @ 2021-12-18 45/week @ 2021-12-25 19/week @ 2022-01-01 35/week @ 2022-01-08 27/week @ 2022-01-15

129 downloads per month
Used in 10 crates (4 directly)

MIT/Apache

495KB
9K SLoC

tor-netdoc

Parse and represent directory objects used in Tor.

Overview

Tor has several "directory objects" that it uses to convey information about relays on the network. They are documented in dir-spec.txt.

This crate has common code to parse and validate these documents. Currently, it can handle the metaformat, along with certain parts of the router descriptor type. We will eventually need to handle more types.

This crate is part of Arti, a project to implement Tor in Rust.

Design notes

The crate is derived into three main parts. In the (private) parse module, we have the generic code that we use to parse different kinds of network documents. In the [types] module we have implementations for parsing specific data structures that are used inside directory documents. Finally, the [doc] module defines the parsers for the documents themselves.

Features

build_docs: enable code to construct the objects representing different network documents.

routerdesc: enable support for the "router descriptor" document type, which is needed by bridge clients and relays.

ns-consensus: enable support for the "ns consensus" document type, which some relays cache and serve.

Caveat haxxor: limitations and infelicities

TODO: This crate requires that all of its inputs be valid UTF-8: This is fine only if we assume that proposal 285 is implemented in mainline Tor.

TODO: This crate has several pieces that could probably be split out into other smaller cases, including handling for version numbers and exit policies.

TODO: Many parts of this crate that should eventually be public aren't.

TODO: this crate needs far more tests!

License: MIT OR Apache-2.0

Dependencies

~7.5MB
~145K SLoC

~a