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

Feat: Rate limiting #42

Merged
merged 12 commits into from
Dec 13, 2024
Merged

Conversation

SeverinAlexB
Copy link
Collaborator

@SeverinAlexB SeverinAlexB commented Dec 12, 2024

Adds query rate limiting based on IP addresses.

DNS Queries

Use --query-rate-limit <query-rate-limit> to rate limit dns queries per second based on IP addresses. It is disabled by default. This is a general limit not depending on the query being forwarded or hitting the internal cache. It limits ICANN queries and PKD queries.

Use --query-rate-limit-burst <query-rate-limit-burst> to allow short term burst above the general query-rate-limit.

For reference: Google's 8.8.8.8 seems to have a 1,500 queries per second rate limit per IP address too including a higher short term burst.

DHT queries

Use --dht-rate-limit <dht-rate-limit> to rate limit DHT request based on IP addresses. Default: 5. Only direct DHT hits count. Cached DHT request do not count to this limit.

Use --dht-rate-limit-burst <dht-rate-limit-burst> to allow short term burst above the general dht-rate-limit. Default: 25

The DHT rate limit has been added to protect excessive DHT requests. The chosen default values are best guesses and err on the low end.

@SeverinAlexB SeverinAlexB marked this pull request as ready for review December 13, 2024 10:09
@SeverinAlexB SeverinAlexB merged commit ad96dda into pubky:master Dec 13, 2024
This was referenced Dec 18, 2024
@SeverinAlexB SeverinAlexB deleted the feat/rate-limiting branch December 27, 2024 13:50
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.

1 participant