Explorar o código

bin/tau/taud: DEP-0007: add network profiles to net setting section of tau toml config, use the maximum outbound_connect_timeout from all the network profiles for dag sync timeout

oars hai 1 ano
pai
achega
ed7b39b930
Modificáronse 2 ficheiros con 94 adicións e 28 borrados
  1. 1 2
      bin/tau/taud/src/main.rs
  2. 93 26
      bin/tau/taud/taud_config.toml

+ 1 - 2
bin/tau/taud/src/main.rs

@@ -522,6 +522,7 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
 
     let p2p_settings: darkfi::net::Settings =
         (env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"), settings.net.clone()).try_into()?;
+    let comms_timeout = p2p_settings.outbound_connect_timeout_max();
 
     let p2p = P2p::new(p2p_settings, executor.clone()).await?;
     let event_graph = EventGraph::new(
@@ -550,8 +551,6 @@ async fn realmain(settings: Args, executor: Arc<smol::Executor<'static>>) -> Res
     info!(target: "taud", "Starting P2P network");
     p2p.clone().start().await?;
 
-    let comms_timeout = p2p.settings().read().await.outbound_connect_timeout;
-
     loop {
         if p2p.is_connected() {
             info!(target: "taud", "Got peer connection");

+ 93 - 26
bin/tau/taud/taud_config.toml

@@ -62,10 +62,6 @@ p2p_datastore = "~/.local/share/darkfi/taud"
 # Path to a configured hostlist for saving known peers
 hostlist = "~/.local/share/darkfi/taud/hostlist.tsv"
 
-## P2P accept addresses
-#inbound = ["tcp+tls://0.0.0.0:23331", "tcp+tls://[::]:23331"]
-#inbound = ["tor://127.0.0.1:23331"]
-
 ## Outbound connection slots
 #outbound_connections = 8
 
@@ -78,41 +74,112 @@ hostlist = "~/.local/share/darkfi/taud/hostlist.tsv"
 ## White connection percent
 #white_connect_percent = 70
 
+# Nodes to avoid interacting with for the duration of the program, in the
+# format ["host", ["scheme", "scheme"], [port, port]].
+# If scheme is left empty it will default to "tcp+tls".
+# If ports are left empty all ports from this peer will be blocked.
+#blacklist = [["example.com", ["tcp"], [8551, 23331]]]
+
+# Whitelisted transports for outbound connections
+active_profiles = ["tor"]
+#active_profiles = ["tcp+tls"]
+#active_profiles = ["tor", "tor+tls"]
+
+# Transports you want to be mixed (e.g. Tor would be allowed to connect to `tcp://`
+# if tcp is added to mixed_profiles and tor is added to active_profiles)
+#mixed_profiles = []
+
+# Tor Socks5 proxy
+#tor_socks5_proxy = "socks5://127.0.0.1:9050"
+
+# Nym Socks5 proxy
+#nym_socks5_proxy = "socks5://127.0.0.1:1080"
+
+# I2p Socks5 proxy
+#i2p_socks5_proxy = "socks5://127.0.0.1:4447"
+
+[net.profiles."tcp+tls"]
+## Seed nodes to connect to
+seeds = [
+    "tcp+tls://lilith0.dark.fi:23331",
+    "tcp+tls://lilith1.dark.fi:23331",
+]
+
+## Manual peers to connect to
+#peers = []
+
+## P2P accept addresses
+#inbound = ["tcp+tls://0.0.0.0:23331", "tcp+tls://[::]:23331"]
+
 ## Addresses we want to advertise to peers (optional)
 ## These should be reachable externally
 #external_addrs = ["tcp+tls://my.resolveable.address:23331"]
 
+[net.profiles."tor"]
 ## Seed nodes to connect to
 seeds = [
-    "tcp+tls://lilith0.dark.fi:23331",
-    "tcp+tls://lilith1.dark.fi:23331",
-    #"tor://g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:23332",
-    #"tor://yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:23332",
+    "tor://g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:23332",
+    "tor://yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:23332",
 ]
 
 ## Manual peers to connect to
 #peers = []
 
-# Whitelisted transports for outbound connections
-allowed_transports = ["tcp+tls"]
-#allowed_transports = ["tor"]
-#allowed_transports = ["tor", "tor+tls"]
+## P2P accept addresses
+#inbound = ["tor://127.0.0.1:23331"]
 
-# Transports you want to be mixed (e.g. Tor would be allowed to connect to `tcp://`
-# if tcp is added to mixed_transports and tor is added to allowed_transports)
-mixed_transports = []
+[net.profiles."i2p"]
+## Seed nodes to connect to
+#seeds = []
 
-# Tor Socks5 proxy
-#tor_socks5_proxy = "socks5://127.0.0.1:9050"
+## Manual peers to connect to
+#peers = []
 
-# Nym Socks5 proxy
-#nym_socks5_proxy = "socks5://127.0.0.1:1080"
+## P2P accept addresses
+#inbound = ["tcp://127.0.0.1:23331"]
 
-# I2p Socks5 proxy
-#i2p_socks5_proxy = "socks5://127.0.0.1:4447"
+## Addresses we want to advertise to peers
+#external_addrs = ["i2p://youraddress.b32.i2p:23331"]
 
-# Nodes to avoid interacting with for the duration of the program, in the
-# format ["host", ["scheme", "scheme"], [port, port]].
-# If scheme is left empty it will default to "tcp+tls". 
-# If ports are left empty all ports from this peer will be blocked.
-#blacklist = [["example.com", ["tcp"], [8551, 23331]]]
+[net.profiles."socks5"]
+## Seed nodes to connect to
+seeds = [
+    "socks5://127.0.0.1:9050/g7fxelebievvpr27w7gt24lflptpw3jeeuvafovgliq5utdst6xyruyd.onion:23332",
+    "socks5://127.0.0.1:9050/yvklzjnfmwxhyodhrkpomawjcdvcaushsj6torjz2gyd7e25f3gfunyd.onion:23332",
+]
+
+## Manual peers to connect to
+#peers = []
+
+[net.profiles."socks5+tls"]
+## Seed nodes to connect to
+seeds = [
+    #"socks5+tls://127.0.0.1:9050/lilith0.dark.fi:23331",
+    #"socks5+tls://127.0.0.1:1080/lilith1.dark.fi:23331"
+]
+
+## Manual peers to connect to
+#peers = []
+
+[net.profiles."tor+tls"]
+## Seed nodes to connect to
+seeds = [
+    "tor+tls://lilith0.dark.fi:23331",
+    "tor+tls://lilith1.dark.fi:23331"
+]
+
+## Manual peers to connect to
+#peers = []
+
+[net.profiles."tcp"]
+## Seed nodes to connect to
+#seeds = ["tcp://127.0.0.1:23332"]
+
+## Manual peers to connect to
+#peers = []
+
+## P2P accept addresses
+#inbound = ["tcp://127.0.0.1:23331"]
+
+## Addresses we want to advertise to peers
+#external_addrs = ["tcp://127.0.0.1:23331"]