node: Update Config Default instance

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-09-13 10:16:04 +02:00
parent 9b3f5b9f3c
commit 9873a36463
2 changed files with 14 additions and 23 deletions
+12 -1
View File
@@ -141,7 +141,7 @@ pub enum RemoteTracking {
}
/// Protocol configuration.
#[derive(Debug, Default)]
#[derive(Debug)]
pub struct Config {
/// Peers to connect to on startup.
/// Connections to these peers will be maintained.
@@ -154,6 +154,17 @@ pub struct Config {
pub relay: bool,
}
impl Default for Config {
fn default() -> Self {
Self {
connect: Vec::default(),
project_tracking: ProjectTracking::default(),
remote_tracking: RemoteTracking::default(),
relay: true,
}
}
}
impl Config {
pub fn is_persistent(&self, addr: &net::SocketAddr) -> bool {
self.connect.contains(addr)