ExtraInfoDescriptor

Struct ExtraInfoDescriptor 

Source
pub struct ExtraInfoDescriptor {
Show 66 fields pub nickname: String, pub fingerprint: String, pub published: DateTime<Utc>, pub geoip_db_digest: Option<String>, pub geoip6_db_digest: Option<String>, pub transports: HashMap<String, Transport>, pub read_history: Option<BandwidthHistory>, pub write_history: Option<BandwidthHistory>, pub dir_read_history: Option<BandwidthHistory>, pub dir_write_history: Option<BandwidthHistory>, pub conn_bi_direct_end: Option<DateTime<Utc>>, pub conn_bi_direct_interval: Option<u32>, pub conn_bi_direct_below: Option<u32>, pub conn_bi_direct_read: Option<u32>, pub conn_bi_direct_write: Option<u32>, pub conn_bi_direct_both: Option<u32>, pub cell_stats_end: Option<DateTime<Utc>>, pub cell_stats_interval: Option<u32>, pub cell_processed_cells: Vec<f64>, pub cell_queued_cells: Vec<f64>, pub cell_time_in_queue: Vec<f64>, pub cell_circuits_per_decile: Option<u32>, pub dir_stats_end: Option<DateTime<Utc>>, pub dir_stats_interval: Option<u32>, pub dir_v3_ips: HashMap<String, u32>, pub dir_v3_requests: HashMap<String, u32>, pub dir_v3_responses: HashMap<DirResponse, u32>, pub dir_v3_responses_unknown: HashMap<String, u32>, pub dir_v3_direct_dl: HashMap<DirStat, u32>, pub dir_v3_direct_dl_unknown: HashMap<String, u32>, pub dir_v3_tunneled_dl: HashMap<DirStat, u32>, pub dir_v3_tunneled_dl_unknown: HashMap<String, u32>, pub dir_v2_ips: HashMap<String, u32>, pub dir_v2_requests: HashMap<String, u32>, pub dir_v2_responses: HashMap<DirResponse, u32>, pub dir_v2_responses_unknown: HashMap<String, u32>, pub dir_v2_direct_dl: HashMap<DirStat, u32>, pub dir_v2_direct_dl_unknown: HashMap<String, u32>, pub dir_v2_tunneled_dl: HashMap<DirStat, u32>, pub dir_v2_tunneled_dl_unknown: HashMap<String, u32>, pub entry_stats_end: Option<DateTime<Utc>>, pub entry_stats_interval: Option<u32>, pub entry_ips: HashMap<String, u32>, pub exit_stats_end: Option<DateTime<Utc>>, pub exit_stats_interval: Option<u32>, pub exit_kibibytes_written: HashMap<PortKey, u64>, pub exit_kibibytes_read: HashMap<PortKey, u64>, pub exit_streams_opened: HashMap<PortKey, u64>, pub bridge_stats_end: Option<DateTime<Utc>>, pub bridge_stats_interval: Option<u32>, pub bridge_ips: HashMap<String, u32>, pub ip_versions: HashMap<String, u32>, pub ip_transports: HashMap<String, u32>, pub hs_stats_end: Option<DateTime<Utc>>, pub hs_rend_cells: Option<u64>, pub hs_rend_cells_attr: HashMap<String, String>, pub hs_dir_onions_seen: Option<u64>, pub hs_dir_onions_seen_attr: HashMap<String, String>, pub padding_counts_end: Option<DateTime<Utc>>, pub padding_counts_interval: Option<u32>, pub padding_counts: HashMap<String, String>, pub ed25519_certificate: Option<String>, pub ed25519_signature: Option<String>, pub signature: Option<String>, pub router_digest: Option<String>, pub router_digest_sha256: Option<String>, /* private fields */
}
Expand description

Extra-info descriptor containing relay statistics and metadata.

Extra-info descriptors are published alongside server descriptors and contain detailed statistics about relay operation. They are not required for Tor clients to function but provide valuable metrics for network analysis.

§Overview

The descriptor contains several categories of information:

  • Identity - Nickname, fingerprint, publication time
  • Bandwidth history - Read/write traffic over time
  • Directory statistics - Request counts and download speeds
  • Cell statistics - Circuit cell processing metrics
  • Exit statistics - Traffic per destination port
  • Bridge statistics - Client connection data
  • Hidden service statistics - Onion service activity
  • Cryptographic data - Ed25519 certificates and signatures

§Relay vs Bridge

Use is_bridge() to distinguish between relay and bridge extra-info descriptors:

  • Relay: Has router-signature line with RSA signature
  • Bridge: Has router-digest line instead of signature

§Example

use stem_rs::descriptor::extra_info::ExtraInfoDescriptor;
use stem_rs::descriptor::Descriptor;

let content = r#"extra-info MyRelay B2289C3EAB83ECD6EB916A2F481A02E6B76A0A48
published 2024-01-15 12:00:00
write-history 2024-01-15 12:00:00 (900 s) 1000000,2000000
read-history 2024-01-15 12:00:00 (900 s) 500000,1000000
"#;

let desc = ExtraInfoDescriptor::parse(content).unwrap();

// Check identity
assert_eq!(desc.nickname, "MyRelay");
assert_eq!(desc.fingerprint.len(), 40);

// Check bandwidth history
if let Some(ref history) = desc.write_history {
    println!("Write interval: {} seconds", history.interval);
    println!("Values: {:?}", history.values);
}

§Statistics Fields

§Bandwidth History

  • read_history / write_history - Relay traffic
  • dir_read_history / dir_write_history - Directory traffic

§Directory Statistics

  • dir_v3_ips / dir_v3_requests - Client counts by country
  • dir_v3_responses - Response status counts
  • dir_v3_direct_dl / dir_v3_tunneled_dl - Download speed stats

§Exit Statistics

  • exit_kibibytes_written / exit_kibibytes_read - Traffic per port
  • exit_streams_opened - Connection counts per port

§Bridge Statistics

  • bridge_ips - Client counts by country
  • ip_versions - IPv4 vs IPv6 client counts
  • ip_transports - Pluggable transport usage

§Thread Safety

ExtraInfoDescriptor is Send and Sync, making it safe to share across threads.

§See Also

Fields§

§nickname: String

The relay’s nickname (1-19 alphanumeric characters).

§fingerprint: String

The relay’s identity fingerprint (40 uppercase hex characters).

This is the SHA-1 hash of the relay’s identity key.

§published: DateTime<Utc>

When this descriptor was published (UTC).

§geoip_db_digest: Option<String>

SHA-1 digest of the GeoIP database for IPv4 addresses.

§geoip6_db_digest: Option<String>

SHA-1 digest of the GeoIP database for IPv6 addresses.

§transports: HashMap<String, Transport>

Pluggable transports available on this relay (bridges only).

Maps transport name to transport details.

§read_history: Option<BandwidthHistory>

Bytes read by the relay over time.

§write_history: Option<BandwidthHistory>

Bytes written by the relay over time.

§dir_read_history: Option<BandwidthHistory>

Bytes read for directory requests over time.

§dir_write_history: Option<BandwidthHistory>

Bytes written for directory requests over time.

§conn_bi_direct_end: Option<DateTime<Utc>>

End time for bi-directional connection statistics.

§conn_bi_direct_interval: Option<u32>

Interval for bi-directional connection statistics (seconds).

§conn_bi_direct_below: Option<u32>

Connections that read/wrote less than 20 KiB.

§conn_bi_direct_read: Option<u32>

Connections that read at least 10x more than wrote.

§conn_bi_direct_write: Option<u32>

Connections that wrote at least 10x more than read.

§conn_bi_direct_both: Option<u32>

Connections with balanced read/write (remaining).

§cell_stats_end: Option<DateTime<Utc>>

End time for cell statistics collection.

§cell_stats_interval: Option<u32>

Interval for cell statistics (seconds).

§cell_processed_cells: Vec<f64>

Mean processed cells per circuit, by decile.

§cell_queued_cells: Vec<f64>

Mean queued cells per circuit, by decile.

§cell_time_in_queue: Vec<f64>

Mean time cells spent in queue (milliseconds), by decile.

§cell_circuits_per_decile: Option<u32>

Mean number of circuits in a decile.

§dir_stats_end: Option<DateTime<Utc>>

End time for directory statistics collection.

§dir_stats_interval: Option<u32>

Interval for directory statistics (seconds).

§dir_v3_ips: HashMap<String, u32>

V3 directory request client IPs by country code.

§dir_v3_requests: HashMap<String, u32>

V3 directory request counts by country code.

§dir_v3_responses: HashMap<DirResponse, u32>

V3 directory response status counts.

§dir_v3_responses_unknown: HashMap<String, u32>

Unrecognized V3 directory response statuses.

§dir_v3_direct_dl: HashMap<DirStat, u32>

V3 direct download statistics (via DirPort).

§dir_v3_direct_dl_unknown: HashMap<String, u32>

Unrecognized V3 direct download statistics.

§dir_v3_tunneled_dl: HashMap<DirStat, u32>

V3 tunneled download statistics (via ORPort).

§dir_v3_tunneled_dl_unknown: HashMap<String, u32>

Unrecognized V3 tunneled download statistics.

§dir_v2_ips: HashMap<String, u32>

V2 directory request client IPs by country code (deprecated).

§dir_v2_requests: HashMap<String, u32>

V2 directory request counts by country code (deprecated).

§dir_v2_responses: HashMap<DirResponse, u32>

V2 directory response status counts (deprecated).

§dir_v2_responses_unknown: HashMap<String, u32>

Unrecognized V2 directory response statuses (deprecated).

§dir_v2_direct_dl: HashMap<DirStat, u32>

V2 direct download statistics (deprecated).

§dir_v2_direct_dl_unknown: HashMap<String, u32>

Unrecognized V2 direct download statistics (deprecated).

§dir_v2_tunneled_dl: HashMap<DirStat, u32>

V2 tunneled download statistics (deprecated).

§dir_v2_tunneled_dl_unknown: HashMap<String, u32>

Unrecognized V2 tunneled download statistics (deprecated).

§entry_stats_end: Option<DateTime<Utc>>

End time for entry guard statistics.

§entry_stats_interval: Option<u32>

Interval for entry guard statistics (seconds).

§entry_ips: HashMap<String, u32>

Entry guard client IPs by country code.

§exit_stats_end: Option<DateTime<Utc>>

End time for exit statistics.

§exit_stats_interval: Option<u32>

Interval for exit statistics (seconds).

§exit_kibibytes_written: HashMap<PortKey, u64>

Kibibytes written per destination port.

§exit_kibibytes_read: HashMap<PortKey, u64>

Kibibytes read per destination port.

§exit_streams_opened: HashMap<PortKey, u64>

Streams opened per destination port.

§bridge_stats_end: Option<DateTime<Utc>>

End time for bridge statistics.

§bridge_stats_interval: Option<u32>

Interval for bridge statistics (seconds).

§bridge_ips: HashMap<String, u32>

Bridge client IPs by country code.

§ip_versions: HashMap<String, u32>

Bridge client counts by IP version (v4, v6).

§ip_transports: HashMap<String, u32>

Bridge client counts by transport method.

§hs_stats_end: Option<DateTime<Utc>>

End time for hidden service statistics.

§hs_rend_cells: Option<u64>

Rounded count of RENDEZVOUS1 cells relayed.

§hs_rend_cells_attr: HashMap<String, String>

Additional attributes for hs_rend_cells.

§hs_dir_onions_seen: Option<u64>

Rounded count of unique onion service identities seen.

§hs_dir_onions_seen_attr: HashMap<String, String>

Additional attributes for hs_dir_onions_seen.

§padding_counts_end: Option<DateTime<Utc>>

End time for padding count statistics.

§padding_counts_interval: Option<u32>

Interval for padding count statistics (seconds).

§padding_counts: HashMap<String, String>

Padding-related statistics.

§ed25519_certificate: Option<String>

Ed25519 certificate (PEM-encoded).

§ed25519_signature: Option<String>

Ed25519 signature of the descriptor.

§signature: Option<String>

RSA signature of the descriptor (relay extra-info only).

§router_digest: Option<String>

Router digest for bridge extra-info descriptors.

Present only in bridge descriptors; indicates this is a bridge.

§router_digest_sha256: Option<String>

SHA-256 router digest (base64).

Implementations§

Source§

impl ExtraInfoDescriptor

Source

pub fn is_bridge(&self) -> bool

Returns whether this is a bridge extra-info descriptor.

Bridge descriptors have a router-digest line instead of a router-signature line.

§Example
use stem_rs::descriptor::extra_info::ExtraInfoDescriptor;
use stem_rs::descriptor::Descriptor;

let relay_content = r#"extra-info relay B2289C3EAB83ECD6EB916A2F481A02E6B76A0A48
published 2024-01-15 12:00:00
"#;

let bridge_content = r#"extra-info bridge B2289C3EAB83ECD6EB916A2F481A02E6B76A0A48
published 2024-01-15 12:00:00
router-digest 00A2AECCEAD3FEE033CFE29893387143146728EC
"#;

let relay = ExtraInfoDescriptor::parse(relay_content).unwrap();
let bridge = ExtraInfoDescriptor::parse(bridge_content).unwrap();

assert!(!relay.is_bridge());
assert!(bridge.is_bridge());

Trait Implementations§

Source§

impl Clone for ExtraInfoDescriptor

Source§

fn clone(&self) -> ExtraInfoDescriptor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExtraInfoDescriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ExtraInfoDescriptor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Descriptor for ExtraInfoDescriptor

Source§

fn parse(content: &str) -> Result<Self, Error>

Parses a descriptor from its string content. Read more
Source§

fn to_descriptor_string(&self) -> String

Serializes the descriptor to its canonical string format. Read more
Source§

fn digest( &self, hash: DigestHash, encoding: DigestEncoding, ) -> Result<String, Error>

Computes the cryptographic digest of the descriptor. Read more
Source§

fn raw_content(&self) -> &[u8]

Returns the raw bytes of the original descriptor content. Read more
Source§

fn unrecognized_lines(&self) -> &[String]

Returns lines from the descriptor that were not recognized. Read more
Source§

impl Display for ExtraInfoDescriptor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for ExtraInfoDescriptor

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for ExtraInfoDescriptor

Source§

fn eq(&self, other: &ExtraInfoDescriptor) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ExtraInfoDescriptor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.