Skip to content

Commit c3b83ed

Browse files
committed
fix: keep go 1.25-compatible modernizations, add v0.40.1 changelog
- config/autoconf.go: restore math/rand/v2 (available since go 1.22) - core/corehttp/p2p_proxy.go: restore httputil.ReverseProxy.Rewrite (available since go 1.21) - core/commands/name/name.go: restore %d format for ValidityType int64 - docs/changelogs/v0.40.md: keep shipped v0.40.0 notes intact, add v0.40.1 section
1 parent 7c269ad commit c3b83ed

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

config/autoconf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package config
22

33
import (
44
"maps"
5-
"math/rand"
5+
"math/rand/v2"
66
"strings"
77

88
"github.com/ipfs/boxo/autoconf"
@@ -70,7 +70,7 @@ func selectRandomResolver(resolvers []string) string {
7070
if len(resolvers) == 0 {
7171
return ""
7272
}
73-
return resolvers[rand.Intn(len(resolvers))]
73+
return resolvers[rand.IntN(len(resolvers))]
7474
}
7575

7676
// DNSResolversWithAutoConf returns DNS resolvers with "auto" values replaced by autoconf values

core/commands/name/name.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Passing --verify will verify signature against provided public key.
234234
}
235235

236236
if out.Entry.ValidityType != nil {
237-
fmt.Fprintf(tw, "Validity Type:\t%q\n", *out.Entry.ValidityType)
237+
fmt.Fprintf(tw, "Validity Type:\t%d\n", *out.Entry.ValidityType)
238238
}
239239

240240
if out.Entry.Validity != nil {

core/corehttp/p2p_proxy.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@ func P2PProxyOption() ServeOption {
3535
}
3636

3737
rt := p2phttp.NewTransport(ipfsNode.PeerHost, p2phttp.ProtocolOption(parsedRequest.name))
38-
proxy := httputil.NewSingleHostReverseProxy(target)
39-
proxy.Transport = rt
38+
proxy := &httputil.ReverseProxy{
39+
Transport: rt,
40+
Rewrite: func(r *httputil.ProxyRequest) {
41+
r.SetURL(target)
42+
r.SetXForwarded()
43+
},
44+
}
4045
proxy.ServeHTTP(w, request)
4146
})
4247
return mux, nil

docs/changelogs/v0.40.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
This release was brought to you by the [Shipyard](https://ipshipyard.com/) team.
66

77
- [v0.40.0](#v0400)
8+
- [v0.40.1](#v0401)
89

910
## v0.40.0
1011

@@ -35,6 +36,7 @@ This release was brought to you by the [Shipyard](https://ipshipyard.com/) team.
3536
- [📉 Fixed Prometheus metrics bloat on popular subdomain gateways](#-fixed-prometheus-metrics-bloat-on-popular-subdomain-gateways)
3637
- [📢 libp2p announces all interface addresses](#-libp2p-announces-all-interface-addresses)
3738
- [🗑️ Badger v1 datastore slated for removal this year](#-badger-v1-datastore-slated-for-removal-this-year)
39+
- [🐹 Go 1.26](#-go-126)
3840
- [📦️ Dependency updates](#-dependency-updates)
3941
- [📝 Changelog](#-changelog)
4042
- [👨‍👩‍👧‍👦 Contributors](#-contributors)
@@ -334,6 +336,12 @@ The `badgerds` datastore (based on badger 1.x) is slated for removal. Badger v1
334336

335337
See the [`badgerds` profile documentation](https://github.com/ipfs/kubo/blob/master/docs/config.md#badgerds-profile) for migration guidance, and [#11186](https://github.com/ipfs/kubo/issues/11186) for background.
336338

339+
#### 🐹 Go 1.26
340+
341+
This release is built with [Go 1.26](https://go.dev/doc/go1.26).
342+
343+
You should see lower memory usage and reduced GC pauses thanks to the new Green Tea garbage collector (10-40% less GC overhead). Reading block data and API responses is faster due to `io.ReadAll` improvements (~2x faster, ~50% less memory). On 64-bit platforms, heap base address randomization adds a layer of security hardening.
344+
337345
#### 📦️ Dependency updates
338346

339347
- update `go-libp2p` to [v0.47.0](https://github.com/libp2p/go-libp2p/releases/tag/v0.47.0) (incl. [v0.46.0](https://github.com/libp2p/go-libp2p/releases/tag/v0.46.0))
@@ -613,3 +621,22 @@ See the [`badgerds` profile documentation](https://github.com/ipfs/kubo/blob/mas
613621
| [@willscott](https://github.com/willscott) | 1 | +1/-1 | 1 |
614622
| [@lbarrettanderson](https://github.com/lbarrettanderson) | 1 | +1/-1 | 1 |
615623
| [@filipremb](https://github.com/filipremb) | 1 | +1/-1 | 1 |
624+
625+
## v0.40.1
626+
627+
### 🔦 Highlights
628+
629+
#### Windows stability fix
630+
631+
If you run Kubo on Windows, v0.40.0 can crash after running for a while. The daemon starts fine and works normally at first, but eventually hits a memory corruption in Go's network I/O layer and dies. This is likely caused by an upstream Go 1.26 regression in overlapped I/O handling that has known issues ([go#77142](https://github.com/golang/go/issues/77142), [#11214](https://github.com/ipfs/kubo/issues/11214)).
632+
633+
This patch release downgrades the Go toolchain from 1.26 to 1.25, which does not have this bug. If you are running Kubo on Windows, upgrade to v0.40.1. We will switch back to Go 1.26.x once the upstream fix lands.
634+
635+
### 📝 Changelog
636+
637+
<details><summary>Full Changelog v0.40.1</summary>
638+
639+
- github.com/ipfs/kubo:
640+
- chore: downgrade to Go 1.25 to fix Windows crash ([ipfs/kubo#11215](https://github.com/ipfs/kubo/pull/11215))
641+
642+
</details>

0 commit comments

Comments
 (0)