mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-09 22:57:59 -05:00
script: DEP-0007: add network profiles to net setting section of the toml configs
This commit is contained in:
@@ -22,14 +22,15 @@ p2p_datastore = "damd0"
|
|||||||
# Path to a configured hostlist for saving known peers
|
# Path to a configured hostlist for saving known peers
|
||||||
hostlist = "damd0/p2p_hostlist.tsv"
|
hostlist = "damd0/p2p_hostlist.tsv"
|
||||||
|
|
||||||
|
# Allow localnet hosts
|
||||||
|
localnet = true
|
||||||
|
|
||||||
|
# Whitelisted network transports for outbound connections
|
||||||
|
active_profiles = ["tcp+tls"]
|
||||||
|
|
||||||
|
[net.profiles."tcp+tls"]
|
||||||
# P2P accept addresses the instance listens on for inbound connections
|
# P2P accept addresses the instance listens on for inbound connections
|
||||||
inbound = ["tcp+tls://0.0.0.0:44781"]
|
inbound = ["tcp+tls://0.0.0.0:44781"]
|
||||||
|
|
||||||
# Peer nodes to manually connect to
|
# Peer nodes to manually connect to
|
||||||
peers = []
|
peers = []
|
||||||
|
|
||||||
# Whitelisted network transports for outbound connections
|
|
||||||
allowed_transports = ["tcp+tls"]
|
|
||||||
|
|
||||||
# Allow localnet hosts
|
|
||||||
localnet = true
|
|
||||||
|
|||||||
@@ -22,14 +22,15 @@ p2p_datastore = "damd1"
|
|||||||
# Path to a configured hostlist for saving known peers
|
# Path to a configured hostlist for saving known peers
|
||||||
hostlist = "damd1/p2p_hostlist.tsv"
|
hostlist = "damd1/p2p_hostlist.tsv"
|
||||||
|
|
||||||
|
# Allow localnet hosts
|
||||||
|
localnet = true
|
||||||
|
|
||||||
|
# Whitelisted network transports for outbound connections
|
||||||
|
active_profiles = ["tcp+tls"]
|
||||||
|
|
||||||
|
[net.profiles."tcp+tls"]
|
||||||
# P2P accept addresses the instance listens on for inbound connections
|
# P2P accept addresses the instance listens on for inbound connections
|
||||||
inbound = ["tcp+tls://0.0.0.0:44881"]
|
inbound = ["tcp+tls://0.0.0.0:44881"]
|
||||||
|
|
||||||
# Peer nodes to manually connect to
|
# Peer nodes to manually connect to
|
||||||
peers = ["tcp+tls://0.0.0.0:44781"]
|
peers = ["tcp+tls://0.0.0.0:44781"]
|
||||||
|
|
||||||
# Whitelisted network transports for outbound connections
|
|
||||||
allowed_transports = ["tcp+tls"]
|
|
||||||
|
|
||||||
# Allow localnet hosts
|
|
||||||
localnet = true
|
|
||||||
|
|||||||
@@ -22,27 +22,6 @@ p2p_datastore = "~/.local/share/darkfi/damd"
|
|||||||
# Path to a configured hostlist for saving known peers
|
# Path to a configured hostlist for saving known peers
|
||||||
hostlist = "~/.local/share/darkfi/damd/p2p_hostlist.tsv"
|
hostlist = "~/.local/share/darkfi/damd/p2p_hostlist.tsv"
|
||||||
|
|
||||||
# P2P accept addresses the instance listens on for inbound connections
|
|
||||||
#inbound = ["tcp+tls://0.0.0.0:34781"]
|
|
||||||
|
|
||||||
# P2P external addresses the instance advertises so other peers can
|
|
||||||
# reach us and connect to us, as long as inbound addrs are configured.
|
|
||||||
#external_addrs = []
|
|
||||||
|
|
||||||
# Peer nodes to manually connect to
|
|
||||||
#peers = []
|
|
||||||
|
|
||||||
# Seed nodes to connect to for peer discovery and/or adversising our
|
|
||||||
# own external addresses
|
|
||||||
#seeds = []
|
|
||||||
|
|
||||||
# Whitelisted network transports for outbound connections
|
|
||||||
#allowed_transports = ["tcp+tls"]
|
|
||||||
|
|
||||||
# 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 = []
|
|
||||||
|
|
||||||
# Outbound connection slots number, this many connections will be
|
# Outbound connection slots number, this many connections will be
|
||||||
# attempted. (This does not include manual connections)
|
# attempted. (This does not include manual connections)
|
||||||
#outbound_connections = 8
|
#outbound_connections = 8
|
||||||
@@ -60,15 +39,6 @@ hostlist = "~/.local/share/darkfi/damd/p2p_hostlist.tsv"
|
|||||||
# Manual connections retry limit, 0 for forever looping
|
# Manual connections retry limit, 0 for forever looping
|
||||||
#manual_attempt_limit = 0
|
#manual_attempt_limit = 0
|
||||||
|
|
||||||
# Outbound connection timeout (in seconds)
|
|
||||||
#outbound_connect_timeout = 10
|
|
||||||
|
|
||||||
# Exchange versions (handshake) timeout (in seconds)
|
|
||||||
#channel_handshake_timeout = 4
|
|
||||||
|
|
||||||
# Ping-pong exchange execution interval (in seconds)
|
|
||||||
#channel_heartbeat_interval = 10
|
|
||||||
|
|
||||||
# Allow localnet hosts
|
# Allow localnet hosts
|
||||||
localnet = false
|
localnet = false
|
||||||
|
|
||||||
@@ -77,3 +47,25 @@ localnet = false
|
|||||||
|
|
||||||
# Time between peer discovery attempts
|
# Time between peer discovery attempts
|
||||||
#outbound_peer_discovery_attempt_time = 5
|
#outbound_peer_discovery_attempt_time = 5
|
||||||
|
|
||||||
|
# Whitelisted network transports for outbound connections
|
||||||
|
#active_profiles = ["tcp+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 = []
|
||||||
|
|
||||||
|
#[net.profiles."tcp+tls"]
|
||||||
|
# P2P accept addresses the instance listens on for inbound connections
|
||||||
|
#inbound = ["tcp+tls://0.0.0.0:34781"]
|
||||||
|
|
||||||
|
# P2P external addresses the instance advertises so other peers can
|
||||||
|
# reach us and connect to us, as long as inbound addrs are configured.
|
||||||
|
#external_addrs = []
|
||||||
|
|
||||||
|
# Peer nodes to manually connect to
|
||||||
|
#peers = []
|
||||||
|
|
||||||
|
# Seed nodes to connect to for peer discovery and/or adversising our
|
||||||
|
# own external addresses
|
||||||
|
#seeds = []
|
||||||
@@ -80,7 +80,7 @@ impl DamFlooder {
|
|||||||
for peer in self.p2p.hosts().channels() {
|
for peer in self.p2p.hosts().channels() {
|
||||||
let task = StoppableTask::new();
|
let task = StoppableTask::new();
|
||||||
task.clone().start(
|
task.clone().start(
|
||||||
flood_foo(self.p2p.settings().read().await.outbound_connect_timeout, peer, subscribers.get("attack_foo").unwrap().clone(), limit),
|
flood_foo(self.p2p.settings().read().await.outbound_connect_timeout(peer.address().scheme()), peer, subscribers.get("attack_foo").unwrap().clone(), limit),
|
||||||
|res| async move {
|
|res| async move {
|
||||||
match res {
|
match res {
|
||||||
Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
|
Ok(()) | Err(Error::DetachedTaskStopped) => { /* Do nothing */ }
|
||||||
|
|||||||
@@ -8,27 +8,6 @@
|
|||||||
|
|
||||||
## P2P network settings
|
## P2P network settings
|
||||||
[net]
|
[net]
|
||||||
# P2P accept addresses the instance listens on for inbound connections
|
|
||||||
inbound = ["tcp+tls://0.0.0.0:38967"]
|
|
||||||
|
|
||||||
# P2P external addresses the instance advertises so other peers can
|
|
||||||
# reach us and connect to us, as long as inbound addrs are configured.
|
|
||||||
#external_addrs = []
|
|
||||||
|
|
||||||
# Peer nodes to manually connect to
|
|
||||||
#peers = []
|
|
||||||
|
|
||||||
# Seed nodes to connect to for peer discovery and/or adversising our
|
|
||||||
# own external addresses
|
|
||||||
#seeds = []
|
|
||||||
|
|
||||||
# Whitelisted network transports for outbound connections
|
|
||||||
#allowed_transports = ["tcp+tls"]
|
|
||||||
|
|
||||||
# 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 = []
|
|
||||||
|
|
||||||
# Outbound connection slots number, this many connections will be
|
# Outbound connection slots number, this many connections will be
|
||||||
# attempted. (This does not include manual connections)
|
# attempted. (This does not include manual connections)
|
||||||
#outbound_connections = 8
|
#outbound_connections = 8
|
||||||
@@ -46,15 +25,6 @@ inbound = ["tcp+tls://0.0.0.0:38967"]
|
|||||||
# Manual connections retry limit, 0 for forever looping
|
# Manual connections retry limit, 0 for forever looping
|
||||||
#manual_attempt_limit = 0
|
#manual_attempt_limit = 0
|
||||||
|
|
||||||
# Outbound connection timeout (in seconds)
|
|
||||||
#outbound_connect_timeout = 10
|
|
||||||
|
|
||||||
# Exchange versions (handshake) timeout (in seconds)
|
|
||||||
#channel_handshake_timeout = 4
|
|
||||||
|
|
||||||
# Ping-pong exchange execution interval (in seconds)
|
|
||||||
#channel_heartbeat_interval = 10
|
|
||||||
|
|
||||||
# Allow localnet hosts
|
# Allow localnet hosts
|
||||||
localnet = true
|
localnet = true
|
||||||
|
|
||||||
@@ -63,3 +33,34 @@ localnet = true
|
|||||||
|
|
||||||
# Time between peer discovery attempts
|
# Time between peer discovery attempts
|
||||||
#outbound_peer_discovery_attempt_time = 5
|
#outbound_peer_discovery_attempt_time = 5
|
||||||
|
|
||||||
|
# Whitelisted network transports for outbound connections
|
||||||
|
#active_profiles = ["tcp+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 = []
|
||||||
|
|
||||||
|
[net.profiles."tcp+tls"]
|
||||||
|
# P2P accept addresses the instance listens on for inbound connections
|
||||||
|
inbound = ["tcp+tls://0.0.0.0:38967"]
|
||||||
|
|
||||||
|
# P2P external addresses the instance advertises so other peers can
|
||||||
|
# reach us and connect to us, as long as inbound addrs are configured.
|
||||||
|
#external_addrs = []
|
||||||
|
|
||||||
|
# Peer nodes to manually connect to
|
||||||
|
#peers = []
|
||||||
|
|
||||||
|
# Seed nodes to connect to for peer discovery and/or adversising our
|
||||||
|
# own external addresses
|
||||||
|
#seeds = []
|
||||||
|
|
||||||
|
# Outbound connection timeout (in seconds)
|
||||||
|
#outbound_connect_timeout = 10
|
||||||
|
|
||||||
|
# Exchange versions (handshake) timeout (in seconds)
|
||||||
|
#channel_handshake_timeout = 4
|
||||||
|
|
||||||
|
# Ping-pong exchange execution interval (in seconds)
|
||||||
|
#channel_heartbeat_interval = 10
|
||||||
@@ -299,7 +299,7 @@ async fn handle_generic_request_msg(
|
|||||||
|
|
||||||
/// Background function to send messages at random intervals.
|
/// Background function to send messages at random intervals.
|
||||||
async fn broadcast_messages(node_id: u64, p2p: P2pPtr) -> Result<()> {
|
async fn broadcast_messages(node_id: u64, p2p: P2pPtr) -> Result<()> {
|
||||||
let comms_timeout = p2p.settings().read().await.outbound_connect_timeout;
|
let comms_timeout = p2p.settings().read().await.outbound_connect_timeout_max();
|
||||||
let request = GenericRequestMessage { msg: format!("Ping from node {node_id}!") };
|
let request = GenericRequestMessage { msg: format!("Ping from node {node_id}!") };
|
||||||
let mut counter = 0;
|
let mut counter = 0;
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
Reference in New Issue
Block a user