pub enum DescriptorType {
Show 13 variants
ServerDescriptor,
ExtraInfo,
Microdescriptor,
NetworkStatusConsensusV3,
NetworkStatusVoteV3,
NetworkStatusMicrodescConsensusV3,
BridgeNetworkStatus,
BridgeServerDescriptor,
BridgeExtraInfo,
DirKeyCertificateV3,
TorDNSEL,
HiddenServiceDescriptor,
BandwidthFile,
}Expand description
Known descriptor types in the Tor network.
This enum represents all descriptor types that can be identified from type annotations or filenames. Each variant corresponds to a specific descriptor format defined in the Tor directory protocol specification.
§Stability
This enum is non-exhaustive. New descriptor types may be added in future Tor versions.
§Example
use stem_rs::descriptor::{DescriptorType, TypeAnnotation};
// From type annotation
let annotation = TypeAnnotation::new("server-descriptor", 1, 0);
let desc_type = DescriptorType::from_annotation(&annotation);
assert_eq!(desc_type, Some(DescriptorType::ServerDescriptor));
// From filename
let desc_type = DescriptorType::from_filename("cached-consensus");
assert_eq!(desc_type, Some(DescriptorType::NetworkStatusConsensusV3));Variants§
ServerDescriptor
Server descriptor containing full relay metadata.
Includes identity keys, exit policy, bandwidth, and other relay information.
Annotation name: server-descriptor
ExtraInfo
Extra-info descriptor with bandwidth statistics.
Contains detailed statistics about relay operation.
Annotation name: extra-info
Microdescriptor
Microdescriptor with compact routing information.
Used by clients for building circuits with minimal data.
Annotation name: microdescriptor
NetworkStatusConsensusV3
Network status consensus document (v3).
The agreed-upon view of the network signed by directory authorities.
Annotation name: network-status-consensus-3
NetworkStatusVoteV3
Network status vote document (v3).
Individual directory authority’s view before consensus.
Annotation name: network-status-vote-3
NetworkStatusMicrodescConsensusV3
Microdescriptor-flavored consensus document (v3).
Consensus using microdescriptor hashes instead of full descriptors.
Annotation name: network-status-microdesc-consensus-3
BridgeNetworkStatus
Bridge network status document.
Network status for bridge relays (not publicly listed).
Annotation name: bridge-network-status
BridgeServerDescriptor
Bridge server descriptor.
Server descriptor for bridge relays with some fields redacted.
Annotation name: bridge-server-descriptor
BridgeExtraInfo
Bridge extra-info descriptor.
Extra-info for bridge relays.
Annotation name: bridge-extra-info
DirKeyCertificateV3
Directory key certificate (v3).
Certificate binding a directory authority’s signing key to its identity.
Annotation name: dir-key-certificate-3
TorDNSEL
TorDNSEL exit list.
List of exit relay IP addresses from the TorDNSEL service.
Annotation name: tordnsel
HiddenServiceDescriptor
Hidden service descriptor.
Descriptor for onion services (v2 or v3).
Annotation name: hidden-service-descriptor
BandwidthFile
Bandwidth authority measurement file.
Bandwidth measurements from bandwidth authorities.
Annotation name: bandwidth-file
Implementations§
Source§impl DescriptorType
impl DescriptorType
Sourcepub fn annotation_name(&self) -> &'static str
pub fn annotation_name(&self) -> &'static str
Returns the annotation name for this descriptor type.
This is the name used in @type annotations in CollecTor archives.
§Example
use stem_rs::descriptor::DescriptorType;
assert_eq!(DescriptorType::ServerDescriptor.annotation_name(), "server-descriptor");
assert_eq!(DescriptorType::Microdescriptor.annotation_name(), "microdescriptor");Sourcepub fn from_annotation(annotation: &TypeAnnotation) -> Option<Self>
pub fn from_annotation(annotation: &TypeAnnotation) -> Option<Self>
Determines the descriptor type from a type annotation.
Returns None if the annotation name is not recognized.
§Arguments
annotation- The type annotation to match
§Example
use stem_rs::descriptor::{DescriptorType, TypeAnnotation};
let annotation = TypeAnnotation::new("extra-info", 1, 0);
assert_eq!(
DescriptorType::from_annotation(&annotation),
Some(DescriptorType::ExtraInfo)
);
let unknown = TypeAnnotation::new("unknown-type", 1, 0);
assert_eq!(DescriptorType::from_annotation(&unknown), None);Sourcepub fn from_filename(filename: &str) -> Option<Self>
pub fn from_filename(filename: &str) -> Option<Self>
Determines the descriptor type from a filename.
This is useful for parsing descriptors from Tor’s data directory
where files have conventional names like cached-descriptors or
cached-consensus.
Returns None if the filename doesn’t match a known pattern.
§Arguments
filename- The filename to match (path components are stripped)
§Example
use stem_rs::descriptor::DescriptorType;
assert_eq!(
DescriptorType::from_filename("cached-descriptors"),
Some(DescriptorType::ServerDescriptor)
);
assert_eq!(
DescriptorType::from_filename("cached-extrainfo"),
Some(DescriptorType::ExtraInfo)
);
assert_eq!(
DescriptorType::from_filename("/var/lib/tor/cached-consensus"),
Some(DescriptorType::NetworkStatusConsensusV3)
);
assert_eq!(DescriptorType::from_filename("unknown-file"), None);Trait Implementations§
Source§impl Clone for DescriptorType
impl Clone for DescriptorType
Source§fn clone(&self) -> DescriptorType
fn clone(&self) -> DescriptorType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more