36 releases (20 breaking)

0.24.0 Oct 31, 2024
0.22.0 Sep 3, 2024
0.20.0 Jun 27, 2024
0.12.1 Mar 4, 2024
0.0.0 Jun 24, 2021

#137 in Parser implementations

Download history 1632/week @ 2024-08-01 1162/week @ 2024-08-08 1169/week @ 2024-08-15 1449/week @ 2024-08-22 1595/week @ 2024-08-29 1772/week @ 2024-09-05 990/week @ 2024-09-12 1260/week @ 2024-09-19 1890/week @ 2024-09-26 1115/week @ 2024-10-03 844/week @ 2024-10-10 1073/week @ 2024-10-17 1028/week @ 2024-10-24 2301/week @ 2024-10-31 1145/week @ 2024-11-07 1613/week @ 2024-11-14

6,257 downloads per month
Used in 42 crates (12 directly)

MIT/Apache and maybe LGPL-3.0-only

1.5MB
26K 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

~20–31MB
~472K SLoC