Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blacklist via RateLimiter #712

Merged
merged 4 commits into from
Jan 16, 2025
Merged

Blacklist via RateLimiter #712

merged 4 commits into from
Jan 16, 2025

Conversation

ScottyPoi
Copy link
Collaborator

@ScottyPoi ScottyPoi commented Jan 16, 2025

Implements a solution for blacklisting nodes at the UDP level.

The UDPTransportService class is the default transport layer used by discv5 to interact with UDP sockets.

This class can be constructed with an object called RateLimiter. If transport.rateLimiter exists, transport.handleIncomingPacket will check rateLimiter.allowEncodedPacket before processing incoming packets.

This PR introduces a custom RateLimiter which will maintain a set of blacklisted IP addresses. When tranport.handleIncomingPacket calls rateLimiter.allowEncodedPacket, the RateLimiter will check this set of blacklisted IP addresses before allowing the packet to be processed.

This now allows us to blacklist peers on the UDP level.

Previously, Ultralight could add a peer to routingTable.ignored, which prevents us from sending new requests to peers that have been unresponsive. RateLimiter allows us to block incoming messages from banned peers.

Currently the timeout for blacklisting is set at 24 hours.

Copy link
Collaborator

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

LGTM. :shipit:

@acolytec3 acolytec3 merged commit 7e8fee3 into master Jan 16, 2025
5 checks passed
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