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 mod descriptor;
12pub(crate) mod embedded_cert;
13pub mod family;
14pub(crate) mod misc;
15pub mod policy;
16pub mod relay_flags;
17pub mod version;
18
19pub use embedded_cert::*;
20
21pub use misc::{Ed25519FamilyCert, Ed25519IdentityCert, Ed25519NtorCrossCert};
22
23pub use misc::KeywordOrString;
24pub use misc::RetainedOrderVec;
25pub use misc::{
26    ContactInfo, InvalidNickname, Nickname, NoMoreArguments, NotPresent, NumericBoolean, Unknown,
27};
28pub use misc::{Hostname, InternetHost, InvalidHostname, InvalidInternetHost};
29
30pub use misc::InvalidContactInfo;
31pub use misc::NotPresentEachValue;
32pub use misc::RsaSha1Signature;
33pub use misc::{B16, B16U, B64, FixedB16U, FixedB64};
34pub use misc::{
35    Base64Fingerprint, Fingerprint, Ignored, IgnoredItemOrObjectValue, ItemPresent, SpFingerprint,
36};
37pub use misc::{Curve25519Public, Ed25519AlgorithmString, Ed25519IdentityLine, Ed25519Public};
38pub use misc::{DigestName, IdentifiedDigest};
39pub use misc::{F64Finite, F64FiniteParseError};
40pub use misc::{Iso8601TimeNoSp, Iso8601TimeSp};
41
42mod parse2_encode;
43pub use parse2_encode::raw_data_object;
44
45use crate::NormalItemArgument;
46
47/// We do not expect `[ ]` around IPv6 addresses when parsing this type
48impl NormalItemArgument for std::net::IpAddr {}
49impl NormalItemArgument for std::net::Ipv4Addr {}
50impl NormalItemArgument for std::net::SocketAddr {}
51impl NormalItemArgument for std::net::SocketAddrV4 {}