src/net: add explicit Default implementation for Settings and remove StructOptToml

This commit is contained in:
ghassmo
2022-04-25 13:44:07 +03:00
parent ef167d4d32
commit f661c1e714
2 changed files with 18 additions and 3 deletions

View File

@@ -211,7 +211,6 @@ net = [
"regex",
"rustls-pemfile",
"structopt",
"structopt-toml",
"util",
"system",

View File

@@ -2,13 +2,12 @@ use std::{net::SocketAddr, sync::Arc};
use serde::Deserialize;
use structopt::StructOpt;
use structopt_toml::StructOptToml;
/// Atomic pointer to network settings.
pub type SettingsPtr = Arc<Settings>;
/// Defines the network settings.
#[derive(Clone, Debug, Deserialize, StructOpt, StructOptToml)]
#[derive(Clone, Debug, Deserialize, StructOpt)]
#[structopt()]
pub struct Settings {
#[structopt(short, long)]
@@ -32,3 +31,20 @@ pub struct Settings {
#[structopt(short, long)]
pub seeds: Vec<SocketAddr>,
}
impl Default for Settings {
fn default() -> Self {
Self {
inbound: None,
outbound_connections: 0,
manual_attempt_limit: 0,
seed_query_timeout_seconds: 8,
connect_timeout_seconds: 10,
channel_handshake_seconds: 4,
channel_heartbeat_seconds: 10,
external_addr: None,
peers: Vec::new(),
seeds: Vec::new(),
}
}
}