feat(routing/http): IPIP-518: HTTP(S) URLs in Routing V1 API
This PR implements IPIP-518 which extends /routing/v1 with schema-agnostic support for URIs alongside multiaddrs.
Key changes:
- Add new
Addresstype that accepts both multiaddrs (starting with/) and URIs - Update
PeerRecordandBitswapRecordto useAddressestype instead of[]Multiaddr - Implement defensive programming: unsupported addresses are skipped, not errors
- Sensible UX:
- protocol filtering for http/https/tls matching real-world user intent (we expect
https://to be used more and more across the stack) - in places where only Multiaddr is returned, we turn
https://urls into/httpsmultiaddrs
- protocol filtering for http/https/tls matching real-world user intent (we expect
- Backward compatibility with multiaddr-only implementations which currently depend on
/httpsmultiaddrs
The implementation is not limited to https://, is schema-agnostic, accepting any valid URI scheme for future extensibility. URLs are preserved as-is without lossy conversion to multiaddrs, avoiding historical conversion issues documented in the IPIP.
IPIP:
- https://github.com/ipfs/specs/pull/518
TODO
- [ ] no objections in https://github.com/ipfs/specs/pull/518
- [ ] PR in someguy that uses this PR and tests there pass green
Codecov Report
:x: Patch coverage is 79.83871% with 50 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 60.85%. Comparing base (0f1ebac) to head (c9ac579).
:warning: Report is 18 commits behind head on main.
@@ Coverage Diff @@
## main #1051 +/- ##
==========================================
+ Coverage 60.75% 60.85% +0.09%
==========================================
Files 268 269 +1
Lines 33593 33805 +212
==========================================
+ Hits 20411 20572 +161
- Misses 11510 11554 +44
- Partials 1672 1679 +7
| Files with missing lines | Coverage Δ | |
|---|---|---|
| routing/http/client/client.go | 74.82% <100.00%> (+0.05%) |
:arrow_up: |
| routing/http/server/server.go | 74.22% <100.00%> (+0.05%) |
:arrow_up: |
| routing/http/types/record_bitswap.go | 40.69% <ø> (ø) |
|
| routing/http/types/record_peer.go | 83.63% <100.00%> (ø) |
|
| routing/http/filters/filters.go | 79.59% <81.48%> (-3.05%) |
:arrow_down: |
| routing/http/contentrouter/contentrouter.go | 50.00% <33.33%> (-0.57%) |
:arrow_down: |
| routing/http/types/address.go | 81.59% <81.59%> (ø) |
... and 9 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Triage: Consider updating IPIP to suggest different peer schema. Blocked waiting for more progress in buoy to determine what is needed here.
Note: Should not assume trustless gateway when HTTP URI with no metadata