Skip to content

Ignore selected peers#4413

Draft
RickiNano wants to merge 7 commits into
nanocurrency:developfrom
RickiNano:blacklist-nodes
Draft

Ignore selected peers#4413
RickiNano wants to merge 7 commits into
nanocurrency:developfrom
RickiNano:blacklist-nodes

Conversation

@RickiNano
Copy link
Copy Markdown
Contributor

This PR introduces an optional list of ip addresses that a node operator wants to ignore. The peers are inserted in the config file as "blocked_peers"
Both ip v4 and v6 address formats are supported and can be mixed. Example:
blocked_peers = ["::ffff:10.0.0.1", "192.168.0.1"]
This could be useful for blocking malicious nodes.

Comment thread nano/core_test/toml.cpp Outdated
Comment thread nano/node/network.cpp Outdated
Comment thread nano/node/network.cpp Outdated
@clemahieu
Copy link
Copy Markdown
Contributor

We should also have an affirmative test that shows the ip blocking works.

@RickiNano
Copy link
Copy Markdown
Contributor Author

I've moved the logic to the tcp_listener::on_connection function. I will try to add some unit tests next


if (this_l->is_ip_blocked (new_connection->remote.address ()))
{
this_l->node.logger.info (nano::log::type::tcp_listener, "Connection refused from blocked IP: {}", new_connection->remote_endpoint ().address ().to_string ());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should remain a debug log as it could be high-volume.

@RickiNano RickiNano marked this pull request as draft August 16, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants