Struct swarm_nl::setup::BootstrapConfig
source · pub struct BootstrapConfig { /* private fields */ }
Expand description
Configuration data required for node bootstrap.
Implementations§
source§impl BootstrapConfig
impl BootstrapConfig
sourcepub fn from_file(file_path: &str) -> Self
pub fn from_file(file_path: &str) -> Self
Read from a bootstrap config file on disk.
§Panics
This function will panic if the file is not found at the specified path.
sourcepub fn new() -> Self
pub fn new() -> Self
Return a new BootstrapConfig
struct populated by default (empty) values.
Must be called first if the config is to be explicitly built without reading .ini
file
from disk.
sourcepub fn with_bootnodes(
self,
boot_nodes: HashMap<PeerIdString, MultiaddrString>
) -> Self
pub fn with_bootnodes( self, boot_nodes: HashMap<PeerIdString, MultiaddrString> ) -> Self
Configure available bootnodes.
sourcepub fn with_blacklist(self, list: Vec<PeerId>) -> Self
pub fn with_blacklist(self, list: Vec<PeerId>) -> Self
Configure a list of peers to add to blacklist.
sourcepub fn generate_keypair(
self,
key_type: KeyType,
rsa_pk8_filepath: Option<&str>
) -> Self
pub fn generate_keypair( self, key_type: KeyType, rsa_pk8_filepath: Option<&str> ) -> Self
Generate a Cryptographic Keypair for node identity creation and message signing.
An RSA keypair cannot be generated on-the-fly. It has to be generated from a .pk8
file.
Hence the rsa_pk8_filepath
parameter must always be set to None
except in the case of
RSA. Please note that calling this function overrides whatever might have been read from the
.ini
file
§Panics
This function will panic if:
- The RSA key type is specified and the
rsa_pk8_filepath
is set toNone
. - If the file contains invalid data and an RSA keypair cannot be generated from it.
sourcepub fn generate_keypair_from_protobuf(
self,
key_type_str: &str,
bytes: &mut [u8]
) -> Self
pub fn generate_keypair_from_protobuf( self, key_type_str: &str, bytes: &mut [u8] ) -> Self
Generate a Cryptographic Keypair from a protobuf format.
This will override any already set keypair.
§Panics
This function will panic if the u8
buffer is not parsable into the specified key type.
This could be because one of two reasons:
- If the key type is valid, but the keypair data is not valid for that key type.
- If the key type is invalid.
sourcepub fn ports(&self) -> (Port, Port)
pub fn ports(&self) -> (Port, Port)
Return the configured ports in a tuple i.e (TCP Port, UDP port).
sourcepub fn bootnodes(&self) -> HashMap<PeerIdString, MultiaddrString>
pub fn bootnodes(&self) -> HashMap<PeerIdString, MultiaddrString>
Return the configured bootnodes for the network.
Trait Implementations§
source§impl Debug for BootstrapConfig
impl Debug for BootstrapConfig
source§impl Default for BootstrapConfig
impl Default for BootstrapConfig
Default
implementation for BootstrapConfig
.
Auto Trait Implementations§
impl Freeze for BootstrapConfig
impl RefUnwindSafe for BootstrapConfig
impl Send for BootstrapConfig
impl Sync for BootstrapConfig
impl Unpin for BootstrapConfig
impl UnwindSafe for BootstrapConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more