mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 07:08:05 -05:00
src/net: add explicit Default implementation for Settings and remove StructOptToml
This commit is contained in:
@@ -211,7 +211,6 @@ net = [
|
||||
"regex",
|
||||
"rustls-pemfile",
|
||||
"structopt",
|
||||
"structopt-toml",
|
||||
|
||||
"util",
|
||||
"system",
|
||||
|
||||
@@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user