Skip to main content

tor_netdoc/
types.rs

1//! Various types that can occur in parsed network documents.
2//!
3//! Some of the types are parsing adapters: transparent newtypes
4//! that can be used for type-driven parsing in netdocs.
5//! These are needed (rather than using the underlying value type)
6//! in cases where network documents have different syntaxes for the same thing.
7//!
8//! NOTE: Several of these modules may eventually move elsewhere,
9//! or become their own crates.
10
11pub(crate) mod embedded_cert;
12pub mod family;
13pub(crate) mod misc;
14pub mod policy;
15pub mod relay_flags;
16pub mod version;
17
18pub use embedded_cert::*;
19
20pub use misc::KeywordOrString;
21pub use misc::RetainedOrderVec;
22pub use misc::{ContactInfo, InvalidNickname, Nickname, NotPresent, NumericBoolean, Unknown};
23pub use misc::{Hostname, InternetHost, InvalidHostname, InvalidInternetHost};
24
25pub use misc::RsaSha1Signature;
26pub use misc::{B16, B16U, B64, FixedB16U, FixedB64};
27pub use misc::{Base64Fingerprint, Fingerprint, Ignored, IgnoredItemOrObjectValue, SpFingerprint};
28pub use misc::{Curve25519Public, Ed25519AlgorithmString, Ed25519IdentityLine, Ed25519Public};
29pub use misc::{DigestName, IdentifiedDigest};
30pub use misc::{Iso8601TimeNoSp, Iso8601TimeSp};
31
32pub use misc::routerdesc;
33
34mod parse2_encode;
35pub use parse2_encode::raw_data_object;
36
37use crate::NormalItemArgument;
38
39/// We do not expect `[ ]` around IPv6 addresses when parsing this type
40impl NormalItemArgument for std::net::IpAddr {}
41impl NormalItemArgument for std::net::Ipv4Addr {}
42impl NormalItemArgument for std::net::SocketAddr {}
43impl NormalItemArgument for std::net::SocketAddrV4 {}