Struct tor_netdoc::doc::netstatus::RouterStatusBuilder
source · pub struct RouterStatusBuilder<D> { /* private fields */ }
build_docs
only.Expand description
A Builder object for creating a RouterStatus and adding it to a consensus.
Implementations§
source§impl<D: Clone> RouterStatusBuilder<D>
impl<D: Clone> RouterStatusBuilder<D>
sourcepub fn nickname(&mut self, nickname: String) -> &mut Self
pub fn nickname(&mut self, nickname: String) -> &mut Self
Set the nickname for this routerstatus.
This value defaults to “Unnamed”.
sourcepub fn identity(&mut self, identity: RsaIdentity) -> &mut Self
pub fn identity(&mut self, identity: RsaIdentity) -> &mut Self
Set the RSA identity for this routerstatus.
(The Ed25519 identity is in the microdescriptor).
This value is required.
sourcepub fn add_or_port(&mut self, addr: SocketAddr) -> &mut Self
pub fn add_or_port(&mut self, addr: SocketAddr) -> &mut Self
Add an OrPort at addr
to this routerstatus.
At least one value here is required.
sourcepub fn doc_digest(&mut self, doc_digest: D) -> &mut Self
pub fn doc_digest(&mut self, doc_digest: D) -> &mut Self
Set the document digest for this routerstatus.
This value is required.
sourcepub fn set_flags(&mut self, flags: RelayFlags) -> &mut Self
pub fn set_flags(&mut self, flags: RelayFlags) -> &mut Self
Replace the current flags in this routerstatus with flags
.
sourcepub fn add_flags(&mut self, flags: RelayFlags) -> &mut Self
pub fn add_flags(&mut self, flags: RelayFlags) -> &mut Self
Make all the flags in flags
become set on this routerstatus,
in addition to the flags already set.
sourcepub fn version(&mut self, version: String) -> &mut Self
pub fn version(&mut self, version: String) -> &mut Self
Set the version of the relay described in this routerstatus.
This value is optional.
sourcepub fn protos(&mut self, protos: Protocols) -> &mut Self
pub fn protos(&mut self, protos: Protocols) -> &mut Self
Set the list of subprotocols supported by the relay described by this routerstatus.
This value is required.
sourcepub fn weight(&mut self, weight: RelayWeight) -> &mut Self
pub fn weight(&mut self, weight: RelayWeight) -> &mut Self
Set the weight of this routerstatus for random selection.
This value is optional; it defaults to 0.
source§impl RouterStatusBuilder<RdDigest>
impl RouterStatusBuilder<RdDigest>
sourcepub fn build_into(
&self,
builder: &mut ConsensusBuilder<NsConsensusRouterStatus>
) -> Result<()>
Available on crate feature ns_consensus
only.
pub fn build_into( &self, builder: &mut ConsensusBuilder<NsConsensusRouterStatus> ) -> Result<()>
ns_consensus
only.Try to finish this builder and add its RouterStatus to a provided ConsensusBuilder.
sourcepub fn build(&self) -> Result<NsConsensusRouterStatus>
Available on crate feature ns_consensus
only.
pub fn build(&self) -> Result<NsConsensusRouterStatus>
ns_consensus
only.Return a router status built by this object.
source§impl RouterStatusBuilder<MdDigest>
impl RouterStatusBuilder<MdDigest>
sourcepub fn build_into(
&self,
builder: &mut ConsensusBuilder<MdConsensusRouterStatus>
) -> Result<()>
pub fn build_into( &self, builder: &mut ConsensusBuilder<MdConsensusRouterStatus> ) -> Result<()>
Try to finish this builder and add its RouterStatus to a provided ConsensusBuilder.x
sourcepub fn build(&self) -> Result<MdConsensusRouterStatus>
pub fn build(&self) -> Result<MdConsensusRouterStatus>
Return a router status built by this object.
Trait Implementations§
source§impl<D: Clone> Clone for RouterStatusBuilder<D>
impl<D: Clone> Clone for RouterStatusBuilder<D>
source§fn clone(&self) -> RouterStatusBuilder<D>
fn clone(&self) -> RouterStatusBuilder<D>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more