Skip to content

Commit

Permalink
:
Browse files Browse the repository at this point in the history
flexible toml parsing
  • Loading branch information
hansieodendaal committed Sep 12, 2024
1 parent 46ca15b commit d721377
Show file tree
Hide file tree
Showing 10 changed files with 250 additions and 34 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion base_layer/p2p/src/initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ async fn configure_comms_and_dht(
.with_listener_liveness_allowlist_cidrs(listener_liveness_allowlist_cidrs)
.with_dial_backoff(ConstantBackoff::new(Duration::from_millis(500)))
.with_peer_storage(peer_database, Some(file_lock))
.with_excluded_dial_addresses(config.dht.excluded_dial_addresses.clone());
.with_excluded_dial_addresses(config.dht.excluded_dial_addresses.clone().into_vec().clone());

let mut comms = match config.auxiliary_tcp_listener_address {
Some(ref addr) => builder.with_auxiliary_tcp_listener_address(addr.clone()).build()?,
Expand Down
2 changes: 1 addition & 1 deletion base_layer/wallet_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5328,7 +5328,7 @@ pub unsafe extern "C" fn comms_config_create(
minimum_desired_tcpv4_node_ratio: 0.0,
..Default::default()
},
excluded_dial_addresses: vec![IP4_TCP_TEST_ADDR_RANGE.parse().expect("valid address range")],
excluded_dial_addresses: vec![IP4_TCP_TEST_ADDR_RANGE.parse().expect("valid address range")].into(),
..Default::default()
},
allow_test_addresses: true,
Expand Down
10 changes: 6 additions & 4 deletions common/config/presets/c_base_node_c.toml
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ database_url = "data/base_node/dht.db"
#ban_duration = 21_600 # 6 * 60 * 60
# Length of time to ban a peer for a "short" duration. Default: 60 mins
#ban_duration_short = 3_600 # 60 * 60
# This allows the use of test addresses in the network like 127.0.0.1. Default: false
#allow_test_addresses = false
# The maximum number of messages over `flood_ban_timespan` to allow before banning the peer (for `ban_duration_short`)
# Default: 100_000 messages
#flood_ban_max_msg_count = 100_000
Expand All @@ -316,5 +314,9 @@ database_url = "data/base_node/dht.db"
# In a situation where a node is not well-connected and many nodes are locally marked as offline, we can retry
# peers that were previously tried. Default: 2 hours
#offline_peer_cooldown = 7_200 # 2 * 60 * 60
# Addresses that should never be dialed (default value = [])
#excluded_dial_addresses = ["/ip4/x.x.x.x/tcp/xxxx", "/ip4/x.y.x.y/tcp/xyxy"]
# Addresses that should never be dialed (default value = []). This can be a specific address or an IPv4/TCP range.
# Example: When used in conjunction with `allow_test_addresses = true` (but it could be any other range)
# `excluded_dial_addresses = ["/ip4/127.*.0:49.*/tcp/*", "/ip4/127.*.101:255.*/tcp/*"]`
# or
# `excluded_dial_addresses = ["/ip4/127.0:0.1/tcp/122", "/ip4/127.0:0.1/tcp/1000:2000"]`
#excluded_dial_addresses = []
10 changes: 6 additions & 4 deletions common/config/presets/d_console_wallet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,6 @@ network_discovery.initial_peer_sync_delay = 25
#ban_duration = 21_600 # 6 * 60 * 60
# Length of time to ban a peer for a "short" duration. Default: 60 mins
#ban_duration_short = 3_600 # 60 * 60
# This allows the use of test addresses in the network like 127.0.0.1. Default: false
#allow_test_addresses = false
# The maximum number of messages over `flood_ban_timespan` to allow before banning the peer (for `ban_duration_short`)
# Default: 100_000 messages
#flood_ban_max_msg_count = 100_000
Expand All @@ -360,5 +358,9 @@ network_discovery.initial_peer_sync_delay = 25
# In a situation where a node is not well-connected and many nodes are locally marked as offline, we can retry
# peers that were previously tried. Default: 2 hours
#offline_peer_cooldown = 7_200 # 2 * 60 * 60
# Addresses that should never be dialed (default value = [])
#excluded_dial_addresses = ["/ip4/x.x.x.x/tcp/xxxx", "/ip4/x.y.x.y/tcp/xyxy"]
# Addresses that should never be dialed (default value = []). This can be a specific address or an IPv4/TCP range.
# Example: When used in conjunction with `allow_test_addresses = true` (but it could be any other range)
# `excluded_dial_addresses = ["/ip4/127.*.0:49.*/tcp/*", "/ip4/127.*.101:255.*/tcp/*"]`
# or
# `excluded_dial_addresses = ["/ip4/127.0:0.1/tcp/122", "/ip4/127.0:0.1/tcp/1000:2000"]`
#excluded_dial_addresses = []
1 change: 1 addition & 0 deletions comms/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ zeroize = "1"
[dev-dependencies]
tari_test_utils = { path = "../../infrastructure/test_utils" }
tari_comms_rpc_macros = { path = "../rpc_macros" }
toml = { version = "0.5"}

env_logger = "0.7.0"
serde_json = "1.0.39"
Expand Down
2 changes: 1 addition & 1 deletion comms/core/src/net_address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ mod mutliaddresses_with_stats;
pub use mutliaddresses_with_stats::MultiaddressesWithStats;

mod multiaddr_range;
pub use multiaddr_range::{MultiaddrRange, IP4_TCP_TEST_ADDR_RANGE};
pub use multiaddr_range::{serde_multiaddr_range, MultiaddrRange, MultiaddrRangeList, IP4_TCP_TEST_ADDR_RANGE};
Loading

0 comments on commit d721377

Please sign in to comment.