MicrodescriptorBuilder

Struct MicrodescriptorBuilder 

Source
pub struct MicrodescriptorBuilder { /* private fields */ }
Expand description

Builder for Microdescriptor.

Implementations§

Source§

impl MicrodescriptorBuilder

Source

pub fn onion_key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

RSA onion key for TAP circuit handshake (PEM format).

This is the legacy key used for the original Tor handshake. Modern clients prefer the ntor handshake using ntor_onion_key.

Source

pub fn ntor_onion_key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

Curve25519 onion key for ntor circuit handshake (base64).

This is the modern key used for the ntor handshake, which provides better security properties than the TAP handshake.

Source

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). The a lines in the microdescriptor provide these additional addresses.

Source

pub fn family<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self

Fingerprints of related relays (same operator).

These are typically prefixed with $ and contain the full 40-character hex fingerprint.

Source

pub fn exit_policy<VALUE: Into<MicroExitPolicy>>( &mut self, value: VALUE, ) -> &mut Self

Compact IPv4 exit policy.

Unlike full exit policies, microdescriptor policies only specify which ports are accepted or rejected, not addresses.

Source

pub fn exit_policy_v6<VALUE: Into<MicroExitPolicy>>( &mut self, value: VALUE, ) -> &mut Self

Compact IPv6 exit policy.

Separate policy for IPv6 traffic, if different from IPv4.

Source

pub fn identifiers<VALUE: Into<HashMap<String, String>>>( &mut self, value: VALUE, ) -> &mut Self

Identity key digests by type.

Maps key type (e.g., “rsa1024”, “ed25519”) to the base64-encoded digest of that key.

Source

pub fn protocols<VALUE: Into<HashMap<String, Vec<u32>>>>( &mut self, value: VALUE, ) -> &mut Self

Supported protocol versions.

Maps protocol name to list of supported versions. Common protocols include “Link”, “Relay”, “HSDir”, etc.

Source

pub fn raw_content<VALUE: Into<Vec<u8>>>(&mut self, value: VALUE) -> &mut Self

Raw bytes of the original descriptor content.

Source

pub fn annotations<VALUE: Into<Vec<(String, Option<String>)>>>( &mut self, value: VALUE, ) -> &mut Self

Annotations from CollecTor archives.

Each annotation is a (key, optional_value) pair from lines starting with @.

Source

pub fn unrecognized_lines<VALUE: Into<Vec<String>>>( &mut self, value: VALUE, ) -> &mut Self

Lines that were not recognized during parsing.

Source

pub fn build(&self) -> Result<Microdescriptor, MicrodescriptorBuilderError>

Builds a new Microdescriptor.

§Errors

If a required field has not been initialized.

Trait Implementations§

Source§

impl Clone for MicrodescriptorBuilder

Source§

fn clone(&self) -> MicrodescriptorBuilder

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 Default for MicrodescriptorBuilder

Source§

fn default() -> Self

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

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, 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V