tor-netdoc: require documentation, and fill in final missing docs

This commit is contained in:
Nick Mathewson 2020-05-09 13:34:59 -04:00
parent 5d3f13e6e7
commit 7ec2254634
4 changed files with 42 additions and 33 deletions

View File

@ -25,10 +25,18 @@ pub enum Position {
/// The error occurred at a particular byte within the string.
///
/// We try to conver these to a Pos before displaying them to the user.
Byte { off: usize },
Byte {
/// Byte offset within a string.
off: usize,
},
/// The error occurred at a particular line (and possibly at a
/// particular byte within the line.)
Pos { line: usize, byte: usize },
Pos {
/// Line offset within a string.
line: usize,
/// Byte offset within the line.
byte: usize,
},
}
impl Position {

View File

@ -21,7 +21,7 @@
//!
//! TODO: this crate needs far more tests!
//#![warn(missing_docs)]
#![deny(missing_docs)]
mod argtype;
mod err;

View File

@ -95,6 +95,7 @@ pub struct AddrPortPattern {
}
impl AddrPortPattern {
/// Return true iff this pattern matches a given address and port.
pub fn matches(&self, addr: &IpAddr, port: u16) -> bool {
self.pattern.matches(addr) && self.ports.contains(port)
}

View File

@ -1,33 +1,33 @@
/// Parsing implementation for Tor router descriptors.
///
/// A "router descriptor" is a signed statment that a relay makes
/// about itself, explaining its keys, its capabilities, its location,
/// and its status.
///
/// Relays upload their router descriptors to authorities, which use
/// them to build consensus documents. Old clients and relays used to
/// fetch and use router descriptors for all the relays, but nowadays they use
/// microdescriptors instead.
///
/// Clients still use router descriptors when communicating with
/// bridges: since bridges are not passed through an authority,
/// clients accept their descriptors directly.
///
/// For full information about the router descriptor format, see
/// [dir-spec.txt](https://spec.torproject.org/dir-spec).
///
/// # Limitations
///
/// TODO: This needs to get tested much more!
///
/// TODO: This implementation can be memory-inefficient. In practice,
/// it gets really expensive storing policy entries, family
/// descriptions, parsed keys, and things like that. We will probably want to
/// de-duplicate those.
///
/// TODO: There should be accessor functions for some or all of the
/// fields in RouterDesc. I'm deferring those until I know what they
/// should be.
//! Parsing implementation for Tor router descriptors.
//!
//! A "router descriptor" is a signed statment that a relay makes
//! about itself, explaining its keys, its capabilities, its location,
//! and its status.
//!
//! Relays upload their router descriptors to authorities, which use
//! them to build consensus documents. Old clients and relays used to
//! fetch and use router descriptors for all the relays, but nowadays they use
//! microdescriptors instead.
//!
//! Clients still use router descriptors when communicating with
//! bridges: since bridges are not passed through an authority,
//! clients accept their descriptors directly.
//!
//! For full information about the router descriptor format, see
//! [dir-spec.txt](https://spec.torproject.org/dir-spec).
//!
//! # Limitations
//!
//! TODO: This needs to get tested much more!
//!
//! TODO: This implementation can be memory-inefficient. In practice,
//! it gets really expensive storing policy entries, family
//! descriptions, parsed keys, and things like that. We will probably want to
//! de-duplicate those.
//!
//! TODO: There should be accessor functions for some or all of the
//! fields in RouterDesc. I'm deferring those until I know what they
//! should be.
use crate::argtype::*;
use crate::parse::{Section, SectionRules};
use crate::policy::*;