Skip to content

Commit 07c5719

Browse files
authored
Merge pull request #500 from ipfs/release-v0.14.0
Release v0.14.0
2 parents e0d4b3e + 50f0e2c commit 07c5719

File tree

114 files changed

+5549
-3411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+5549
-3411
lines changed

.github/workflows/gateway-conformance.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
# 1. Download the gateway-conformance fixtures
1818
- name: Download gateway-conformance fixtures
19-
uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.3
19+
uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.4
2020
with:
2121
output: fixtures
2222
merged: true
@@ -40,7 +40,7 @@ jobs:
4040

4141
# 4. Run the gateway-conformance tests
4242
- name: Run gateway-conformance tests
43-
uses: ipfs/gateway-conformance/.github/actions/test@v0.3
43+
uses: ipfs/gateway-conformance/.github/actions/test@v0.4
4444
with:
4545
gateway-url: http://127.0.0.1:8040
4646
json: output.json

CHANGELOG.md

+60-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,65 @@ The following emojis are used to highlight certain changes:
2424

2525
### Security
2626

27+
## [v0.14.0]
28+
29+
### Added
30+
31+
* `boxo/gateway`:
32+
* A new `WithResolver(...)` option can be used with `NewBlocksBackend(...)` allowing the user to pass their custom `Resolver` implementation.
33+
* The gateway now sets a `Cache-Control` header for requests under the `/ipns/` namespace if the TTL for the corresponding IPNS Records or DNSLink entities is known.
34+
* `boxo/bitswap/client`:
35+
* A new `WithoutDuplicatedBlockStats()` option can be used with `bitswap.New` and `bsclient.New`. This disable accounting for duplicated blocks, which requires a `blockstore.Has()` lookup for every received block and thus, can impact performance.
36+
* ✨ Migrated repositories into Boxo
37+
* [`github.com/ipfs/kubo/peering`](https://pkg.go.dev/github.com/ipfs/kubo/peering) => [`./peering`](./peering)
38+
A service which establish, overwatch and maintain long lived connections.
39+
* [`github.com/ipfs/kubo/core/bootstrap`](https://pkg.go.dev/github.com/ipfs/kubo/core/bootstrap) => [`./bootstrap](./bootstrap)
40+
A service that maintains connections to a number of bootstrap peers.
41+
42+
### Changed
43+
44+
* `boxo/gateway`
45+
* 🛠 The `IPFSBackend` interface was updated to make the responses of the
46+
`Head` method more explicit. It now returns a `HeadResponse` instead of a
47+
`files.Node`.
48+
* `boxo/routing/http/client.Client` is now exported. This means you can now pass
49+
it around functions, or add it to a struct if you want.
50+
* 🛠 The `path` package has been massively refactored. With this refactor, we have
51+
condensed the different path-related and/or Kubo-specific packages under a single generic one. Therefore, there
52+
are many breaking changes. Please consult the [documentation](https://pkg.go.dev/github.com/ipfs/boxo/path)
53+
for more details on how to use the new package.
54+
* Note: content paths created with `boxo/path` are automatically normalized:
55+
- Replace multiple slashes with a single slash.
56+
- Eliminate each `.` path name element (the current directory).
57+
- Eliminate each inner `..` path name element (the parent directory) along with the non-`..` element that precedes it.
58+
- Eliminate `..` elements that begin a rooted path: that is, replace "`/..`" by "`/`" at the beginning of a path.
59+
* 🛠 The signature of `CoreAPI.ResolvePath` in `coreiface` has changed to now return
60+
the remainder segments as a second return value, matching the signature of `resolver.ResolveToLastNode`.
61+
* 🛠 `routing/http/client.FindPeers` now returns `iter.ResultIter[types.PeerRecord]` instead of `iter.ResultIter[types.Record]`. The specification indicates that records for this method will always be Peer Records.
62+
* 🛠 The `namesys` package has been refactored. The following are the largest modifications:
63+
* The options in `coreiface/options/namesys` have been moved to `namesys` and their names
64+
have been made more consistent.
65+
* Many of the exported structs and functions have been renamed in order to be consistent with
66+
the remaining packages.
67+
* `namesys.Resolver.Resolve` now returns a TTL, in addition to the resolved path. If the
68+
TTL is unknown, 0 is returned. `IPNSResolver` is able to resolve a TTL, while `DNSResolver`
69+
is not.
70+
* `namesys/resolver.ResolveIPNS` has been moved to `namesys.ResolveIPNS` and now returns a TTL
71+
in addition to the resolved path.
72+
*`boxo/ipns` record defaults follow recommendations from [IPNS Record Specification](https://specs.ipfs.tech/ipns/ipns-record/#ipns-record):
73+
* `DefaultRecordTTL` is now set to `1h`
74+
* `DefaultRecordLifetime` follows the increased expiration window of Amino DHT ([go-libp2p-kad-dht#793](https://github.com/libp2p/go-libp2p-kad-dht/pull/793)) and is set to `48h`
75+
* 🛠 The `gateway`'s `IPFSBackend.ResolveMutable` is now expected to return a TTL in addition to
76+
the resolved path. If the TTL is unknown, 0 should be returned.
77+
78+
### Removed
79+
80+
* 🛠 `util.MultiErr` has been removed. Please use Go's native support for wrapping errors, or `errors.Join` instead.
81+
82+
### Fixed
83+
84+
### Security
85+
2786
## [v0.13.1]
2887

2988
### Added
@@ -240,7 +299,7 @@ None.
240299
- `InternalKeys`
241300
- 🛠 `provider/batched.New` has been moved to `provider.New` and arguments has been changed. (https://github.com/ipfs/boxo/pulls/273)
242301
- A routing system is now passed with the `provider.Online` option, by default the system run in offline mode (push stuff onto the queue).
243-
- When using `provider.Online` calling the `.Run` method is not required anymore, the background worker is implicitely started in the background by `provider.New`.
302+
- When using `provider.Online` calling the `.Run` method is not required anymore, the background worker is implicitly started in the background by `provider.New`.
244303
- You do not have to pass a queue anymore, you pass a `datastore.Datastore` exclusively.
245304
- 🛠 `provider.NewOfflineProvider` has been renamed to `provider.NewNoopProvider` to show more clearly that is does nothing. (https://github.com/ipfs/boxo/pulls/273)
246305
- 🛠 `provider.Provider` and `provider.Reprovider` has been merged under one `provider.System`. (https://github.com/ipfs/boxo/pulls/273)

README.md

+41-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
<h1 align="center">
2-
<img src="https://github.com/ipfs/boxo/assets/157609/3c5e7391-fbc2-405b-9efc-920f4fd13b39" alt="Boxo logo" title="Boxo logo" width="200">
3-
<br>
4-
BOXO: IPFS SDK for GO
2+
<br>
3+
<a href="#readme"><img src="https://github.com/ipfs/boxo/assets/157609/3c5e7391-fbc2-405b-9efc-920f4fd13b39" alt="Boxo logo" title="Boxo logo" width="200"></a>
4+
<br>
5+
BOXO: IPFS SDK for GO
6+
<br>
57
</h1>
8+
69
<p align="center" style="font-size: 1.2rem;">A set of libraries for building IPFS applications and implementations in GO.</p>
710

8-
<hr />
11+
<p align="center">
12+
<a href="https://ipfs.tech"><img src="https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square" alt="Official Part of IPFS Project"></a>
13+
<a href="https://discuss.ipfs.tech"><img alt="Discourse Forum" src="https://img.shields.io/discourse/posts?server=https%3A%2F%2Fdiscuss.ipfs.tech"></a>
14+
<a href="https://matrix.to/#/#ipfs-space:ipfs.io"><img alt="Matrix" src="https://img.shields.io/matrix/ipfs-space%3Aipfs.io?server_fqdn=matrix.org"></a>
15+
<a href="https://github.com/ipfs/boxo/actions"><img src="https://img.shields.io/github/actions/workflow/status/ipfs/boxo/go-test.yml?branch=main" alt="ci"></a>
16+
<a href="https://codecov.io/gh/ipfs/boxo"><img src="https://codecov.io/gh/ipfs/boxo/branch/main/graph/badge.svg?token=9eG7d8fbCB" alt="coverage"></a>
17+
<a href="https://github.com/ipfs/boxo/releases"><img alt="GitHub release" src="https://img.shields.io/github/v/release/ipfs/boxo?filter=!*rc*"></a>
18+
<a href="https://godoc.org/github.com/ipfs/boxo"><img src="https://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square" alt="godoc reference"></a>
19+
</p>
920

10-
[![Go Test](https://github.com/ipfs/boxo/actions/workflows/go-test.yml/badge.svg)](https://github.com/ipfs/boxo/actions/workflows/go-test.yml)
11-
[![Go Docs](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/ipfs/boxo)
12-
[![codecov](https://codecov.io/gh/ipfs/boxo/branch/main/graph/badge.svg?token=9eG7d8fbCB)](https://codecov.io/gh/ipfs/boxo)
21+
<hr />
1322

1423
<!-- TOC -->
1524

@@ -53,6 +62,7 @@ Boxo powers [Kubo](https://github.com/ipfs/kubo), which is [the most popular IPF
5362
so its code has been battle-tested on the IPFS network for years, and is well-understood by the community.
5463

5564
### Motivation
65+
5666
**TL;DR** The goal of this repo is to help people build things. Previously users struggled to find existing useful code or to figure out how to use what they did find. We observed many running Kubo and using its HTTP RPC API. This repo aims to do better. We're taking the libraries that many were already effectively relying on in production and making them more easily discoverable and usable.
5767

5868
The maintainers primarily aim to help people trying to build with IPFS in Go that were previously either giving up or relying on the [Kubo HTTP RPC API](https://docs.ipfs.tech/reference/kubo/rpc/). Some of these people will end up being better served by IPFS tooling in other languages (e.g., Javascript, Rust, Java, Python), but for those who are either looking to write in Go or to leverage the set of IPFS tooling we already have in Go we’d like to make their lives easier.
@@ -64,6 +74,7 @@ Boxo is not exhaustive nor comprehensive--there are plenty of useful IPFS protoc
6474
More details can also be found in the [Rationale FAQ](./docs/FAQ.md#rationale-faq).
6575

6676
## Scope
77+
6778
### What kind of components does Boxo have?
6879

6980
Boxo includes high-quality components useful for interacting with IPFS protocols, public and private IPFS networks, and content-addressed data, such as:
@@ -77,20 +88,23 @@ Boxo includes high-quality components useful for interacting with IPFS protocols
7788
Boxo aims to provide a cohesive interface into these components. Note that not all of the underlying components necessarily reside in this respository.
7889

7990
### Does Boxo == IPFS?
80-
No. This repo houses some IPFS functionality written in Go that has been useful in practice, and is maintained by a group that has long term commitments to the IPFS project
8191

82-
### Is everything related to IPFS in the Go ecosystem in this repo?
92+
No. This repo houses some IPFS functionality written in Go that has been useful in practice, and is maintained by a group that has long term commitments to the IPFS project
8393

84-
No. Not everything related to IPFS is intended to be in Boxo. View it as a starter toolbox (potentially among multiple). If you’d like to build an IPFS implementation with Go, here are some tools you might want that are maintained by a group that has long term commitments to the IPFS project. There are certainly repos that others maintain that aren't included here (e.g., ipfs/go-car) which are still useful to IPFS implementations. It's expected and fine for new IPFS functionality to be developed that won't be part of Boxo.
94+
### Is everything related to IPFS in the Go ecosystem in this repo?
8595

96+
No. Not everything related to IPFS is intended to be in Boxo. View it as a starter toolbox (potentially among multiple). If you’d like to build an IPFS implementation with Go, here are some tools you might want that are maintained by a group that has long term commitments to the IPFS project. There are certainly repos that others maintain that aren't included here (e.g., ipfs/go-car) which are still useful to IPFS implementations. It's expected and fine for new IPFS functionality to be developed that won't be part of Boxo.
8697

8798
## Consuming
99+
88100
### Getting started
101+
89102
See [examples](./examples/README.md).
90103

91104
If you are migrating to Boxo, see [Migrating to Boxo](#migrating-to-boxo).
92105

93106
### Migrating to Boxo
107+
94108
Many Go modules under github.com/ipfs have moved here. Boxo provides a tool to ease this migration, which does most of the work for you:
95109

96110
* `cd` into the root directory of your module (where the `go.mod` file is)
@@ -107,10 +121,13 @@ We recommend upgrading to v0.8.0 first, and _then_ upgrading to the latest Boxo
107121
If you encounter any challenges, please [open an issue](https://github.com/ipfs/boxo/issues/new/choose) and Boxo maintainers will help you.
108122

109123
### Deprecations & Breaking Changes
124+
110125
See [RELEASE.md](./RELEASE.md).
111126

112127
## Development
128+
113129
### Should I add my IPFS component to Boxo?
130+
114131
We happily accept external contributions! However, Boxo maintains a high quality bar, so code accepted into Boxo must meet some minimum maintenance criteria:
115132

116133
* Actively maintained
@@ -128,37 +145,46 @@ We happily accept external contributions! However, Boxo maintains a high quality
128145
If you have some experimental component that you think would benefit the IPFS community, we suggest you build the component in your own repository until it's clear that there's community demand for it, and then open an issue/PR in this repository to discuss including it in Boxo.
129146

130147
### Release Process
148+
131149
See [RELEASE.md](./RELEASE.md).
132150

133151
### Why is the code coverage so bad?
134152

135153
The code coverage of this repo is not currently representative of the actual test coverage of this code. Much of the code in this repo is currently covered by integration tests in [Kubo](https://github.com/ipfs/kubo). We are in the process of moving those tests here, and as that continues the code coverage will significantly increase.
136154

137155
## General
156+
138157
### Help
139158

140159
If you have questions, feel free to open an issue. You can also find the Boxo maintainers in [Filecoin Slack](https://filecoin.io/slack/) at #Boxo-maintainers. (If you would like to engage via IPFS Discord or ipfs.io Matrix, please drop into the #ipfs-implementers channel/room or file an issue, and we'll get bridging from #Boxo-maintainers to these other chat platforms.)
141160

142161
### What is the response time for issues or PRs filed?
143-
TODO: fill this in. New issues and PRs to this repo are usually looked at on a weekly basis as part of [Kubo triage](https://pl-strflt.notion.site/Kubo-Issue-Triage-Notes-7d4983e8cf294e07b3cc51b0c60ede9a).
162+
163+
New issues and PRs to this repo are usually looked at on a weekly basis as part of [Kubo triage](https://pl-strflt.notion.site/Kubo-Issue-Triage-Notes-7d4983e8cf294e07b3cc51b0c60ede9a). However, the response time may vary.
144164

145165
### What are some projects that depend on this project?
146-
The exhaustive list is https://github.com/ipfs/boxo/network/dependents. Some notable projects include:
166+
167+
The exhaustive list is https://github.com/ipfs/boxo/network/dependents. Some notable projects include:
168+
147169
1. [Kubo](https://github.com/ipfs/kubo), an IPFS implementation in Go
148170
2. [Lotus](https://github.com/filecoin-project/lotus), a Filecoin implementation in Go
149-
3. [Bifrost Gateway](https://github.com/protocol/bifrost-gateway), a dedicated IPFS gateway
171+
6. [rainbow](https://github.com/ipfs/rainbow), a specialized IPFS gateway
150172
4. [ipfs-check](https://github.com/ipfs-shipyard/ipfs-check), checks IPFS data availability
173+
5. [someguy](https://github.com/ipfs-shipyard/someguy), a dedicated Delegated Routing V1 server and client
174+
3. [Bifrost Gateway](https://github.com/ipfs/bifrost-gateway), a dedicated IPFS Gateway daemon backed by a remote datastore
151175

152176
### Governance and Access
153-
See [CODEOWNERS](./docs/CODEOWNERS) for the current maintainers list. Governance for graduating additional maintainers hasn't been established. Repo permissions are all managed through [ipfs/github-mgmt](https://github.com/ipfs/github-mgmt).
177+
178+
See [CODEOWNERS](./docs/CODEOWNERS) for the current maintainers list. Governance for graduating additional maintainers hasn't been established. Repo permissions are all managed through [ipfs/github-mgmt](https://github.com/ipfs/github-mgmt).
154179

155180
### Why is this named "Boxo"?
181+
156182
See https://github.com/ipfs/boxo/issues/215.
157183

158184
### Additional Docs & FAQs
185+
159186
See [the wiki](https://github.com/ipfs/boxo/wiki).
160187

161188
### License
162189

163190
[SPDX-License-Identifier: Apache-2.0 OR MIT](LICENSE.md)
164-

RELEASE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The amount of backporting of a fix depends on the severity of the issue and the
2727
As a result, Boxo maintainers recommend that consumers stay up-to-date with Boxo releases.
2828

2929
### Go Compatibility
30-
At any given point, the Go team supports only the latest two versions of Go released (see https://go.dev/doc/devel/release). Boxo maintainers will strive to maintain compatibilty with the older of the two supported versions, so that Boxo is also compatible with the latest two versions of Go.
30+
At any given point, the Go team supports only the latest two versions of Go released (see https://go.dev/doc/devel/release). Boxo maintainers will strive to maintain compatibility with the older of the two supported versions, so that Boxo is also compatible with the latest two versions of Go.
3131

3232
### Release Criteria
3333
Boxo releases occur _at least_ on every Kubo release. Releases can also be initiated on-demand, regardless of Kubo's release cadence, whenever there are significant changes (new features, refactorings, deprecations, etc.).

bitswap/client/client.go

+21-2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ func WithBlockReceivedNotifier(brn BlockReceivedNotifier) Option {
7979
}
8080
}
8181

82+
// WithoutDuplicatedBlockStats disable collecting counts of duplicated blocks
83+
// received. This counter requires triggering a blockstore.Has() call for
84+
// every block received by launching goroutines in parallel. In the worst case
85+
// (no caching/blooms etc), this is an expensive call for the datastore to
86+
// answer. In a normal case (caching), this has the power of evicting a
87+
// different block from intermediary caches. In the best case, it doesn't
88+
// affect performance. Use if this stat is not relevant.
89+
func WithoutDuplicatedBlockStats() Option {
90+
return func(bs *Client) {
91+
bs.skipDuplicatedBlocksStats = true
92+
}
93+
}
94+
8295
type BlockReceivedNotifier interface {
8396
// ReceivedBlocks notifies the decision engine that a peer is well-behaving
8497
// and gave us useful data, potentially increasing its score and making us
@@ -226,6 +239,9 @@ type Client struct {
226239

227240
// whether we should actually simulate dont haves on request timeout
228241
simulateDontHavesOnTimeout bool
242+
243+
// dupMetric will stay at 0
244+
skipDuplicatedBlocksStats bool
229245
}
230246

231247
type counters struct {
@@ -373,14 +389,17 @@ func (bs *Client) updateReceiveCounters(blocks []blocks.Block) {
373389
// Check which blocks are in the datastore
374390
// (Note: any errors from the blockstore are simply logged out in
375391
// blockstoreHas())
376-
blocksHas := bs.blockstoreHas(blocks)
392+
var blocksHas []bool
393+
if !bs.skipDuplicatedBlocksStats {
394+
blocksHas = bs.blockstoreHas(blocks)
395+
}
377396

378397
bs.counterLk.Lock()
379398
defer bs.counterLk.Unlock()
380399

381400
// Do some accounting for each block
382401
for i, b := range blocks {
383-
has := blocksHas[i]
402+
has := (blocksHas != nil) && blocksHas[i]
384403

385404
blkLen := len(b.RawData())
386405
bs.allMetric.Observe(float64(blkLen))

bitswap/client/internal/blockpresencemanager/blockpresencemanager_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func TestAllPeersDoNotHaveBlock(t *testing.T) {
218218
{[]peer.ID{p1}, []cid.Cid{c2}, []cid.Cid{}},
219219
{[]peer.ID{p2}, []cid.Cid{c2}, []cid.Cid{c2}},
220220

221-
// p0 recieved DONT_HAVE for c1 & c2 (but not for c0)
221+
// p0 received DONT_HAVE for c1 & c2 (but not for c0)
222222
{[]peer.ID{p0}, []cid.Cid{c0, c1, c2}, []cid.Cid{c1, c2}},
223223
{[]peer.ID{p0, p1}, []cid.Cid{c0, c1, c2}, []cid.Cid{}},
224224
// Both p0 and p2 received DONT_HAVE for c2

bitswap/client/internal/getter/getter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type GetBlocksFunc func(context.Context, []cid.Cid) (<-chan blocks.Block, error)
2121

2222
// SyncGetBlock takes a block cid and an async function for getting several
2323
// blocks that returns a channel, and uses that function to return the
24-
// block syncronously.
24+
// block synchronously.
2525
func SyncGetBlock(p context.Context, k cid.Cid, gb GetBlocksFunc) (blocks.Block, error) {
2626
p, span := internal.StartSpan(p, "Getter.SyncGetBlock")
2727
defer span.End()

bitswap/client/internal/providerquerymanager/providerquerymanager_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func TestRateLimitingRequests(t *testing.T) {
281281
defer fpn.queriesMadeMutex.Unlock()
282282
if fpn.queriesMade != maxInProcessRequests+1 {
283283
t.Logf("Queries made: %d\n", fpn.queriesMade)
284-
t.Fatal("Did not make all seperate requests")
284+
t.Fatal("Did not make all separate requests")
285285
}
286286
}
287287

0 commit comments

Comments
 (0)