diff --git a/Dockerfile b/Dockerfile index 6d43beefa..5f3f4e3e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 # Enables BuildKit with cache mounts for faster builds -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.25 AS builder +FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.26 AS builder ARG TARGETOS TARGETARCH diff --git a/config/autoconf.go b/config/autoconf.go index 2f1d41b26..2e5acc16f 100644 --- a/config/autoconf.go +++ b/config/autoconf.go @@ -2,7 +2,7 @@ package config import ( "maps" - "math/rand" + "math/rand/v2" "strings" "github.com/ipfs/boxo/autoconf" @@ -70,7 +70,7 @@ func selectRandomResolver(resolvers []string) string { if len(resolvers) == 0 { return "" } - return resolvers[rand.Intn(len(resolvers))] + return resolvers[rand.IntN(len(resolvers))] } // DNSResolversWithAutoConf returns DNS resolvers with "auto" values replaced by autoconf values diff --git a/core/commands/name/name.go b/core/commands/name/name.go index 73d540f62..0e1c4b0e1 100644 --- a/core/commands/name/name.go +++ b/core/commands/name/name.go @@ -234,7 +234,7 @@ Passing --verify will verify signature against provided public key. } if out.Entry.ValidityType != nil { - fmt.Fprintf(tw, "Validity Type:\t%q\n", *out.Entry.ValidityType) + fmt.Fprintf(tw, "Validity Type:\t%d\n", *out.Entry.ValidityType) } if out.Entry.Validity != nil { diff --git a/core/commands/provide.go b/core/commands/provide.go index c9d3954cf..3e72ea389 100644 --- a/core/commands/provide.go +++ b/core/commands/provide.go @@ -351,8 +351,7 @@ NOTES: } sectionTitle := func(col int, title string) { if !brief && showHeadings { - //nolint:govet // dynamic format string is intentional - formatLine(col, title+":") + formatLine(col, "%s:", title) } } diff --git a/core/corehttp/p2p_proxy.go b/core/corehttp/p2p_proxy.go index e239f47cd..e947ca023 100644 --- a/core/corehttp/p2p_proxy.go +++ b/core/corehttp/p2p_proxy.go @@ -35,8 +35,13 @@ func P2PProxyOption() ServeOption { } rt := p2phttp.NewTransport(ipfsNode.PeerHost, p2phttp.ProtocolOption(parsedRequest.name)) - proxy := httputil.NewSingleHostReverseProxy(target) - proxy.Transport = rt + proxy := &httputil.ReverseProxy{ + Transport: rt, + Rewrite: func(r *httputil.ProxyRequest) { + r.SetURL(target) + r.SetXForwarded() + }, + } proxy.ServeHTTP(w, request) }) return mux, nil diff --git a/docs/changelogs/v0.40.md b/docs/changelogs/v0.40.md index 143180a7b..2ff2f14af 100644 --- a/docs/changelogs/v0.40.md +++ b/docs/changelogs/v0.40.md @@ -32,6 +32,7 @@ This release was brought to you by the [Shipyard](https://ipshipyard.com/) team. - [๐Ÿ–ฅ๏ธ WebUI Improvements](#-webui-improvements) - [๐Ÿ“ข libp2p announces all interface addresses](#-libp2p-announces-all-interface-addresses) - [๐Ÿ—‘๏ธ Badger v1 datastore slated for removal this year](#-badger-v1-datastore-slated-for-removal-this-year) + - [๐Ÿน Go 1.26](#-go-126) - [๐Ÿ“ฆ๏ธ Dependency updates](#-dependency-updates) - [๐Ÿ“ Changelog](#-changelog) - [๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributors](#-contributors) @@ -320,6 +321,12 @@ The `badgerds` datastore (based on badger 1.x) is slated for removal. Badger v1 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. +#### ๐Ÿน Go 1.26 + +This release is built with [Go 1.26](https://go.dev/doc/go1.26). + +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. + #### ๐Ÿ“ฆ๏ธ Dependency updates - 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)) diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index 2c2555581..6b6f39caf 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -1,6 +1,6 @@ module github.com/ipfs/kubo/examples/kubo-as-a-library -go 1.25 +go 1.26 // Used to keep this in sync with the current version of kubo. You should remove // this if you copy this example. diff --git a/go.mod b/go.mod index 0d3ef23e7..e7b37b1b4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ipfs/kubo -go 1.25 +go 1.26 require ( bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc diff --git a/test/cli/gateway_test.go b/test/cli/gateway_test.go index b80d2d700..101063630 100644 --- a/test/cli/gateway_test.go +++ b/test/cli/gateway_test.go @@ -215,13 +215,13 @@ func TestGateway(t *testing.T) { t.Run("GET /webui returns 301 or 302", func(t *testing.T) { t.Parallel() resp := node.APIClient().DisableRedirects().Get("/webui") - assert.Contains(t, []int{302, 301}, resp.StatusCode) + assert.Contains(t, []int{302, 301, 307, 308}, resp.StatusCode) }) t.Run("GET /webui/ returns 301 or 302", func(t *testing.T) { t.Parallel() resp := node.APIClient().DisableRedirects().Get("/webui/") - assert.Contains(t, []int{302, 301}, resp.StatusCode) + assert.Contains(t, []int{302, 301, 307, 308}, resp.StatusCode) }) t.Run("GET /webui/ returns user-specified headers", func(t *testing.T) { diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index 42642df86..541ca6b67 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -1,6 +1,6 @@ module github.com/ipfs/kubo/test/dependencies -go 1.25 +go 1.26 replace github.com/ipfs/kubo => ../../