From 316dbc27f3cfc4df1276a7afcff33f5b4f05688d Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Thu, 21 Aug 2025 09:07:55 +0100 Subject: [PATCH 1/5] ci: uci/update-go (#115) * chore!: bump go.mod to Go 1.24 and run go fix BREAKING CHANGE: Updating the Go version to 1.24 * chore: update CHANGELOG --------- Co-authored-by: Piotr Galar --- CHANGELOG.md | 2 ++ go.mod | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3851da8..19491dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ The following emojis are used to highlight certain changes: ### Changed +- Updated to [Go 1.25](https://go.dev/doc/go1.25) + ### Removed ### Fixed diff --git a/go.mod b/go.mod index 0b83bc6..1db0734 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ipfs/someguy -go 1.23.0 +go 1.24 require ( contrib.go.opencensus.io/exporter/prometheus v0.4.2 From 5c96165261aab441937bc983b3991479f01cef7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 21:07:27 -0700 Subject: [PATCH 2/5] chore(deps): bump actions/checkout from 4 to 5 (#116) Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c6ae469..103f107 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,7 +18,7 @@ jobs: packages: write steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: ref: ${{ github.ref }} From e1c082667bef5fa26c8ed436e529968eeff9f915 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Sun, 14 Sep 2025 09:13:25 -0400 Subject: [PATCH 3/5] feat: automatically generate peerIDs for HTTP block providers if they are not passed (#117) * feat: automatically generate peerIDs for HTTP block providers if they are not passed * docs: clarify synthetic peerid generation explain that auto-generated peerids are placeholders for http providers, not used for cryptographic operations --- CHANGELOG.md | 1 + docs/environment-variables.md | 4 +++- main.go | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19491dc..cd5e788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The following emojis are used to highlight certain changes: ### Changed - Updated to [Go 1.25](https://go.dev/doc/go1.25) +- When `SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS` are configured but no `SOMEGUY_HTTP_BLOCK_PROVIDER_PEERIDS` are configured, synthetic PeerIDs will now be autogenerated. These are deterministic placeholders derived from endpoint URLs, used only for routing system compatibility with HTTP-based trustless gateways - no libp2p cryptographic operations are performed with these IDs ### Removed diff --git a/docs/environment-variables.md b/docs/environment-variables.md index d1ecbbe..823a7c1 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -91,7 +91,9 @@ Default: none ### `SOMEGUY_HTTP_BLOCK_PROVIDER_PEERIDS` -Comma-separated list of [multibase-encoded peerIDs](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#string-representation) to use in synthetic provider records returned for HTTP providers in `SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS`. +Comma-separated list of [multibase-encoded peerIDs](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#string-representation) to use in synthetic provider records returned for HTTP providers in `SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS`. The order of PeerIDs must match the order of endpoints. + +If no peerIDs are passed but provider endpoints are configured, synthetic PeerIDs will be automatically generated. These are deterministic identifiers derived from SHA256 hashes of the endpoint URLs, used solely for routing system compatibility. Since these providers use HTTP trustless gateway protocol rather than libp2p, the PeerIDs are purely synthetic and never participate in any cryptographic operations or peer authentication. Default: none diff --git a/main.go b/main.go index c314ae9..dbe244e 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "crypto/sha256" "errors" "fmt" "log" @@ -12,6 +13,7 @@ import ( "github.com/ipfs/go-cid" "github.com/libp2p/go-libp2p/core/peer" "github.com/multiformats/go-multibase" + "github.com/multiformats/go-multihash" "github.com/urfave/cli/v2" ) @@ -175,6 +177,27 @@ func main() { printIfListConfigured("SOMEGUY_PROVIDER_ENDPOINTS = ", cfg.contentEndpoints) printIfListConfigured("SOMEGUY_PEER_ENDPOINTS = ", cfg.peerEndpoints) printIfListConfigured("SOMEGUY_IPNS_ENDPOINTS = ", cfg.ipnsEndpoints) + + if len(cfg.blockProviderEndpoints) > 0 && len(cfg.blockProviderPeerIDs) == 0 { + fmt.Printf("SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS is set but SOMEGUY_HTTP_BLOCK_PROVIDER_PEERIDS were not. PeerIDs will be autogenerated.\n") + // Generate synthetic PeerIDs for HTTP block providers. These are deterministic + // identifiers based on endpoint URLs, used solely for routing system compatibility. + // Since HTTP providers use trustless gateway protocol, these PeerIDs are never + // used for cryptographic operations or libp2p authentication. + for i := 0; i < len(cfg.blockProviderEndpoints); i++ { + digest := sha256.Sum256([]byte(cfg.blockProviderEndpoints[i])) + mh, err := multihash.Encode((digest[:]), multihash.SHA2_256) + if err != nil { + return err + } + p, err := peer.IDFromBytes(mh) + if err != nil { + return err + } + cfg.blockProviderPeerIDs = append(cfg.blockProviderPeerIDs, p.String()) + } + } + printIfListConfigured("SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS = ", cfg.blockProviderEndpoints) printIfListConfigured("SOMEGUY_HTTP_BLOCK_PROVIDER_PEERIDS = ", cfg.blockProviderPeerIDs) From b1bf3106efa916a0cca8aa9637d339fb8c57f2ee Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Mon, 15 Sep 2025 01:25:03 +0200 Subject: [PATCH 4/5] chore: modernize docker build (#118) - update to go 1.25 - add buildkit syntax and cache mounts - fix deprecated ENV syntax - switch from local to gha cache in workflow --- .github/workflows/docker.yml | 21 ++++++--------------- Dockerfile | 26 +++++++++++++++----------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 103f107..b14293b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,13 +28,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - name: Log in to the Container registry uses: docker/login-action@v3 with: @@ -58,12 +51,10 @@ jobs: push: true file: ./Dockerfile tags: "${{ steps.tags.outputs.value }}" - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new + cache-from: | + type=gha + type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: | + type=gha,mode=max + type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: Move cache to limit growth - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/Dockerfile b/Dockerfile index d941c5a..adb7786 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ +# syntax=docker/dockerfile:1 # Builder -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23-bookworm AS builder +FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.25-bookworm AS builder LABEL org.opencontainers.image.source=https://github.com/ipfs/someguy LABEL org.opencontainers.image.documentation=https://github.com/ipfs/someguy#docker @@ -8,17 +9,20 @@ LABEL org.opencontainers.image.licenses=MIT+APACHE_2.0 ARG TARGETPLATFORM TARGETOS TARGETARCH -ENV GOPATH /go -ENV SRC_PATH $GOPATH/src/github.com/ipfs/someguy -ENV GO111MODULE on -ENV GOPROXY https://proxy.golang.org +ENV GOPATH=/go +ENV SRC_PATH=$GOPATH/src/github.com/ipfs/someguy +ENV GO111MODULE=on +ENV GOPROXY=https://proxy.golang.org -COPY go.* $SRC_PATH/ +COPY go.mod go.sum $SRC_PATH/ WORKDIR $SRC_PATH -RUN go mod download +RUN --mount=type=cache,target=/go/pkg/mod \ + go mod download COPY . $SRC_PATH -RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o $GOPATH/bin/someguy +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o $GOPATH/bin/someguy # Runner FROM debian:bookworm-slim @@ -27,9 +31,9 @@ RUN apt-get update && \ apt-get install --no-install-recommends -y tini ca-certificates curl && \ rm -rf /var/lib/apt/lists/* -ENV GOPATH /go -ENV SRC_PATH $GOPATH/src/github.com/ipfs/someguy -ENV DATA_PATH /data/someguy +ENV GOPATH=/go +ENV SRC_PATH=$GOPATH/src/github.com/ipfs/someguy +ENV DATA_PATH=/data/someguy COPY --from=builder $GOPATH/bin/someguy /usr/local/bin/someguy From 18c461a8e837c4929117b972b7cbc1c73129234e Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Mon, 15 Sep 2025 04:14:34 +0200 Subject: [PATCH 5/5] chore: release v0.10.0 (#120) --- CHANGELOG.md | 15 ++++++++++++--- version.json | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd5e788..33f34cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,15 +17,24 @@ The following emojis are used to highlight certain changes: ### Changed -- Updated to [Go 1.25](https://go.dev/doc/go1.25) -- When `SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS` are configured but no `SOMEGUY_HTTP_BLOCK_PROVIDER_PEERIDS` are configured, synthetic PeerIDs will now be autogenerated. These are deterministic placeholders derived from endpoint URLs, used only for routing system compatibility with HTTP-based trustless gateways - no libp2p cryptographic operations are performed with these IDs - ### Removed ### Fixed ### Security +## [v0.10.0] + +### Added + +- Automatic generation of peer IDs for HTTP block providers when not explicitly configured ([#117](https://github.com/ipfs/someguy/pull/117)) + - When `SOMEGUY_HTTP_BLOCK_PROVIDER_ENDPOINTS` are configured but no `SOMEGUY_HTTP_BLOCK_PROVIDER_PEERIDS` are configured, synthetic PeerIDs will now be autogenerated. These are deterministic placeholders derived from endpoint URLs, used only for routing system compatibility with HTTP-based trustless gateways - no libp2p cryptographic operations are performed with these IDs + +### Changed + +- Modernized Docker build configuration ([#118](https://github.com/ipfs/someguy/pull/118)) +- Updated to Go 1.24/1.25 ([#115](https://github.com/ipfs/someguy/pull/115), [#118](https://github.com/ipfs/someguy/pull/118)) + ## [v0.9.1] ### Added diff --git a/version.json b/version.json index 3616e33..3b600f3 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "v0.9.1" + "version": "v0.10.0" }