From 64244dbd9e86d81b947c136c4f9057b32df9b251 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 23 Jun 2023 11:39:02 +0200 Subject: [PATCH] feat(gateway): support for ipip-412 parameters --- core/corehttp/gateway.go | 2 +- docs/changelogs/v0.22.md | 7 +++++++ docs/examples/kubo-as-a-library/go.mod | 2 +- docs/examples/kubo-as-a-library/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- test/dependencies/go.mod | 2 +- test/dependencies/go.sum | 4 ++-- 8 files changed, 17 insertions(+), 10 deletions(-) diff --git a/core/corehttp/gateway.go b/core/corehttp/gateway.go index 25ec19e0fa8..0676a47d7d4 100644 --- a/core/corehttp/gateway.go +++ b/core/corehttp/gateway.go @@ -156,7 +156,7 @@ func (o *offlineGatewayErrWrapper) ResolvePath(ctx context.Context, path gateway return md, err } -func (o *offlineGatewayErrWrapper) GetCAR(ctx context.Context, path gateway.ImmutablePath, params gateway.CarParams) (gateway.ContentPathMetadata, io.ReadCloser, error) { +func (o *offlineGatewayErrWrapper) GetCAR(ctx context.Context, path gateway.ImmutablePath, params *gateway.CarParams) (gateway.ContentPathMetadata, io.ReadCloser, error) { md, data, err := o.gwimpl.GetCAR(ctx, path, params) err = offlineErrWrap(err) return md, data, err diff --git a/docs/changelogs/v0.22.md b/docs/changelogs/v0.22.md index 633741c8810..618eaa6cae8 100644 --- a/docs/changelogs/v0.22.md +++ b/docs/changelogs/v0.22.md @@ -6,6 +6,7 @@ - [Overview](#overview) - [๐Ÿ”ฆ Highlights](#-highlights) + - [Gateway: support for `order=` and `dups=` parameter (IPIP-412)](#gateway-support-for-order-and-dups-parameter-ipip-412) - [`ipfs name publish` now supports V2 only IPNS records](#ipfs-name-publish-now-supports-v2-only-ipns-records) - [๐Ÿ“ Changelog](#-changelog) - [๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributors](#-contributors) @@ -14,6 +15,12 @@ ### ๐Ÿ”ฆ Highlights +#### Gateway: support for `order=` and `dups=` parameter (IPIP-412) + +The gateway now supports optional CAR parameters via the `Accept` header, as +specified in [IPIP-412](https://github.com/ipfs/specs/pull/412). By default, +order is DFS and there are no duplicates. + #### `ipfs name publish` now supports V2 only IPNS records When publishing an IPNS record, you are now able to create v2 only records diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index 7ac4a4cfff8..9d42b422082 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -7,7 +7,7 @@ go 1.18 replace github.com/ipfs/kubo => ./../../.. require ( - github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4 + github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b github.com/ipfs/kubo v0.0.0-00010101000000-000000000000 github.com/libp2p/go-libp2p v0.27.7 github.com/multiformats/go-multiaddr v0.9.0 diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index cd09c1a1d3f..c5c32ff3d31 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -320,8 +320,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= -github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4 h1:TBdjIPaVgphrmtdbz/4BKyYgA1XLBOEBhRDbKXp4jnc= -github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4/go.mod h1:eVXIkLOG+fTJSuXtkANlwLllV1CEayOZnbDClK8ZOQY= +github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b h1:T2RvYfBSC7Ic1g4Aehy/A3pQK9IFE+VjZD8Aori8Bx0= +github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b/go.mod h1:eVXIkLOG+fTJSuXtkANlwLllV1CEayOZnbDClK8ZOQY= github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA= github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU= github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= diff --git a/go.mod b/go.mod index 950be507d99..0bde0a4d370 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/fsnotify/fsnotify v1.6.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4 + github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b github.com/ipfs/go-block-format v0.1.2 github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cidutil v0.1.0 diff --git a/go.sum b/go.sum index b8440afdaa8..d6fa4bb7287 100644 --- a/go.sum +++ b/go.sum @@ -355,8 +355,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= -github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4 h1:TBdjIPaVgphrmtdbz/4BKyYgA1XLBOEBhRDbKXp4jnc= -github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4/go.mod h1:eVXIkLOG+fTJSuXtkANlwLllV1CEayOZnbDClK8ZOQY= +github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b h1:T2RvYfBSC7Ic1g4Aehy/A3pQK9IFE+VjZD8Aori8Bx0= +github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b/go.mod h1:eVXIkLOG+fTJSuXtkANlwLllV1CEayOZnbDClK8ZOQY= github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA= github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU= github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY= diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index 63a26724979..6c4d6416e62 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -7,7 +7,7 @@ replace github.com/ipfs/kubo => ../../ require ( github.com/Kubuxu/gocovmerge v0.0.0-20161216165753-7ecaa51963cd github.com/golangci/golangci-lint v1.49.0 - github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4 + github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cidutil v0.1.0 github.com/ipfs/go-datastore v0.6.0 diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index 482bbfac18e..1cb90254706 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -415,8 +415,8 @@ github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NH github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs= github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0= -github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4 h1:TBdjIPaVgphrmtdbz/4BKyYgA1XLBOEBhRDbKXp4jnc= -github.com/ipfs/boxo v0.10.2-0.20230628084958-a91e44dbdbd4/go.mod h1:eVXIkLOG+fTJSuXtkANlwLllV1CEayOZnbDClK8ZOQY= +github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b h1:T2RvYfBSC7Ic1g4Aehy/A3pQK9IFE+VjZD8Aori8Bx0= +github.com/ipfs/boxo v0.10.2-0.20230629113528-65cc6a865e3b/go.mod h1:eVXIkLOG+fTJSuXtkANlwLllV1CEayOZnbDClK8ZOQY= github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA= github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU= github.com/ipfs/go-block-format v0.1.2 h1:GAjkfhVx1f4YTODS6Esrj1wt2HhrtwTnhEr+DyPUaJo=