-
Notifications
You must be signed in to change notification settings - Fork 1k
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(connection-limit): allow specific peers to bypass limit #5720
Conversation
I also found that you can get a mutable reference to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding bypass rules for a PeerId
makes sense. I am not sure about having them for a MultiAddr
as well.
When would one know the address of a trusted peer, but not it's PeerId
?
I don't know, but trusting an address also kind of makes sense? Though this behaviour is not primarily used for managing trusts between peers. |
Also you can use the rule to allow a range of peers from an address, for example behind a load balancer and such, or a domain(I guess it only works for dialing). Allowing a range of addresses will grant even greater flexibility but it will be a bit difficult to implement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also allow all connections from specific listeners.
Not sure I understand what you mean. Won't using the listeners PeerId
do exactly that?
I still have a slight preference to only allow bypassing of connection limits based on PeerId
s. In allow-block-list
we also only operated on PeerId
s and not on multiaddresses.
But I don't feel strongly about it, so if from a user perspective it's useful and needed I am okay with also bypassing based on addresses.
Sorry for the late response. Looking at the comments and review, I think what we can do for now is exclude the address portion of the code and allow it based on |
fix: bypassed pending connections still take up slots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments. Can we also add a test for this feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the follow-ups @drHuangMHT! LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can you update the versions in both Cargo.toml (crate and workpace)? :)
Tests and version bump on the way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for working this out DrHuangMHT! ❤️
I'll let you address Darius's suggestions before merging it
Description
Add
bypass_peer_id
onconnection_limit::Behaviour
to allow peers to bypass limit.May close #5605
Notes & open questions
This implememtation does not distingush between local addresses and remote addresses, will that be a problem?
Change checklist