mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #6877
d643a86
p2p: add --max-connections-per-ip daemon option (moneromooo-monero)
This commit is contained in:
commit
c5785c33f0
3 changed files with 10 additions and 3 deletions
|
@ -166,6 +166,7 @@ namespace nodetool
|
||||||
const command_line::arg_descriptor<bool> arg_pad_transactions = {
|
const command_line::arg_descriptor<bool> arg_pad_transactions = {
|
||||||
"pad-transactions", "Pad relayed transactions to help defend against traffic volume analysis", false
|
"pad-transactions", "Pad relayed transactions to help defend against traffic volume analysis", false
|
||||||
};
|
};
|
||||||
|
const command_line::arg_descriptor<uint32_t> arg_max_connections_per_ip = {"max-connections-per-ip", "Maximum number of connections allowed from the same IP address", 1};
|
||||||
|
|
||||||
boost::optional<std::vector<proxy>> get_proxies(boost::program_options::variables_map const& vm)
|
boost::optional<std::vector<proxy>> get_proxies(boost::program_options::variables_map const& vm)
|
||||||
{
|
{
|
||||||
|
|
|
@ -258,7 +258,8 @@ namespace nodetool
|
||||||
m_igd(no_igd),
|
m_igd(no_igd),
|
||||||
m_offline(false),
|
m_offline(false),
|
||||||
is_closing(false),
|
is_closing(false),
|
||||||
m_network_id()
|
m_network_id(),
|
||||||
|
max_connections(1)
|
||||||
{}
|
{}
|
||||||
virtual ~node_server();
|
virtual ~node_server();
|
||||||
|
|
||||||
|
@ -517,6 +518,8 @@ namespace nodetool
|
||||||
epee::net_utils::ssl_support_t m_ssl_support;
|
epee::net_utils::ssl_support_t m_ssl_support;
|
||||||
|
|
||||||
bool m_enable_dns_blocklist;
|
bool m_enable_dns_blocklist;
|
||||||
|
|
||||||
|
uint32_t max_connections;
|
||||||
};
|
};
|
||||||
|
|
||||||
const int64_t default_limit_up = P2P_DEFAULT_LIMIT_RATE_UP; // kB/s
|
const int64_t default_limit_up = P2P_DEFAULT_LIMIT_RATE_UP; // kB/s
|
||||||
|
@ -551,6 +554,7 @@ namespace nodetool
|
||||||
extern const command_line::arg_descriptor<int64_t> arg_limit_rate_down;
|
extern const command_line::arg_descriptor<int64_t> arg_limit_rate_down;
|
||||||
extern const command_line::arg_descriptor<int64_t> arg_limit_rate;
|
extern const command_line::arg_descriptor<int64_t> arg_limit_rate;
|
||||||
extern const command_line::arg_descriptor<bool> arg_pad_transactions;
|
extern const command_line::arg_descriptor<bool> arg_pad_transactions;
|
||||||
|
extern const command_line::arg_descriptor<uint32_t> arg_max_connections_per_ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
POP_WARNINGS
|
POP_WARNINGS
|
||||||
|
|
|
@ -131,6 +131,7 @@ namespace nodetool
|
||||||
command_line::add_arg(desc, arg_limit_rate_down);
|
command_line::add_arg(desc, arg_limit_rate_down);
|
||||||
command_line::add_arg(desc, arg_limit_rate);
|
command_line::add_arg(desc, arg_limit_rate);
|
||||||
command_line::add_arg(desc, arg_pad_transactions);
|
command_line::add_arg(desc, arg_pad_transactions);
|
||||||
|
command_line::add_arg(desc, arg_max_connections_per_ip);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
template<class t_payload_net_handler>
|
template<class t_payload_net_handler>
|
||||||
|
@ -615,6 +616,8 @@ namespace nodetool
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
max_connections = command_line::get_arg(vm, arg_max_connections_per_ip);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
|
@ -2846,8 +2849,7 @@ namespace nodetool
|
||||||
if (address.get_zone() != epee::net_utils::zone::public_)
|
if (address.get_zone() != epee::net_utils::zone::public_)
|
||||||
return false; // Unable to determine how many connections from host
|
return false; // Unable to determine how many connections from host
|
||||||
|
|
||||||
const size_t max_connections = 1;
|
uint32_t count = 0;
|
||||||
size_t count = 0;
|
|
||||||
|
|
||||||
m_network_zones.at(epee::net_utils::zone::public_).m_net_server.get_config_object().foreach_connection([&](const p2p_connection_context& cntxt)
|
m_network_zones.at(epee::net_utils::zone::public_).m_net_server.get_config_object().foreach_connection([&](const p2p_connection_context& cntxt)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue