pub struct ServerDescriptorBuilder { /* private fields */ }Expand description
Builder for ServerDescriptor.
Implementations§
Source§impl ServerDescriptorBuilder
impl ServerDescriptorBuilder
Sourcepub fn nickname<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn nickname<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The relay’s nickname (1-19 alphanumeric characters).
Sourcepub fn fingerprint<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn fingerprint<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The relay’s fingerprint (40 hex characters), derived from identity key.
Sourcepub fn address<VALUE: Into<IpAddr>>(&mut self, value: VALUE) -> &mut Self
pub fn address<VALUE: Into<IpAddr>>(&mut self, value: VALUE) -> &mut Self
The relay’s primary IPv4 address.
Sourcepub fn or_port<VALUE: Into<u16>>(&mut self, value: VALUE) -> &mut Self
pub fn or_port<VALUE: Into<u16>>(&mut self, value: VALUE) -> &mut Self
The relay’s onion routing port (always non-zero).
Sourcepub fn socks_port<VALUE: Into<u16>>(&mut self, value: VALUE) -> &mut Self
pub fn socks_port<VALUE: Into<u16>>(&mut self, value: VALUE) -> &mut Self
The relay’s SOCKS port (deprecated, usually None).
Sourcepub fn dir_port<VALUE: Into<u16>>(&mut self, value: VALUE) -> &mut Self
pub fn dir_port<VALUE: Into<u16>>(&mut self, value: VALUE) -> &mut Self
The relay’s directory port for serving cached descriptors.
Sourcepub fn or_addresses<VALUE: Into<Vec<(IpAddr, u16, bool)>>>( &mut self, value: VALUE, ) -> &mut Self
pub fn or_addresses<VALUE: Into<Vec<(IpAddr, u16, bool)>>>( &mut self, value: VALUE, ) -> &mut Self
Additional addresses (IPv4 or IPv6) the relay listens on. Each tuple is (address, port, is_ipv6).
Sourcepub fn platform<VALUE: Into<Vec<u8>>>(&mut self, value: VALUE) -> &mut Self
pub fn platform<VALUE: Into<Vec<u8>>>(&mut self, value: VALUE) -> &mut Self
Raw platform string (e.g., “Tor 0.4.7.10 on Linux”).
Sourcepub fn tor_version<VALUE: Into<Version>>(&mut self, value: VALUE) -> &mut Self
pub fn tor_version<VALUE: Into<Version>>(&mut self, value: VALUE) -> &mut Self
Parsed Tor version from the platform string.
Sourcepub fn operating_system<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn operating_system<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
Operating system from the platform string.
Sourcepub fn published<VALUE: Into<DateTime<Utc>>>( &mut self, value: VALUE, ) -> &mut Self
pub fn published<VALUE: Into<DateTime<Utc>>>( &mut self, value: VALUE, ) -> &mut Self
When this descriptor was published (UTC).
Sourcepub fn uptime<VALUE: Into<u64>>(&mut self, value: VALUE) -> &mut Self
pub fn uptime<VALUE: Into<u64>>(&mut self, value: VALUE) -> &mut Self
Seconds the relay has been running.
Sourcepub fn contact<VALUE: Into<Vec<u8>>>(&mut self, value: VALUE) -> &mut Self
pub fn contact<VALUE: Into<Vec<u8>>>(&mut self, value: VALUE) -> &mut Self
Contact information for the relay operator.
Sourcepub fn link_protocols<VALUE: Into<Vec<String>>>( &mut self, value: VALUE, ) -> &mut Self
pub fn link_protocols<VALUE: Into<Vec<String>>>( &mut self, value: VALUE, ) -> &mut Self
Supported link protocol versions (legacy).
Sourcepub fn circuit_protocols<VALUE: Into<Vec<String>>>( &mut self, value: VALUE, ) -> &mut Self
pub fn circuit_protocols<VALUE: Into<Vec<String>>>( &mut self, value: VALUE, ) -> &mut Self
Supported circuit protocol versions (legacy).
Sourcepub fn bandwidth_avg<VALUE: Into<u64>>(&mut self, value: VALUE) -> &mut Self
pub fn bandwidth_avg<VALUE: Into<u64>>(&mut self, value: VALUE) -> &mut Self
Average bandwidth in bytes per second the relay is willing to sustain.
Sourcepub fn bandwidth_burst<VALUE: Into<u64>>(&mut self, value: VALUE) -> &mut Self
pub fn bandwidth_burst<VALUE: Into<u64>>(&mut self, value: VALUE) -> &mut Self
Maximum bandwidth in bytes per second for short bursts.
Sourcepub fn bandwidth_observed<VALUE: Into<u64>>( &mut self, value: VALUE, ) -> &mut Self
pub fn bandwidth_observed<VALUE: Into<u64>>( &mut self, value: VALUE, ) -> &mut Self
Bandwidth in bytes per second the relay has actually observed.
Sourcepub fn exit_policy<VALUE: Into<ExitPolicy>>( &mut self, value: VALUE, ) -> &mut Self
pub fn exit_policy<VALUE: Into<ExitPolicy>>( &mut self, value: VALUE, ) -> &mut Self
The relay’s exit policy (rules for what traffic it will exit).
Sourcepub fn exit_policy_v6<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn exit_policy_v6<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
IPv6 exit policy summary (e.g., “accept 80,443” or “reject 1-65535”).
Sourcepub fn bridge_distribution<VALUE: Into<BridgeDistribution>>( &mut self, value: VALUE, ) -> &mut Self
pub fn bridge_distribution<VALUE: Into<BridgeDistribution>>( &mut self, value: VALUE, ) -> &mut Self
How this bridge wants to be distributed (bridges only).
Sourcepub fn family<VALUE: Into<HashSet<String>>>( &mut self, value: VALUE, ) -> &mut Self
pub fn family<VALUE: Into<HashSet<String>>>( &mut self, value: VALUE, ) -> &mut Self
Fingerprints of related relays (same operator).
Sourcepub fn hibernating<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn hibernating<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
Whether the relay is currently hibernating (reduced service).
Sourcepub fn allow_single_hop_exits<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self
pub fn allow_single_hop_exits<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self
Whether the relay allows single-hop exits (security risk).
Sourcepub fn allow_tunneled_dir_requests<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self
pub fn allow_tunneled_dir_requests<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self
Whether the relay accepts tunneled directory requests.
Sourcepub fn extra_info_cache<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn extra_info_cache<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
Whether the relay caches extra-info descriptors.
Sourcepub fn extra_info_digest<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn extra_info_digest<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
SHA-1 digest of the relay’s extra-info descriptor.
Sourcepub fn extra_info_sha256_digest<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn extra_info_sha256_digest<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
SHA-256 digest of the relay’s extra-info descriptor.
Whether the relay serves as a hidden service directory.
Sourcepub fn protocols<VALUE: Into<HashMap<String, Vec<u32>>>>( &mut self, value: VALUE, ) -> &mut Self
pub fn protocols<VALUE: Into<HashMap<String, Vec<u32>>>>( &mut self, value: VALUE, ) -> &mut Self
Supported protocol versions (modern format). Maps protocol name to list of supported versions.
Sourcepub fn onion_key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn onion_key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
RSA onion key for circuit creation (PEM format).
Sourcepub fn onion_key_crosscert<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn onion_key_crosscert<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
Cross-certification of onion key by identity key.
Sourcepub fn ntor_onion_key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn ntor_onion_key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
Curve25519 onion key for ntor handshake (base64).
Sourcepub fn ntor_onion_key_crosscert<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn ntor_onion_key_crosscert<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
Cross-certification of ntor key.
Sourcepub fn ntor_onion_key_crosscert_sign<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn ntor_onion_key_crosscert_sign<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
Sign bit for ntor key cross-certification.
Sourcepub fn signing_key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn signing_key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
RSA signing key (PEM format).
Sourcepub fn ed25519_certificate<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn ed25519_certificate<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
Ed25519 identity certificate (PEM format).
Sourcepub fn ed25519_master_key<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn ed25519_master_key<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
Ed25519 master key (base64).
Sourcepub fn ed25519_signature<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
pub fn ed25519_signature<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
Ed25519 signature over the descriptor.
Sourcepub fn signature<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn signature<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
RSA signature over the descriptor (PEM format).
Sourcepub fn raw_content<VALUE: Into<Vec<u8>>>(&mut self, value: VALUE) -> &mut Self
pub fn raw_content<VALUE: Into<Vec<u8>>>(&mut self, value: VALUE) -> &mut Self
Raw bytes of the original descriptor content.
Sourcepub fn unrecognized_lines<VALUE: Into<Vec<String>>>( &mut self, value: VALUE, ) -> &mut Self
pub fn unrecognized_lines<VALUE: Into<Vec<String>>>( &mut self, value: VALUE, ) -> &mut Self
Lines that were not recognized during parsing.
Sourcepub fn build(&self) -> Result<ServerDescriptor, ServerDescriptorBuilderError>
pub fn build(&self) -> Result<ServerDescriptor, ServerDescriptorBuilderError>
Trait Implementations§
Source§impl Clone for ServerDescriptorBuilder
impl Clone for ServerDescriptorBuilder
Source§fn clone(&self) -> ServerDescriptorBuilder
fn clone(&self) -> ServerDescriptorBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more