diff --git a/client-demo/src/main.rs b/client-demo/src/main.rs index 3c69eb04b..4790991fe 100644 --- a/client-demo/src/main.rs +++ b/client-demo/src/main.rs @@ -112,7 +112,7 @@ fn get_netdir(args: &Args) -> Result { eprintln!("Can't specify both --tor-dir and --chutney-dir"); return Err(anyhow!("Conflicting --tor-dir and --chutney-dir")); } - let mut cfg = tor_netdir::NetDirConfig::new(); + let mut cfg = tor_netdir::NetDirConfigBuilder::new(); if let Some(ref d) = args.tor_dir { cfg.add_default_authorities(); @@ -125,6 +125,7 @@ fn get_netdir(args: &Args) -> Result { eprintln!("Must specify --tor-dir or --chutney-dir"); return Err(anyhow!("Missing --tor-dir or --chutney-dir")); } + let cfg = cfg.finalize(); let partial = cfg.load().context("Loading directory from disk")?; Ok(partial.unwrap_if_sufficient().unwrap()) @@ -268,8 +269,9 @@ fn main() -> Result<()> { let store = tor_netdir::storage::sqlite::SqliteStore::from_path("/home/nickm/.arti")?; let store = tor_dirmgr::DirStoreHandle::new(store); let circmgr = Arc::new(circmgr); - let mut cfg = tor_netdir::NetDirConfig::new(); + let mut cfg = tor_netdir::NetDirConfigBuilder::new(); cfg.add_default_authorities(); + let cfg = cfg.finalize(); let authorities = cfg.into_authorities(); let outcome = tor_dirmgr::bootstrap_directory( diff --git a/tor-netdir/src/lib.rs b/tor-netdir/src/lib.rs index a336d7598..c6024f9dd 100644 --- a/tor-netdir/src/lib.rs +++ b/tor-netdir/src/lib.rs @@ -40,7 +40,7 @@ pub use err::Error; pub type Result = std::result::Result; pub use authority::Authority; -pub use config::NetDirConfig; +pub use config::{NetDirConfig, NetDirConfigBuilder}; /// Internal: how should we find the base weight of each relay? This /// value is global over a whole directory, and depends on the bandwidth @@ -140,12 +140,6 @@ pub trait MDReceiver { fn add_microdesc(&mut self, md: Microdesc) -> bool; } -impl Default for NetDirConfig { - fn default() -> Self { - NetDirConfig::new() - } -} - impl PartialNetDir { /// Create a new PartialNetDir with a given consensus, and no /// microdecriptors loaded.