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(routing/http/client): DefaultProtocolFilter for IPIP-484 #689

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lidel
Copy link
Member

@lidel lidel commented Oct 16, 2024

This PR makes routing/http/client initialize with implicit default protocol filter from IPIP-484 set to unknown + transport-bitswap, matching what we explicitly set in Kubo (ipfs/kubo#10534) and Rainbow (ipfs/rainbow#173).

Rationale

boxo users can change or disable default filter via WithProtocolFilter option, but the default should be filter that is optimized for golden path, which currently means bitswap. Processing peers that we know only support unsupported protocols is wasting resources and we should skip them.

Over time, we may add new protocols like http to boxo, and we will also adjust the default list accordingly.

TODO

  • refactor routing/http/client to use DefaultProtocolFilter
  • refactor examples/routing/delegated-routing-client to reflect implicit defaults

@lidel lidel force-pushed the feat/ipip-484-implicit-protocol-filter branch from 47928d1 to bda1247 Compare October 16, 2024 00:37
@lidel lidel changed the title feat(routing/http/client): DefaultProtocolFilter feat(routing/http/client): DefaultProtocolFilter for IPIP-484 Oct 16, 2024
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.31%. Comparing base (08fb71d) to head (bda1247).

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #689      +/-   ##
==========================================
+ Coverage   60.29%   60.31%   +0.02%     
==========================================
  Files         243      243              
  Lines       31018    31019       +1     
==========================================
+ Hits        18702    18710       +8     
+ Misses      10649    10645       -4     
+ Partials     1667     1664       -3     
Files with missing lines Coverage Δ
routing/http/client/client.go 70.83% <100.00%> (+0.08%) ⬆️

... and 13 files with indirect coverage changes

@lidel lidel marked this pull request as ready for review October 16, 2024 00:41
@lidel lidel requested a review from a team as a code owner October 16, 2024 00:41
@@ -25,15 +25,15 @@ func TestFindProviders(t *testing.T) {
if r.URL.Path == "/routing/v1/providers/"+cidStr {
w.Header().Set("Content-Type", "application/x-ndjson")
w.Write([]byte(`{"Schema":"peer","ID":"12D3KooWM8sovaEGU1bmiWGWAzvs47DEcXKZZTuJnpQyVTkRs2Vn","Addrs":["/ip4/111.222.222.111/tcp/5734"],"Protocols":["transport-bitswap"]}` + "\n"))
w.Write([]byte(`{"Schema":"peer","ID":"12D3KooWB6RAWgcmHAP7TGEGK7utV2ZuqSzX1DNjRa97TtJ7139n","Addrs":["/ip4/127.0.0.1/tcp/5734"],"Protocols":["transport-horse"]}` + "\n"))
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps keep "transport-horse" and add an additional unknown one so that it's clear it's getting filtered

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