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

Swarm: add fn ban_peer_id_with_duration #3140

Closed
hanabi1224 opened this issue Nov 18, 2022 · 1 comment
Closed

Swarm: add fn ban_peer_id_with_duration #3140

hanabi1224 opened this issue Nov 18, 2022 · 1 comment

Comments

@hanabi1224
Copy link
Contributor

hanabi1224 commented Nov 18, 2022

Description

Currently ban_peer_id bans a peer for the entire lifetime of the swarm unless unban_peer_id is called. It would be great to have another ban_peer_id_with_duration API that automatically unbans the peer after the specific duration.

Motivation

The peers being banned may "correct" their behavior and we would give them a chance to reconnect after a while so that we can re-evaluate them

Requirements

  1. the API accepts an additional Duration parameter
  2. automatically unban the peer after the specified duration
  3. the API change should be backward compatible, requiring only patch version bump

Open questions

Are you planning to do it yourself in a pull request?

Maybe.

@mxinden
Copy link
Member

mxinden commented Nov 18, 2022

If I am not mistaken, you can already achieve this behavior by calling unban_peer_id on Swarm once an external timer fired.

Unless there is a majority of users that would need this feature, I would advocate for this to live outside of rust-libp2p as described above.

Long term I advocate for making most of the connection management generic. See #2824.

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

No branches or pull requests

2 participants