use libp2p::identity::Keypair;
#[derive(Clone)]
pub struct SatelliteConfig {
pub keypair: Keypair,
pub mdns_config: SatelliteMdnsConfig,
pub bootstrap: bool,
pub auto_connect: bool,
}
#[derive(Clone)]
pub struct SatelliteMdnsConfig {
pub auto_register: bool,
}
impl Default for SatelliteMdnsConfig {
fn default() -> Self {
Self {
auto_register: true,
}
}
}
impl Default for SatelliteConfig {
fn default() -> Self {
Self {
keypair: crate::random_key(),
mdns_config: Default::default(),
bootstrap: true,
auto_connect: true,
}
}
}
impl SatelliteConfig {
#[must_use]
pub fn keypair(self, keypair: Keypair) -> Self {
Self { keypair, ..self }
}
pub fn with_keypair(keypair: Keypair) -> Self {
Self {
keypair,
..Default::default()
}
}
}