Skip to content

Commit 16fbd19

Browse files
committed
docs: misc & changelog
1 parent b33c33c commit 16fbd19

File tree

5 files changed

+37
-36
lines changed

5 files changed

+37
-36
lines changed

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,27 @@ The following emojis are used to highlight certain changes:
1616

1717
### Added
1818

19-
* The `routing/http` client and server now support Delegated IPNS as per [IPIP-379](https://specs.ipfs.tech/ipips/ipip-0379/).
19+
* ✨ The `routing/http` package has received the following additions:
20+
* Supports Delegated IPNS as per [IPIP-379](https://specs.ipfs.tech/ipips/ipip-0379/).
21+
* Supports Delegated Peer Routing as per [IPIP-417](https://github.com/ipfs/specs/pull/417).
2022

2123
### Changed
2224

25+
* 🛠 The `routing/http` package has suffered the following modifications:
26+
* Client `FindProviders` has been renamed to `GetProviders`. Similarly, the
27+
required function names in the server `ContentRouter` have also been updated
28+
for higher consistency with the remaining code and the specifications.
29+
* Many types regarding response types were updated to conform to the updated
30+
Peer Schema discussed in [IPIP-417](https://github.com/ipfs/specs/pull/417).
31+
2332
### Removed
2433

34+
* 🛠 The `routing/http` package has suffered the following removals:
35+
* Server and client no longer support the `Provide*` methods for content routing.
36+
These methods did not conform to any specification, as it is still being worked
37+
out in [IPIP-378](https://github.com/ipfs/specs/pull/378).
38+
* Server no longer exports `FindProvidersPath` and `ProvidePath`.
39+
2540
### Fixed
2641

2742
### Security

routing/http/README.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
go-delegated-routing
1+
Routing V1 Server and Client
22
=======================
33

4-
> Delegated routing Client and Server over Reframe RPC
5-
6-
This package provides delegated routing implementation in Go:
7-
- Client (for IPFS nodes like [Kubo](https://github.com/ipfs/kubo/blob/master/docs/config.md#routingrouters-parameters)),
8-
- Server (for public indexers such as https://cid.contact)
4+
> Delegated Routing V1 Server and Client over HTTP API.
95
106
## Documentation
117

12-
- Go docs: https://pkg.go.dev/github.com/ipfs/boxo/routing/http/
13-
14-
## Lead Maintainer
15-
16-
🦗🎶
17-
18-
## Contributing
19-
20-
Contributions are welcome! This repository is part of the IPFS project and therefore governed by our [contributing guidelines](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md).
21-
22-
## License
23-
24-
[SPDX-License-Identifier: Apache-2.0 OR MIT](LICENSE.md)
8+
- Go Documentation: https://pkg.go.dev/github.com/ipfs/boxo/routing/http
9+
- Routing V1 Specification: https://specs.ipfs.tech/routing/http-routing-v1/

routing/http/contentrouter/contentrouter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/multiformats/go-multiaddr"
1414
)
1515

16-
var logger = logging.Logger("service/contentrouting")
16+
var logger = logging.Logger("routing/http/contentrouter")
1717

1818
type Client interface {
1919
GetProviders(ctx context.Context, key cid.Cid) (iter.ResultIter[types.Record], error)

routing/http/contentrouter/contentrouter_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ func TestGetProvidersAsync(t *testing.T) {
5757
ID: &p2,
5858
Protocols: []string{"transport-bitswap"},
5959
},
60-
// &types.UnknownRecord{
61-
// Protocol: "UNKNOWN",
62-
// },
60+
&types.UnknownRecord{
61+
Schema: "UNKNOWN",
62+
},
6363
}
6464
aisIter := iter.ToResultIter[types.Record](iter.FromSlice(ais))
6565

routing/http/server/server.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ const (
3434
DefaultStreamingRecordsLimit = 0
3535
)
3636

37-
var logger = logging.Logger("service/server/delegatedrouting")
37+
var logger = logging.Logger("routing/http/server")
3838

3939
const (
40-
GetProvidersPath = "/routing/v1/providers/{cid}"
41-
GetPeersPath = "/routing/v1/peers/{peer-id}"
42-
GetIPNSRecordPath = "/routing/v1/ipns/{cid}"
40+
getProvidersPath = "/routing/v1/providers/{cid}"
41+
getPeersPath = "/routing/v1/peers/{peer-id}"
42+
getIPNSRecordPath = "/routing/v1/ipns/{cid}"
4343
)
4444

4545
type GetProvidersAsyncResponse struct {
@@ -50,7 +50,7 @@ type GetProvidersAsyncResponse struct {
5050
type ContentRouter interface {
5151
// GetProviders searches for peers who are able to provide the given [cid.Cid].
5252
// Limit indicates the maximum amount of results to return; 0 means unbounded.
53-
GetProviders(ctx context.Context, key cid.Cid, limit int) (iter.ResultIter[types.Record], error)
53+
GetProviders(ctx context.Context, cid cid.Cid, limit int) (iter.ResultIter[types.Record], error)
5454

5555
// GetPeers searches for peers who have the provided [peer.ID].
5656
// Limit indicates the maximum amount of results to return; 0 means unbounded.
@@ -74,15 +74,17 @@ func WithStreamingResultsDisabled() Option {
7474
}
7575

7676
// WithRecordsLimit sets a limit that will be passed to [ContentRouter.GetProviders]
77-
// for non-streaming requests (application/json). Default is [DefaultRecordsLimit].
77+
// and [ContentRouter.GetPeers] for non-streaming requests (application/json).
78+
// Default is [DefaultRecordsLimit].
7879
func WithRecordsLimit(limit int) Option {
7980
return func(s *server) {
8081
s.recordsLimit = limit
8182
}
8283
}
8384

8485
// WithStreamingRecordsLimit sets a limit that will be passed to [ContentRouter.GetProviders]
85-
// for streaming requests (application/x-ndjson). Default is [DefaultStreamingRecordsLimit].
86+
// and [ContentRouter.GetPeers] for streaming requests (application/x-ndjson).
87+
// Default is [DefaultStreamingRecordsLimit].
8688
func WithStreamingRecordsLimit(limit int) Option {
8789
return func(s *server) {
8890
s.streamingRecordsLimit = limit
@@ -101,11 +103,10 @@ func Handler(svc ContentRouter, opts ...Option) http.Handler {
101103
}
102104

103105
r := mux.NewRouter()
104-
r.HandleFunc(GetProvidersPath, server.getProviders).Methods(http.MethodGet)
105-
r.HandleFunc(GetPeersPath, server.getPeers).Methods(http.MethodGet)
106-
r.HandleFunc(GetIPNSRecordPath, server.getIPNSRecord).Methods(http.MethodGet)
107-
r.HandleFunc(GetIPNSRecordPath, server.putIPNSRecord).Methods(http.MethodPut)
108-
106+
r.HandleFunc(getProvidersPath, server.getProviders).Methods(http.MethodGet)
107+
r.HandleFunc(getPeersPath, server.getPeers).Methods(http.MethodGet)
108+
r.HandleFunc(getIPNSRecordPath, server.getIPNSRecord).Methods(http.MethodGet)
109+
r.HandleFunc(getIPNSRecordPath, server.putIPNSRecord).Methods(http.MethodPut)
109110
return r
110111
}
111112

0 commit comments

Comments
 (0)