Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ipfs/rainbow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.4.0
Choose a base ref
...
head repository: ipfs/rainbow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.5.0
Choose a head ref
  • 6 commits
  • 12 files changed
  • 3 contributors

Commits on Jun 26, 2024

  1. docs: Traceparent

    lidel authored Jun 26, 2024
    Copy the full SHA
    99f0b46 View commit details

Commits on Jun 27, 2024

  1. Copy the full SHA
    1907ca5 View commit details

Commits on Jul 8, 2024

  1. Add end-to-end tests (#151)

    * Add end-to-end tests
    * use ipfs/go-test
    * Set up signal handler sooner to that sigint right after start does not crash daemon
    * Update CHANGELOG
    
    Add basic end-to-end tests to rainbow. This is not a complete set of tests but is a place to start adding end-to-end tests.
    
    Fixes #89
    gammazero authored Jul 8, 2024
    Copy the full SHA
    4737f6f View commit details

Commits on Aug 5, 2024

  1. Copy the full SHA
    2b45b4e View commit details

Commits on Aug 6, 2024

  1. Copy the full SHA
    c544481 View commit details

Commits on Aug 7, 2024

  1. chore: release v1.5.0 (#158)

    * chore: go-libp2p v0.36.1 boxo 0.22.0
    * refactor: remove noopPeerLedger
    * fix: libp2p agent version
    * docs: cache sharing WithPeerBlockRequestFilter
    lidel authored Aug 7, 2024
    Copy the full SHA
    471f095 View commit details
Showing with 232 additions and 125 deletions.
  1. +16 −0 CHANGELOG.md
  2. +8 −0 README.md
  3. +7 −1 docs/environment-variables.md
  4. +14 −2 docs/headers.md
  5. +78 −0 e2e_test.go
  6. +23 −20 go.mod
  7. +51 −59 go.sum
  8. +25 −0 handlers.go
  9. +8 −6 main.go
  10. +0 −36 setup_bitswap.go
  11. +1 −0 setup_routing.go
  12. +1 −1 version.json
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -23,6 +23,22 @@ The following emojis are used to highlight certain changes:

### Security

## [v1.5.0]

### Added

- Simple end-to-end test to check that trustless-gateway-domains are set correctly. [#151](https://github.com/ipfs/rainbow/pull/151) [#157](https://github.com/ipfs/rainbow/pull/157)
- HTTP API to dynamically list logging subsystems and modify logging levels for subsystems. [#156](https://github.com/ipfs/rainbow/pull/156)

### Changed

- go-libp2p [0.36.1](https://github.com/libp2p/go-libp2p/releases/tag/v0.36.1)
- boxo [0.22.0](https://github.com/ipfs/boxo/releases/tag/v0.22.0)

### Fixed

- [libp2p identify agentVersion](https://github.com/libp2p/specs/blob/master/identify/README.md#agentversion) correctly indicates rainbow version when shared host is not used

## [v1.4.0]

### Added
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -134,6 +134,14 @@ Example cURL commmand to run GC:

curl -v --data '{"BytesToFree": 1099511627776}' http://127.0.0.1:8091/mgr/gc

## Logging

While the logging can be controlled via [environment variable](./docs/environment-variables.md#logging) it is also
possible to dynamically modify the logging at runtime.

- `http://$RAINBOW_CTL_LISTEN_ADDRESS/mgr/log/level?subsystem=<system name or * for all system>&level=<level>` will set the logging level for a subsystem
- `http://$RAINBOW_CTL_LISTEN_ADDRESS/mgr/log/ls` will return a comma separated list of available logging subsystems

## Deployment

Suggested method for self-hosting is to run a [prebuilt Docker image](#docker).
8 changes: 7 additions & 1 deletion docs/environment-variables.md
Original file line number Diff line number Diff line change
@@ -189,7 +189,13 @@ queries from these safelisted peers, serving locally cached blocks if requested.
> This saves resources as data cached on other instance can be fetched internally
> (e.g. LAN) rather than externally (WAN, p2p).
Default: `false` (no cache sharing)
> [!CAUTION]
> This mode comes with additional overhead, YMMV. A bitswap server
> applies `WithPeerBlockRequestFilter` and only answers to safelisted peers;
> however may still increase resource usage, as every requested CID will be
> also broadcasted to peered nodes.
Default: `false` (no cache sharing, no bitswap server, client-only)

### `RAINBOW_REMOTE_BACKENDS`

16 changes: 14 additions & 2 deletions docs/headers.md
Original file line number Diff line number Diff line change
@@ -6,11 +6,23 @@ See [`RAINBOW_TRACING_AUTH`](./environment-variables.md#rainbow_tracing_auth)

## `Traceparent`

See [`RAINBOW_TRACING_AUTH`](./environment-variables.md#rainbow_tracing_auth)
Optional. Clients may use this header to return a additional vendor-specific trace identification information across different distributed tracing systems.

Currently ignored unless `Authorization` matches [`RAINBOW_TRACING_AUTH`](./environment-variables.md#rainbow_tracing_auth).

> [!TIP]
> `Traceparent` value format can be found in [W3C Trace Context Specification](https://www.w3.org/TR/trace-context-1/#trace-context-http-headers-format).
>
> Sample code for generating it can be found in [boxo/docs/tracing.md](https://github.com/ipfs/boxo/blob/main/docs/tracing.md#generate-traceparent-header)
## `Tracestate`

See [`RAINBOW_TRACING_AUTH`](./environment-variables.md#rainbow_tracing_auth)
Optional. Clients may use this header to return a additional vendor-specific trace identification information in addition to `Traceparent`.

Currently ignored unless `Authorization` matches [`RAINBOW_TRACING_AUTH`](./environment-variables.md#rainbow_tracing_auth).

> [!TIP]
> `Tracestate` value format can be found in [W3C Trace Context Specification](https://www.w3.org/TR/trace-context-1/#trace-context-http-headers-format).
## Rainbow-No-Blockcache

78 changes: 78 additions & 0 deletions e2e_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package main_test

import (
"context"
"fmt"
"path/filepath"
"runtime"
"testing"
"time"

testcmd "github.com/ipfs/go-test/cmd"
"github.com/stretchr/testify/require"
)

const (
installTimeout = 30 * time.Second
startTimeout = 5 * time.Second
testTimeout = 15 * time.Second
)

func TestEndToEndTrustlessGatewayDomains(t *testing.T) {
switch runtime.GOOS {
case "windows":
t.Skip("skipping test on", runtime.GOOS)
}

runner := testcmd.NewRunner(t, t.TempDir())

ctx, cancel := context.WithTimeout(context.Background(), installTimeout)
defer cancel()

// install rainbow
runner.Run(ctx, "go", "install", ".")
cancel()
rainbow := filepath.Join(runner.Dir, "rainbow")

args := testcmd.Args(rainbow, "--trustless-gateway-domains", "example.org")
ready := testcmd.NewStdoutWatcher("IPFS Gateway listening")
domain := testcmd.NewStdoutWatcher("RAINBOW_TRUSTLESS_GATEWAY_DOMAINS = example.org")

ctx, cancel = context.WithTimeout(context.Background(), testTimeout)
defer cancel()

cmdRainbow := runner.Start(ctx, args, ready, domain)

startCtx, startCancel := context.WithTimeout(context.Background(), startTimeout)
defer startCancel()

err := ready.Wait(startCtx)
require.NoError(t, err)
t.Log("Rainbow is running")

err = domain.Wait(startCtx)
require.NoError(t, err)
t.Log("Correct value set by cli flag --trustless-gateway-domains")

runner.Stop(cmdRainbow, 5*time.Second)
t.Log("Rainbow stopped")

runner.Env = append(runner.Env, fmt.Sprintf("%s=%s", "RAINBOW_TRUSTLESS_GATEWAY_DOMAINS", "example.com"))
domain = testcmd.NewStdoutWatcher("RAINBOW_TRUSTLESS_GATEWAY_DOMAINS = example.com")
cmdRainbow = runner.Start(ctx, testcmd.Args(rainbow), ready, domain)

startCancel()
startCtx, startCancel = context.WithTimeout(context.Background(), startTimeout)
defer startCancel()

err = ready.Wait(startCtx)
require.NoError(t, err)
t.Log("Rainbow is running")

err = domain.Wait(startCtx)
require.NoError(t, err)
t.Log("Correct value set by environ var RAINBOW_TRUSTLESS_GATEWAY_DOMAINS")

runner.Stop(cmdRainbow, 5*time.Second)
t.Log("Rainbow stopped")
}
43 changes: 23 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ require (
github.com/felixge/httpsnoop v1.0.4
github.com/ipfs-shipyard/nopfs v0.0.12
github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231024163508-120e0c51ee3a
github.com/ipfs/boxo v0.21.0
github.com/ipfs/boxo v0.22.0
github.com/ipfs/go-block-format v0.2.0
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-datastore v0.6.0
@@ -20,9 +20,10 @@ require (
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipfs/go-metrics-interface v0.0.1
github.com/ipfs/go-metrics-prometheus v0.0.2
github.com/ipfs/go-test v0.0.4
github.com/ipfs/go-unixfsnode v1.9.0
github.com/ipld/go-codec-dagpb v1.6.0
github.com/libp2p/go-libp2p v0.35.1
github.com/libp2p/go-libp2p v0.36.1
github.com/libp2p/go-libp2p-kad-dht v0.25.2
github.com/libp2p/go-libp2p-record v0.2.0
github.com/libp2p/go-libp2p-routing-helpers v0.7.4
@@ -43,8 +44,8 @@ require (
go.opentelemetry.io/otel v1.27.0
go.opentelemetry.io/otel/sdk v1.27.0
go.opentelemetry.io/otel/trace v1.27.0
golang.org/x/crypto v0.24.0
golang.org/x/sys v0.21.0
golang.org/x/crypto v0.25.0
golang.org/x/sys v0.22.0
)

require (
@@ -82,7 +83,7 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20240625030939-27f56978b8b0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
@@ -142,36 +143,37 @@ require (
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo/v2 v2.19.1 // indirect
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect
github.com/pion/datachannel v1.5.6 // indirect
github.com/pion/dtls/v2 v2.2.11 // indirect
github.com/pion/ice/v2 v2.3.25 // indirect
github.com/pion/datachannel v1.5.8 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/ice/v2 v2.3.32 // indirect
github.com/pion/interceptor v0.1.29 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/mdns v0.0.12 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pion/rtcp v1.2.14 // indirect
github.com/pion/rtp v1.8.6 // indirect
github.com/pion/sctp v1.8.16 // indirect
github.com/pion/rtp v1.8.8 // indirect
github.com/pion/sctp v1.8.20 // indirect
github.com/pion/sdp/v3 v3.0.9 // indirect
github.com/pion/srtp/v2 v2.0.18 // indirect
github.com/pion/srtp/v2 v2.0.20 // indirect
github.com/pion/stun v0.6.1 // indirect
github.com/pion/transport/v2 v2.2.5 // indirect
github.com/pion/transport/v2 v2.2.9 // indirect
github.com/pion/turn/v2 v2.1.6 // indirect
github.com/pion/webrtc/v3 v3.2.43 // indirect
github.com/pion/webrtc/v3 v3.2.50 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.89.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.54.0 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.45.1 // indirect
github.com/quic-go/quic-go v0.45.2 // indirect
github.com/quic-go/webtransport-go v0.8.0 // indirect
github.com/raulk/go-watchdog v1.3.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
@@ -184,6 +186,7 @@ require (
github.com/whyrusleeping/cbor-gen v0.1.2 // indirect
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
github.com/wlynxg/anet v0.0.3 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/contrib/propagators/aws v1.27.0 // indirect
@@ -203,12 +206,12 @@ require (
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gonum.org/v1/gonum v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d // indirect
Loading