Skip to content

bitswap/httpnet: Add WithDenylist option #877

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

Merged
merged 7 commits into from
Mar 18, 2025
Merged

Conversation

hsanjuan
Copy link
Contributor

Fixes #861

@hsanjuan hsanjuan requested a review from a team as a code owner March 10, 2025 15:38
@hsanjuan hsanjuan marked this pull request as draft March 10, 2025 15:45
@hsanjuan
Copy link
Contributor Author

Perhaps this PR is a good opportunity to solve an additional problem:

  • If a peer has no good http addresses to connect to, perhaps we should fail-over to bitswap. For this we need special handling in the proxy.

And an additional issue:

  • If we manage to add HTTP addresses from a peer to the peerstore without having called Connect() (i.e. somehow the other peer connected to us etc.), the HTTP codepaths will trigger and the MessageSender hits http addresses bypassing allowlists. I have seen this a couple of times.

@hsanjuan
Copy link
Contributor Author

If a peer has no good http addresses to connect to, perhaps we should fail-over to bitswap. For this we need special handling in the proxy.

This was already the case...

Harden the logic surrounding peer connections.

The NewMessageSender should only perform HTTP requests if we have gone through
Connect() and we are connected.

The router should failover to Bitswap when we are not connected even if we
somehow ended with some http addresses in the peerstore.

The Connect() logic is improved (try HEAD first, more efficient code...).
@hsanjuan hsanjuan marked this pull request as ready for review March 14, 2025 12:47
@hsanjuan hsanjuan self-assigned this Mar 14, 2025
@hsanjuan hsanjuan enabled auto-merge March 18, 2025 14:23
@hsanjuan hsanjuan merged commit 7932cb0 into main Mar 18, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bitswap/httpnet: add WithDenylist option
2 participants