Struct tor_netdoc::doc::microdesc::MicrodescBuilder
source · [−]pub struct MicrodescBuilder { /* private fields */ }
Expand description
A builder object used to construct a microdescriptor.
Create one of these with the Microdesc::builder
method.
This facility is only enabled when the crate is built with
the build_docs
feature.
Implementations
sourceimpl MicrodescBuilder
impl MicrodescBuilder
sourcepub fn ntor_key(&mut self, key: PublicKey) -> &mut Self
pub fn ntor_key(&mut self, key: PublicKey) -> &mut Self
Set the ntor onion key.
This key is required for a well-formed microdescriptor.
sourcepub fn ed25519_id(&mut self, key: Ed25519Identity) -> &mut Self
pub fn ed25519_id(&mut self, key: Ed25519Identity) -> &mut Self
Set the ed25519 identity key.
This key is required for a well-formed microdescriptor.
sourcepub fn family(&mut self, family: RelayFamily) -> &mut Self
pub fn family(&mut self, family: RelayFamily) -> &mut Self
Set the family of this relay.
By default, this family is empty.
sourcepub fn ipv4_policy(&mut self, policy: PortPolicy) -> &mut Self
pub fn ipv4_policy(&mut self, policy: PortPolicy) -> &mut Self
Set the ipv4 exit policy of this relay.
By default, this policy is reject 1-65535
.
sourcepub fn ipv6_policy(&mut self, policy: PortPolicy) -> &mut Self
pub fn ipv6_policy(&mut self, policy: PortPolicy) -> &mut Self
Set the ipv6 exit policy of this relay.
By default, this policy is reject 1-65535
.
sourcepub fn parse_family(&mut self, family: &str) -> Result<&mut Self>
pub fn parse_family(&mut self, family: &str) -> Result<&mut Self>
Set the family of this relay based on parsing a string.
sourcepub fn parse_ipv4_policy(&mut self, policy: &str) -> Result<&mut Self>
pub fn parse_ipv4_policy(&mut self, policy: &str) -> Result<&mut Self>
Set the ipv4 exit policy of this relay based on parsing a string.
By default, this policy is reject 1-65535
.
sourcepub fn parse_ipv6_policy(&mut self, policy: &str) -> Result<&mut Self>
pub fn parse_ipv6_policy(&mut self, policy: &str) -> Result<&mut Self>
Set the ipv6 exit policy of this relay based on parsing a string.
By default, this policy is reject 1-65535
.
sourcepub fn testing_md(&self) -> Result<Microdesc>
pub fn testing_md(&self) -> Result<Microdesc>
Try to build a microdescriptor from the settings on this builder.
Give an error if any required fields are not set.
Limitations
This is only for testing, since it does actually encode the information in a string, and since it sets the sha256 digest field at random.
In the future, when we have authority support, we’ll need an encoder function instead.
Trait Implementations
sourceimpl Clone for MicrodescBuilder
impl Clone for MicrodescBuilder
sourcefn clone(&self) -> MicrodescBuilder
fn clone(&self) -> MicrodescBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for MicrodescBuilder
impl Send for MicrodescBuilder
impl Sync for MicrodescBuilder
impl Unpin for MicrodescBuilder
impl UnwindSafe for MicrodescBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more