From c1eceb1d7eee64a528cf16bda93f11a2feaf183f Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Thu, 26 Jun 2014 00:38:48 -0700 Subject: [PATCH 001/286] Big things have small beginnings. This commit was moved from ipfs/kubo@9d0e6a7ffb5deea2c8c8e555d7bf6bcab6fdc6ac This commit was moved from ipfs/boxo@0cc547ba5ce468b4d79e2c023ad7b49f0438e20e From 1e573836850aef678080d9b74e4780af612c98b6 Mon Sep 17 00:00:00 2001 From: Lars Gierth Date: Sun, 11 Sep 2016 05:09:43 +0200 Subject: [PATCH 002/286] coreapi: get going, add Cat() and Ls() License: MIT Signed-off-by: Lars Gierth This commit was moved from ipfs/interface-go-ipfs-core@d6cc518f50f331dfd20dc79e87319f307fa2b5e7 This commit was moved from ipfs/boxo@9a989442e7cd6463a7473cf7d6ed03e823c8b38a --- core/coreiface/interface.go | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 core/coreiface/interface.go diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go new file mode 100644 index 00000000000..694a116a525 --- /dev/null +++ b/core/coreiface/interface.go @@ -0,0 +1,56 @@ +package iface + +import ( + "context" + "errors" + "io" + + cid "gx/ipfs/QmXfiyr2RWEXpVDdaYnD2HNiBk6UBddsvEP4RPfXb6nGqY/go-cid" +) + +// type CoreAPI interface { +// ID() CoreID +// Version() CoreVersion +// } + +type Link struct { + Name string + Size uint64 + Cid *cid.Cid +} + +type Reader interface { + io.ReadSeeker + io.Closer +} + +type UnixfsAPI interface { + Cat(context.Context, string) (Reader, error) + Ls(context.Context, string) ([]*Link, error) +} + +// type ObjectAPI interface { +// New() (cid.Cid, Object) +// Get(string) (Object, error) +// Links(string) ([]*Link, error) +// Data(string) (Reader, error) +// Stat(string) (ObjectStat, error) +// Put(Object) (cid.Cid, error) +// SetData(string, Reader) (cid.Cid, error) +// AppendData(string, Data) (cid.Cid, error) +// AddLink(string, string, string) (cid.Cid, error) +// RmLink(string, string) (cid.Cid, error) +// } + +// type ObjectStat struct { +// Cid cid.Cid +// NumLinks int +// BlockSize int +// LinksSize int +// DataSize int +// CumulativeSize int +// } + +var ErrIsDir = errors.New("object is a directory") +var ErrIsNonDag = errors.New("not a merkledag object") +var ErrOffline = errors.New("can't resolve, ipfs node is offline") From a4a55e7799c0b5814d14825650fe496d6a229ed8 Mon Sep 17 00:00:00 2001 From: Lars Gierth Date: Tue, 20 Sep 2016 04:30:43 +0200 Subject: [PATCH 003/286] coreapi: add Add() License: MIT Signed-off-by: Lars Gierth This commit was moved from ipfs/interface-go-ipfs-core@87e9bc0419bdabee9aa6534e53a669484ac2e706 This commit was moved from ipfs/boxo@b83c5e3fc362276e9bfa6a34848598556289bdfa --- core/coreiface/interface.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 694a116a525..297e8bfede2 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -25,6 +25,7 @@ type Reader interface { } type UnixfsAPI interface { + Add(context.Context, io.Reader) (*cid.Cid, error) Cat(context.Context, string) (Reader, error) Ls(context.Context, string) ([]*Link, error) } From a3fb17377b56a28ef4e2e62dd620f179cf8bb7df Mon Sep 17 00:00:00 2001 From: Lars Gierth Date: Sun, 30 Oct 2016 03:09:48 +0100 Subject: [PATCH 004/286] coreapi: reuse go-ipld-node.Link License: MIT Signed-off-by: Lars Gierth This commit was moved from ipfs/interface-go-ipfs-core@c34bbcac7cbf4b4b075dac8474dad72ef4b6063b This commit was moved from ipfs/boxo@54a9bc53742ad876e1b9705c10b50fc47d58377d --- core/coreiface/interface.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 297e8bfede2..18328a2a091 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,6 +5,7 @@ import ( "errors" "io" + ipld "gx/ipfs/QmU7bFWQ793qmvNy7outdCaMfSDNk8uqhx4VNrxYj5fj5g/go-ipld-node" cid "gx/ipfs/QmXfiyr2RWEXpVDdaYnD2HNiBk6UBddsvEP4RPfXb6nGqY/go-cid" ) @@ -13,11 +14,7 @@ import ( // Version() CoreVersion // } -type Link struct { - Name string - Size uint64 - Cid *cid.Cid -} +type Link ipld.Link type Reader interface { io.ReadSeeker From 10bf6e91714f6e4f180dd0adccc26ddebb7266fb Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 15 Nov 2016 18:00:49 -0800 Subject: [PATCH 005/286] update to newer ipld node interface with Copy and better Tree License: MIT Signed-off-by: Jeromy This commit was moved from ipfs/interface-go-ipfs-core@23f95c6d1e4016ab5a01c9339b3926fdace37198 This commit was moved from ipfs/boxo@4f28fc777233e298a426081032b35501ea5ae8eb --- core/coreiface/interface.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 18328a2a091..c1c83fa26f7 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - ipld "gx/ipfs/QmU7bFWQ793qmvNy7outdCaMfSDNk8uqhx4VNrxYj5fj5g/go-ipld-node" - cid "gx/ipfs/QmXfiyr2RWEXpVDdaYnD2HNiBk6UBddsvEP4RPfXb6nGqY/go-cid" + ipld "gx/ipfs/QmUsVJ7AEnGyjX8YWnrwq9vmECVGwBQNAKPpgz5KSg8dcq/go-ipld-node" + cid "gx/ipfs/QmcEcrBAMrwMyhSjXt4yfyPpzgSuV8HLHavnfmiKCSRqZU/go-cid" ) // type CoreAPI interface { From 88ba95d954d28e4392c65e47de682efbed6d87b7 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Mon, 28 Nov 2016 22:29:38 -0800 Subject: [PATCH 006/286] bubble up go-datastore deps License: MIT Signed-off-by: Jeromy This commit was moved from ipfs/interface-go-ipfs-core@3f68a10d21f3553c4639f477388b3b36492912a2 This commit was moved from ipfs/boxo@da6ace83a4549449f1c3f08748d0906d0bfeee37 --- core/coreiface/interface.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index c1c83fa26f7..cf64719476e 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - ipld "gx/ipfs/QmUsVJ7AEnGyjX8YWnrwq9vmECVGwBQNAKPpgz5KSg8dcq/go-ipld-node" - cid "gx/ipfs/QmcEcrBAMrwMyhSjXt4yfyPpzgSuV8HLHavnfmiKCSRqZU/go-cid" + ipld "gx/ipfs/QmRSU5EqqWVZSNdbU51yXmVoF1uNw3JgTNB6RaiL7DZM16/go-ipld-node" + cid "gx/ipfs/QmcTcsTvfaeEBRFo1TkFgT8sRmgi1n1LTZpecfVP8fzpGD/go-cid" ) // type CoreAPI interface { From 95beda800ffd616baa7e5216dd86d0efa3dabf20 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Thu, 2 Feb 2017 20:09:02 -0800 Subject: [PATCH 007/286] update go-multihash and bubble up deps License: MIT Signed-off-by: Jeromy This commit was moved from ipfs/interface-go-ipfs-core@c7723c40fead3509cec1fa255fc8531e8e87c744 This commit was moved from ipfs/boxo@c8a57ca4e3df2570f75832b5bebcb925ae647bce --- core/coreiface/interface.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index cf64719476e..b506e65096a 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - ipld "gx/ipfs/QmRSU5EqqWVZSNdbU51yXmVoF1uNw3JgTNB6RaiL7DZM16/go-ipld-node" - cid "gx/ipfs/QmcTcsTvfaeEBRFo1TkFgT8sRmgi1n1LTZpecfVP8fzpGD/go-cid" + cid "gx/ipfs/QmV5gPoRsjN1Gid3LMdNZTyfCtP2DsvqEbMAmz82RmmiGk/go-cid" + ipld "gx/ipfs/QmYDscK7dmdo2GZ9aumS8s5auUUAH5mR1jvj5pYhWusfK7/go-ipld-node" ) // type CoreAPI interface { From 5bce81d63e222d3ea8a7d3a2e1e4aaba6bb179bd Mon Sep 17 00:00:00 2001 From: Lars Gierth Date: Wed, 16 Nov 2016 06:21:15 +0100 Subject: [PATCH 008/286] coreapi: smarter way of dealing with the different APIs License: MIT Signed-off-by: Lars Gierth This commit was moved from ipfs/interface-go-ipfs-core@e69000d481d335aef4d610be31750e8558f3b795 This commit was moved from ipfs/boxo@295f1305501eabc7645b7d947d823148c3b0bb56 --- core/coreiface/interface.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index b506e65096a..7bf9d5c0ac6 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -9,11 +9,6 @@ import ( ipld "gx/ipfs/QmYDscK7dmdo2GZ9aumS8s5auUUAH5mR1jvj5pYhWusfK7/go-ipld-node" ) -// type CoreAPI interface { -// ID() CoreID -// Version() CoreVersion -// } - type Link ipld.Link type Reader interface { @@ -21,6 +16,10 @@ type Reader interface { io.Closer } +type CoreAPI interface { + Unixfs() UnixfsAPI +} + type UnixfsAPI interface { Add(context.Context, io.Reader) (*cid.Cid, error) Cat(context.Context, string) (Reader, error) From 1c53ef3f984b664538ada9d9adf27cdc4ea3c2b6 Mon Sep 17 00:00:00 2001 From: Lars Gierth Date: Fri, 17 Mar 2017 03:47:59 +0100 Subject: [PATCH 009/286] coreapi: make the interfaces path centric The new coreiface.Path maps a path to the cid.Cid resulting from a full path resolution. The path is internally represented as a go-ipfs/path.Path, but that doesn't matter to the outside. Apart from the path-to-CID mapping, it also aims to hold all resolved segment CIDs of the path. Right now it only exposes Root(), and only for flat paths a la /ipfs/Qmfoo. In other cases, the root is nil. In the future, resolution will internally use go-ipfs/path.Resolver.ResolvePathComponents and thus always return the proper resolved segments, via Root(), or a future Segments() func. - Add coreiface.Path with Cid() and Root(). - Add CoreAPI.ResolvePath() for getting a coreiface.Path. - All functions now expect and return coreiface.Path. - Add ParsePath() and ParseCid() for constructing a coreiface.Path. - Add coreiface.Node and Link which are simply go-ipld-node.Node and Link. - Add CoreAPI.ResolveNode() for getting a Node from a Path. License: MIT Signed-off-by: Lars Gierth This commit was moved from ipfs/interface-go-ipfs-core@66af039105d5e4ebc82a178143d8643ad3fed91d This commit was moved from ipfs/boxo@61e07c830c0222fbd796118e7784e24ecf1c7e24 --- core/coreiface/interface.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 7bf9d5c0ac6..d72fc8a3b0b 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -9,6 +9,16 @@ import ( ipld "gx/ipfs/QmYDscK7dmdo2GZ9aumS8s5auUUAH5mR1jvj5pYhWusfK7/go-ipld-node" ) +type Path interface { + String() string + Cid() *cid.Cid + Root() *cid.Cid + Resolved() bool +} + +// TODO: should we really copy these? +// if we didn't, godoc would generate nice links straight to go-ipld-node +type Node ipld.Node type Link ipld.Link type Reader interface { @@ -18,12 +28,14 @@ type Reader interface { type CoreAPI interface { Unixfs() UnixfsAPI + ResolvePath(context.Context, Path) (Path, error) + ResolveNode(context.Context, Path) (Node, error) } type UnixfsAPI interface { - Add(context.Context, io.Reader) (*cid.Cid, error) - Cat(context.Context, string) (Reader, error) - Ls(context.Context, string) ([]*Link, error) + Add(context.Context, io.Reader) (Path, error) + Cat(context.Context, Path) (Reader, error) + Ls(context.Context, Path) ([]*Link, error) } // type ObjectAPI interface { @@ -49,5 +61,4 @@ type UnixfsAPI interface { // } var ErrIsDir = errors.New("object is a directory") -var ErrIsNonDag = errors.New("not a merkledag object") var ErrOffline = errors.New("can't resolve, ipfs node is offline") From 393471674ced3be04563a5667bd5cda91f4e0bc3 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Fri, 24 Mar 2017 23:51:18 -0700 Subject: [PATCH 010/286] bubble up updates from go-multihash changes License: MIT Signed-off-by: Jeromy This commit was moved from ipfs/interface-go-ipfs-core@be73d10538ec977bdb62976f52ac926f5eb83232 This commit was moved from ipfs/boxo@dcecd3345b8ceed091ee2e80857695e170ea5bf2 --- core/coreiface/interface.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index d72fc8a3b0b..a7762c8c2f3 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - cid "gx/ipfs/QmV5gPoRsjN1Gid3LMdNZTyfCtP2DsvqEbMAmz82RmmiGk/go-cid" - ipld "gx/ipfs/QmYDscK7dmdo2GZ9aumS8s5auUUAH5mR1jvj5pYhWusfK7/go-ipld-node" + cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid" + ipld "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format" ) type Path interface { @@ -17,7 +17,7 @@ type Path interface { } // TODO: should we really copy these? -// if we didn't, godoc would generate nice links straight to go-ipld-node +// if we didn't, godoc would generate nice links straight to go-ipld-format type Node ipld.Node type Link ipld.Link From 4c057b0fc32b7ae9c834295946c507c0c03ba752 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sun, 18 Jun 2017 13:07:24 -0700 Subject: [PATCH 011/286] blocks: gx import go-block-format And updated related dependencies. License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@477bd882b4bdd348fd7ef8f35c81f5a11a732199 This commit was moved from ipfs/boxo@8fd5b213838670d5fed83a6ca39240179ab8cf3f --- core/coreiface/interface.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index a7762c8c2f3..273d8e25ab1 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid" - ipld "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format" + cid "gx/ipfs/QmNw61A6sJoXMeP37mJRtQZdNhj5e3FdjoTN3v4FyE96Gk/go-cid" + ipld "gx/ipfs/QmUBtPvHKFAX43XMsyxsYpMi3U5VwZ4jYFTo4kFhvAR33G/go-ipld-format" ) type Path interface { From 3ba2027081fb010676936fd2492a66a6bf3e22a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 4 Jul 2017 20:18:57 +0200 Subject: [PATCH 012/286] Update go-datastore to 1.2.2, go-cid to 0.7.16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@e706b34ea178ca535760a511e3950510e6bb1355 This commit was moved from ipfs/boxo@624057e9d94d8d44cc424dca843027b47fa25ec1 --- core/coreiface/interface.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 273d8e25ab1..363c5adacd1 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - cid "gx/ipfs/QmNw61A6sJoXMeP37mJRtQZdNhj5e3FdjoTN3v4FyE96Gk/go-cid" - ipld "gx/ipfs/QmUBtPvHKFAX43XMsyxsYpMi3U5VwZ4jYFTo4kFhvAR33G/go-ipld-format" + ipld "gx/ipfs/QmPAKbSsgEX5B6fpmxa61jXYnoWzZr5sNafd3qgPiSH8Uv/go-ipld-format" + cid "gx/ipfs/Qma4RJSuh7mMeJQYCqMbKzekn6EwBo7HEs5AQYjVRMQATB/go-cid" ) type Path interface { From a7a3a37e827000bfaa7fb0fa5d68e85748ace90c Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 11 Jul 2017 19:17:51 -0700 Subject: [PATCH 013/286] update go-multihash and bubble up changes License: MIT Signed-off-by: Jeromy This commit was moved from ipfs/interface-go-ipfs-core@ee874380410e6a909c9517ecd58730cb17b4424d This commit was moved from ipfs/boxo@0997d0c7d5f69975acdf597e7266427e54c223b4 --- core/coreiface/interface.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 363c5adacd1..81197bb466e 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - ipld "gx/ipfs/QmPAKbSsgEX5B6fpmxa61jXYnoWzZr5sNafd3qgPiSH8Uv/go-ipld-format" - cid "gx/ipfs/Qma4RJSuh7mMeJQYCqMbKzekn6EwBo7HEs5AQYjVRMQATB/go-cid" + cid "gx/ipfs/QmTprEaAA2A9bst5XH7exuyi5KzNMK3SEDNN8rBDnKWcUS/go-cid" + ipld "gx/ipfs/QmYNyRZJBUYPNrLszFmrBrPJbsBh2vMsefz5gnDpB5M1P6/go-ipld-format" ) type Path interface { From 9065eaf739718d028c3572ecd33ef9bf7a0c28bf Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 28 Aug 2017 20:32:16 -0700 Subject: [PATCH 014/286] gx: update go-cid, go-multibase, base32 License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@6c6807b399ac688cbe92d85156b74cae3bd45321 This commit was moved from ipfs/boxo@d45714f3fa2fcf0224d6b0774cd729941109a450 --- core/coreiface/interface.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 81197bb466e..78a64dd40b4 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - cid "gx/ipfs/QmTprEaAA2A9bst5XH7exuyi5KzNMK3SEDNN8rBDnKWcUS/go-cid" - ipld "gx/ipfs/QmYNyRZJBUYPNrLszFmrBrPJbsBh2vMsefz5gnDpB5M1P6/go-ipld-format" + cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid" + ipld "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format" ) type Path interface { From 0826705811ed121d6044a600c72297cd0a4f3c22 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sun, 3 Dec 2017 21:34:29 -0800 Subject: [PATCH 015/286] gx: update go-multihash License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@b5fea556bf3c13bbeed2b0fe72605f0c23b17ae3 This commit was moved from ipfs/boxo@efbab5e602175954bcef811bbbba89340ebfe687 --- core/coreiface/interface.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 78a64dd40b4..aef86d63ad1 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -5,8 +5,8 @@ import ( "errors" "io" - cid "gx/ipfs/QmNp85zy9RLrQ5oQD4hPyS39ezrrXpcaa7R4Y9kxdWQLLQ/go-cid" - ipld "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format" + ipld "gx/ipfs/QmNwUEK7QbwSqyKBu3mMtToo8SUc6wQJ7gdZq4gGGJqfnf/go-ipld-format" + cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid" ) type Path interface { From 66f305fb517f962ad64a1aa92f4702c4d2b043f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 15 Dec 2017 01:34:49 +0100 Subject: [PATCH 016/286] docs/coreapi: Add some documentation to CoreAPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@2fbdcd09c87e05ff355b4a492b01029273b1f0f3 This commit was moved from ipfs/boxo@9cc221d2ae772fe67425e873db64516bf1bf1f40 --- core/coreiface/interface.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 78a64dd40b4..87e9fcd0ff1 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -1,3 +1,5 @@ +// Package iface defines IPFS Core API which is a set of interfaces used to +// interact with IPFS nodes. package iface import ( @@ -9,6 +11,8 @@ import ( ipld "gx/ipfs/QmPN7cwmpcc4DWXb4KTB9dNAJgjuPY69h3npsMfhRrQL9c/go-ipld-format" ) +// Path is a generic wrapper for paths used in the API. A path can be resolved +// to a CID using one of Resolve functions in the API. type Path interface { String() string Cid() *cid.Cid @@ -26,15 +30,28 @@ type Reader interface { io.Closer } +// CoreAPI defines an unified interface to IPFS for Go programs. type CoreAPI interface { + // Unixfs returns an implementation of Unixfs API Unixfs() UnixfsAPI + + // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, Path) (Path, error) + + // ResolveNode resolves the path (if not resolved already) using Unixfs + // resolver, gets and returns the resolved Node ResolveNode(context.Context, Path) (Node, error) } +// UnixfsAPI is the basic interface to immutable files in IPFS type UnixfsAPI interface { + // Add imports the data from the reader into merkledag file Add(context.Context, io.Reader) (Path, error) + + // Cat returns a reader for the file Cat(context.Context, Path) (Reader, error) + + // Ls returns the list of links in a directory Ls(context.Context, Path) ([]*Link, error) } From 3051f3b60123d981b25e88dd45651064ac9a8511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 8 Dec 2017 22:51:35 +0100 Subject: [PATCH 017/286] coreapi: DAG API proposal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@c6015845cbf43a2b9fc83d749137bee10f9d6396 This commit was moved from ipfs/boxo@b351a5a73c7db7a1dbbbffe546f76563c91c2fa5 --- core/coreiface/interface.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index b753c418441..508588a04c5 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -34,13 +34,14 @@ type Reader interface { type CoreAPI interface { // Unixfs returns an implementation of Unixfs API Unixfs() UnixfsAPI + Dag() DagAPI // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, Path) (Path, error) // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node - ResolveNode(context.Context, Path) (Node, error) + ResolveNode(context.Context, Path) (Node, error) //TODO: should this get dropped in favor of DagAPI.Get? } // UnixfsAPI is the basic interface to immutable files in IPFS @@ -55,6 +56,12 @@ type UnixfsAPI interface { Ls(context.Context, Path) ([]*Link, error) } +type DagAPI interface { + Put(ctx context.Context, src io.Reader, inputEnc string, format *cid.Prefix) ([]Node, error) + Get(ctx context.Context, path Path) (Node, error) + Tree(ctx context.Context, path Path, depth int) ([]Path, error) +} + // type ObjectAPI interface { // New() (cid.Cid, Object) // Get(string) (Object, error) From 363c556e23c5ae12c40fda53fac95500f295f1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 11 Dec 2017 17:22:21 +0100 Subject: [PATCH 018/286] coreapi: add tests for dag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@c593c49d857c407d9e3b6a5576f2cdb5a1fe1e97 This commit was moved from ipfs/boxo@b0b4e68ff7103e39dd2698db9877b96978bc3ec4 --- core/coreiface/interface.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 508588a04c5..ecccc1c6438 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -41,7 +41,7 @@ type CoreAPI interface { // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node - ResolveNode(context.Context, Path) (Node, error) //TODO: should this get dropped in favor of DagAPI.Get? + ResolveNode(context.Context, Path) (Node, error) } // UnixfsAPI is the basic interface to immutable files in IPFS @@ -56,9 +56,17 @@ type UnixfsAPI interface { Ls(context.Context, Path) ([]*Link, error) } +// DagAPI specifies the interface to IPLD type DagAPI interface { - Put(ctx context.Context, src io.Reader, inputEnc string, format *cid.Prefix) ([]Node, error) + // Put inserts data using specified format and input encoding. + // If format is not specified (nil), default dag-cbor/sha256 is used + Put(ctx context.Context, src io.Reader, inputEnc string, format *cid.Prefix) ([]Node, error) //TODO: make format optional + + // Get attempts to resolve and get the node specified by the path Get(ctx context.Context, path Path) (Node, error) + + // Tree returns list of paths within a node specified by the path. + // To get all paths in a tree, set depth to -1 Tree(ctx context.Context, path Path, depth int) ([]Path, error) } From e6a16b57e63b33e1d8ed7f2edb079e1c96527873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 17 Dec 2017 03:23:50 +0100 Subject: [PATCH 019/286] coreapi: functional options for DagAPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@39f8afada852b5189996725ccde10b6d64f1b5ab This commit was moved from ipfs/boxo@9901857d2d284da55025a64aacf72d6ac9c89b1f --- core/coreiface/interface.go | 25 +++++++++-- core/coreiface/options/dag.go | 83 +++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 core/coreiface/options/dag.go diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index ecccc1c6438..f43700e9cb7 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -7,6 +7,8 @@ import ( "errors" "io" + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + ipld "gx/ipfs/QmNwUEK7QbwSqyKBu3mMtToo8SUc6wQJ7gdZq4gGGJqfnf/go-ipld-format" cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid" ) @@ -60,14 +62,31 @@ type UnixfsAPI interface { type DagAPI interface { // Put inserts data using specified format and input encoding. // If format is not specified (nil), default dag-cbor/sha256 is used - Put(ctx context.Context, src io.Reader, inputEnc string, format *cid.Prefix) ([]Node, error) //TODO: make format optional + Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) ([]Node, error) + + // WithInputEnc is an option for Put which specifies the input encoding of the + // data. Default is "json", most formats/codecs support "raw" + WithInputEnc(enc string) options.DagPutOption + + // WithCodec is an option for Put which specifies the multicodec to use to + // serialize the object. Default is cid.DagCBOR (0x71) + WithCodec(codec uint64) options.DagPutOption + + // WithHash is an option for Put which specifies the multihash settings to use + // when hashing the object. Default is based on the codec used + // (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for + // the hash will be used + WithHash(mhType uint64, mhLen int) options.DagPutOption // Get attempts to resolve and get the node specified by the path Get(ctx context.Context, path Path) (Node, error) // Tree returns list of paths within a node specified by the path. - // To get all paths in a tree, set depth to -1 - Tree(ctx context.Context, path Path, depth int) ([]Path, error) + Tree(ctx context.Context, path Path, opts ...options.DagTreeOption) ([]Path, error) + + // WithDepth is an option for Tree which specifies maximum depth of the + // returned tree. Default is -1 (no depth limit) + WithDepth(depth int) options.DagTreeOption } // type ObjectAPI interface { diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go new file mode 100644 index 00000000000..7850c4bc3a8 --- /dev/null +++ b/core/coreiface/options/dag.go @@ -0,0 +1,83 @@ +package options + +import ( + "math" + + cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid" +) + +type DagPutSettings struct { + InputEnc string + Codec uint64 + MhType uint64 + MhLength int +} + +type DagTreeSettings struct { + Depth int +} + +type DagPutOption func(*DagPutSettings) error +type DagTreeOption func(*DagTreeSettings) error + +func DagPutOptions(opts ...DagPutOption) (*DagPutSettings, error) { + options := &DagPutSettings{ + InputEnc: "json", + Codec: cid.DagCBOR, + MhType: math.MaxUint64, + MhLength: -1, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +func DagTreeOptions(opts ...DagTreeOption) (*DagTreeSettings, error) { + options := &DagTreeSettings{ + Depth: -1, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +type DagOptions struct{} + +func (api *DagOptions) WithInputEnc(enc string) DagPutOption { + return func(settings *DagPutSettings) error { + settings.InputEnc = enc + return nil + } +} + +func (api *DagOptions) WithCodec(codec uint64) DagPutOption { + return func(settings *DagPutSettings) error { + settings.Codec = codec + return nil + } +} + +func (api *DagOptions) WithHash(mhType uint64, mhLen int) DagPutOption { + return func(settings *DagPutSettings) error { + settings.MhType = mhType + settings.MhLength = mhLen + return nil + } +} + +func (api *DagOptions) WithDepth(depth int) DagTreeOption { + return func(settings *DagTreeSettings) error { + settings.Depth = depth + return nil + } +} From e68b73b54ed06fc8b078bc4866efe1653f6dae4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 21 Dec 2017 01:56:41 +0100 Subject: [PATCH 020/286] coreapi: dag review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@20fa7a599e839af20bef873f12fcc2f94fd0c529 This commit was moved from ipfs/boxo@bae5f5303ec03d6399c3345ba6c14397812b1ead --- core/coreiface/interface.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index f43700e9cb7..e51888e6012 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -61,8 +61,9 @@ type UnixfsAPI interface { // DagAPI specifies the interface to IPLD type DagAPI interface { // Put inserts data using specified format and input encoding. - // If format is not specified (nil), default dag-cbor/sha256 is used - Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) ([]Node, error) + // Unless used with WithCodec or WithHash, the defaults "dag-cbor" and + // "sha256" are used. + Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) (Path, error) // WithInputEnc is an option for Put which specifies the input encoding of the // data. Default is "json", most formats/codecs support "raw" From 71593fb48cd8b6b4bc7590d7b1cfa8b662ef611d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 10 Dec 2017 23:15:37 +0100 Subject: [PATCH 021/286] coreapi: Name API proposal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@1b5e997ca845b58519a3592db60c78d4ec7efdc8 This commit was moved from ipfs/boxo@8972ab9e110214d72b9c048240ac75e33bd69248 --- core/coreiface/interface.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index e51888e6012..3fcf7374e1b 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -6,6 +6,7 @@ import ( "context" "errors" "io" + "time" options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" @@ -27,6 +28,11 @@ type Path interface { type Node ipld.Node type Link ipld.Link +type IpnsEntry struct { + Name string + Value Path +} + type Reader interface { io.ReadSeeker io.Closer @@ -37,6 +43,7 @@ type CoreAPI interface { // Unixfs returns an implementation of Unixfs API Unixfs() UnixfsAPI Dag() DagAPI + Name() NameAPI // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, Path) (Path, error) @@ -90,6 +97,18 @@ type DagAPI interface { WithDepth(depth int) options.DagTreeOption } +type NameAPI interface { + Publish(ctx context.Context, path Path, validTime time.Duration, key string) (*IpnsEntry, error) + Resolve(ctx context.Context, name string, recursive bool, local bool, nocache bool) (Path, error) +} + +type KeyApi interface { + Generate(ctx context.Context, name string, algorithm string, size int) error + List(ctx context.Context) (map[string]string, error) //TODO: better key type? + Rename(ctx context.Context, oldName string, newName string) error + Remove(ctx context.Context, name string) error +} + // type ObjectAPI interface { // New() (cid.Cid, Object) // Get(string) (Object, error) From cb3c588799f563e5597d3855ccff3a10b915c13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 10 Dec 2017 23:48:16 +0100 Subject: [PATCH 022/286] coreapi: Keystore API proposal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@4fbdf56dc24b8b7357c0eb06c223093c506c1bbc This commit was moved from ipfs/boxo@286e418f6c66494631d6b570b1ec86396c13e2f0 --- core/coreiface/interface.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 3fcf7374e1b..f6412d68fad 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -44,6 +44,7 @@ type CoreAPI interface { Unixfs() UnixfsAPI Dag() DagAPI Name() NameAPI + Key() KeyAPI // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, Path) (Path, error) @@ -102,11 +103,11 @@ type NameAPI interface { Resolve(ctx context.Context, name string, recursive bool, local bool, nocache bool) (Path, error) } -type KeyApi interface { - Generate(ctx context.Context, name string, algorithm string, size int) error +type KeyAPI interface { + Generate(ctx context.Context, name string, algorithm string, size int) (string, error) List(ctx context.Context) (map[string]string, error) //TODO: better key type? - Rename(ctx context.Context, oldName string, newName string) error - Remove(ctx context.Context, name string) error + Rename(ctx context.Context, oldName string, newName string, force bool) (string, bool, error) + Remove(ctx context.Context, name string) (string, error) } // type ObjectAPI interface { From d52ea2fe1ae543d162b8bb03dab2ab3c7f18d8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 13 Dec 2017 19:05:23 +0100 Subject: [PATCH 023/286] coreapi: name/key functional options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@7a786c5509ec924e3cfe2c29b42f76c47ccecbc4 This commit was moved from ipfs/boxo@c02dc49770c2cbbb89c695c8e83bfc1276c6d665 --- core/coreiface/interface.go | 19 ++++++-- core/coreiface/options/key.go | 65 +++++++++++++++++++++++++ core/coreiface/options/name.go | 89 ++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 core/coreiface/options/key.go create mode 100644 core/coreiface/options/name.go diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index f6412d68fad..36bd801a140 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -99,14 +99,25 @@ type DagAPI interface { } type NameAPI interface { - Publish(ctx context.Context, path Path, validTime time.Duration, key string) (*IpnsEntry, error) - Resolve(ctx context.Context, name string, recursive bool, local bool, nocache bool) (Path, error) + Publish(ctx context.Context, path Path, opts ...options.NamePublishOption) (*IpnsEntry, error) + WithValidTime(validTime time.Duration) options.NamePublishOption + WithKey(key string) options.NamePublishOption + + Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (Path, error) + WithRecursive(recursive bool) options.NameResolveOption + WithLocal(local bool) options.NameResolveOption + WithNoCache(nocache bool) options.NameResolveOption } type KeyAPI interface { - Generate(ctx context.Context, name string, algorithm string, size int) (string, error) + Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (string, error) + WithAlgorithm(algorithm string) options.KeyGenerateOption + WithSize(size int) options.KeyGenerateOption + + Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (string, bool, error) + WithForce(force bool) options.KeyRenameOption + List(ctx context.Context) (map[string]string, error) //TODO: better key type? - Rename(ctx context.Context, oldName string, newName string, force bool) (string, bool, error) Remove(ctx context.Context, name string) (string, error) } diff --git a/core/coreiface/options/key.go b/core/coreiface/options/key.go new file mode 100644 index 00000000000..5ed7b408f56 --- /dev/null +++ b/core/coreiface/options/key.go @@ -0,0 +1,65 @@ +package options + +type KeyGenerateSettings struct { + Algorithm string + Size int +} + +type KeyRenameSettings struct { + Force bool +} + +type KeyGenerateOption func(*KeyGenerateSettings) error +type KeyRenameOption func(*KeyRenameSettings) error + +func KeyGenerateOptions(opts ...KeyGenerateOption) (*KeyGenerateSettings, error) { + options := &KeyGenerateSettings{ + Algorithm: "rsa", + Size: 0, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +func KeyRenameOptions(opts ...KeyRenameOption) (*KeyRenameSettings, error) { + options := &KeyRenameSettings{ + Force: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +type KeyOptions struct{} + +func (api *KeyOptions) WithAlgorithm(algorithm string) KeyGenerateOption { + return func(settings *KeyGenerateSettings) error { + settings.Algorithm = algorithm + return nil + } +} + +func (api *KeyOptions) WithSize(size int) KeyGenerateOption { + return func(settings *KeyGenerateSettings) error { + settings.Size = size + return nil + } +} + +func (api *KeyOptions) WithForce(force bool) KeyRenameOption { + return func(settings *KeyRenameSettings) error { + settings.Force = force + return nil + } +} diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go new file mode 100644 index 00000000000..aa21291620d --- /dev/null +++ b/core/coreiface/options/name.go @@ -0,0 +1,89 @@ +package options + +import ( + "time" +) + +type NamePublishSettings struct { + ValidTime time.Duration + Key string +} + +type NameResolveSettings struct { + Recursive bool + Local bool + Nocache bool +} + +type NamePublishOption func(*NamePublishSettings) error +type NameResolveOption func(*NameResolveSettings) error + +func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) { + options := &NamePublishSettings{ + ValidTime: 24 * time.Hour, + Key: "self", + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + + return options, nil +} + +func NameResolveOptions(opts ...NameResolveOption) (*NameResolveSettings, error) { + options := &NameResolveSettings{ + Recursive: false, + Local: false, + Nocache: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + + return options, nil +} + +type NameOptions struct{} + +func (api *NameOptions) WithValidTime(validTime time.Duration) NamePublishOption { + return func(settings *NamePublishSettings) error { + settings.ValidTime = validTime + return nil + } +} + +func (api *NameOptions) WithKey(key string) NamePublishOption { + return func(settings *NamePublishSettings) error { + settings.Key = key + return nil + } +} + +func (api *NameOptions) WithRecursive(recursive bool) NameResolveOption { + return func(settings *NameResolveSettings) error { + settings.Recursive = recursive + return nil + } +} + +func (api *NameOptions) WithLocal(local bool) NameResolveOption { + return func(settings *NameResolveSettings) error { + settings.Local = local + return nil + } +} + +func (api *NameOptions) WithNoCache(nocache bool) NameResolveOption { + return func(settings *NameResolveSettings) error { + settings.Nocache = nocache + return nil + } +} From b92cca8429acecf498e37fd438df15a323e4c246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 15 Dec 2017 01:03:53 +0100 Subject: [PATCH 024/286] coreapi: Documentation for Name/Key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@74695ab9b4f2efc64b6a88fcd900fbd67a63b416 This commit was moved from ipfs/boxo@d733fa263ca5d8340684f8c062ef474000f54fe7 --- core/coreiface/interface.go | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 36bd801a140..a861e470013 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -98,26 +98,73 @@ type DagAPI interface { WithDepth(depth int) options.DagTreeOption } +// NameAPI specifies the interface to IPNS. +// +// IPNS is a PKI namespace, where names are the hashes of public keys, and the +// private key enables publishing new (signed) values. In both publish and +// resolve, the default name used is the node's own PeerID, which is the hash of +// its public key. +// +// You can use .Key API to list and generate more names and their respective keys. type NameAPI interface { + // Publish announces new IPNS name Publish(ctx context.Context, path Path, opts ...options.NamePublishOption) (*IpnsEntry, error) + + // WithValidTime is an option for Publish which specifies for how long the + // entry will remain valid. Default value is 24h WithValidTime(validTime time.Duration) options.NamePublishOption + + // WithKey is an option for Publish which specifies the key to use for + // publishing. Default value is "self" which is the node's own PeerID. + // + // You can use .Key API to list and generate more names and their respective keys. WithKey(key string) options.NamePublishOption + // Resolve attempts to resolve the newest version of the specified name Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (Path, error) + + // WithRecursive is an option for Resolve which specifies whether to perform a + // recursive lookup. Default value is false WithRecursive(recursive bool) options.NameResolveOption + + // WithLocal is an option for Resolve which specifies if the lookup should be + // offline. Default value is false WithLocal(local bool) options.NameResolveOption + + // WithNoCache is an option for Resolve which specifies when set to true + // disables the use of local name cache. Default value is false WithNoCache(nocache bool) options.NameResolveOption } +// KeyAPI specifies the interface to Keystore type KeyAPI interface { + // Generate generates new key, stores it in the keystore under the specified + // name and returns a base58 encoded multihash of it's public key Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (string, error) + + // WithAlgorithm is an option for Generate which specifies which algorithm + // should be used for the key. Default is "rsa" + // + // Supported algorithms: + // * rsa + // * ed25519 WithAlgorithm(algorithm string) options.KeyGenerateOption + + // WithSize is an option for Generate which specifies the size of the key to + // generated. Default is 0 WithSize(size int) options.KeyGenerateOption + // Rename renames oldName key to newName. Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (string, bool, error) + + // WithForce is an option for Rename which specifies whether to allow to + // replace existing keys. WithForce(force bool) options.KeyRenameOption + // List lists keys stored in keystore List(ctx context.Context) (map[string]string, error) //TODO: better key type? + + // Remove removes keys from keystore Remove(ctx context.Context, name string) (string, error) } From 1caf71766f81e4c950ed4d527b4c5933cdd53726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 17 Dec 2017 03:44:13 +0100 Subject: [PATCH 025/286] coreapi: name/key review suggestions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@8f7e0241ec5a85f3acaf3152107bd9ad202f56a8 This commit was moved from ipfs/boxo@d0730a47d3a8d4e4be5cc9d1886b8b5a32816267 --- core/coreiface/interface.go | 45 ++++++++++++++++++++-------------- core/coreiface/options/key.go | 7 +++++- core/coreiface/options/name.go | 14 +++++++---- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index a861e470013..0086bd0d629 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -28,16 +28,21 @@ type Path interface { type Node ipld.Node type Link ipld.Link -type IpnsEntry struct { - Name string - Value Path -} - type Reader interface { io.ReadSeeker io.Closer } +type IpnsEntry interface { + Name() string + Value() Path +} + +type Key interface { + Name() string + Path() Path +} + // CoreAPI defines an unified interface to IPFS for Go programs. type CoreAPI interface { // Unixfs returns an implementation of Unixfs API @@ -108,7 +113,7 @@ type DagAPI interface { // You can use .Key API to list and generate more names and their respective keys. type NameAPI interface { // Publish announces new IPNS name - Publish(ctx context.Context, path Path, opts ...options.NamePublishOption) (*IpnsEntry, error) + Publish(ctx context.Context, path Path, opts ...options.NamePublishOption) (IpnsEntry, error) // WithValidTime is an option for Publish which specifies for how long the // entry will remain valid. Default value is 24h @@ -116,8 +121,9 @@ type NameAPI interface { // WithKey is an option for Publish which specifies the key to use for // publishing. Default value is "self" which is the node's own PeerID. + // The key parameter must be either PeerID or keystore key alias. // - // You can use .Key API to list and generate more names and their respective keys. + // You can use KeyAPI to list and generate more names and their respective keys. WithKey(key string) options.NamePublishOption // Resolve attempts to resolve the newest version of the specified name @@ -131,41 +137,42 @@ type NameAPI interface { // offline. Default value is false WithLocal(local bool) options.NameResolveOption - // WithNoCache is an option for Resolve which specifies when set to true - // disables the use of local name cache. Default value is false - WithNoCache(nocache bool) options.NameResolveOption + // WithCache is an option for Resolve which specifies if cache should be used. + // Default value is true + WithCache(cache bool) options.NameResolveOption } // KeyAPI specifies the interface to Keystore type KeyAPI interface { // Generate generates new key, stores it in the keystore under the specified // name and returns a base58 encoded multihash of it's public key - Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (string, error) + Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (Key, error) // WithAlgorithm is an option for Generate which specifies which algorithm - // should be used for the key. Default is "rsa" + // should be used for the key. Default is options.RSAKey // // Supported algorithms: - // * rsa - // * ed25519 + // * options.RSAKey + // * options.Ed25519Key WithAlgorithm(algorithm string) options.KeyGenerateOption // WithSize is an option for Generate which specifies the size of the key to // generated. Default is 0 WithSize(size int) options.KeyGenerateOption - // Rename renames oldName key to newName. - Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (string, bool, error) + // Rename renames oldName key to newName. Returns the key and whether another + // key was overwritten, or an error + Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (Key, bool, error) // WithForce is an option for Rename which specifies whether to allow to // replace existing keys. WithForce(force bool) options.KeyRenameOption // List lists keys stored in keystore - List(ctx context.Context) (map[string]string, error) //TODO: better key type? + List(ctx context.Context) ([]Key, error) - // Remove removes keys from keystore - Remove(ctx context.Context, name string) (string, error) + // Remove removes keys from keystore. Returns ipns path of the removed key + Remove(ctx context.Context, name string) (Path, error) } // type ObjectAPI interface { diff --git a/core/coreiface/options/key.go b/core/coreiface/options/key.go index 5ed7b408f56..c84f0f8f8b8 100644 --- a/core/coreiface/options/key.go +++ b/core/coreiface/options/key.go @@ -1,5 +1,10 @@ package options +const ( + RSAKey = "rsa" + Ed25519Key = "ed25519" +) + type KeyGenerateSettings struct { Algorithm string Size int @@ -14,7 +19,7 @@ type KeyRenameOption func(*KeyRenameSettings) error func KeyGenerateOptions(opts ...KeyGenerateOption) (*KeyGenerateSettings, error) { options := &KeyGenerateSettings{ - Algorithm: "rsa", + Algorithm: RSAKey, Size: 0, } diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index aa21291620d..9f8aaafc83e 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -4,6 +4,10 @@ import ( "time" ) +const ( + DefaultNameValidTime = 24 * time.Hour +) + type NamePublishSettings struct { ValidTime time.Duration Key string @@ -12,7 +16,7 @@ type NamePublishSettings struct { type NameResolveSettings struct { Recursive bool Local bool - Nocache bool + Cache bool } type NamePublishOption func(*NamePublishSettings) error @@ -20,7 +24,7 @@ type NameResolveOption func(*NameResolveSettings) error func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) { options := &NamePublishSettings{ - ValidTime: 24 * time.Hour, + ValidTime: DefaultNameValidTime, Key: "self", } @@ -38,7 +42,7 @@ func NameResolveOptions(opts ...NameResolveOption) (*NameResolveSettings, error) options := &NameResolveSettings{ Recursive: false, Local: false, - Nocache: false, + Cache: true, } for _, opt := range opts { @@ -81,9 +85,9 @@ func (api *NameOptions) WithLocal(local bool) NameResolveOption { } } -func (api *NameOptions) WithNoCache(nocache bool) NameResolveOption { +func (api *NameOptions) WithCache(cache bool) NameResolveOption { return func(settings *NameResolveSettings) error { - settings.Nocache = nocache + settings.Cache = cache return nil } } From 89776d9be77cc98652446551a29bcce5b4aba89c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 1 Jan 2018 18:59:07 +0100 Subject: [PATCH 026/286] coreapi: key tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@ed5f040416bbc6a72008cf3c9f299c47da6f42f1 This commit was moved from ipfs/boxo@6527d6e06318ce93a01a40d769225f9ad4fce6b2 --- core/coreiface/interface.go | 6 +++--- core/coreiface/options/key.go | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 0086bd0d629..dc836566991 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -148,13 +148,13 @@ type KeyAPI interface { // name and returns a base58 encoded multihash of it's public key Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (Key, error) - // WithAlgorithm is an option for Generate which specifies which algorithm + // WithType is an option for Generate which specifies which algorithm // should be used for the key. Default is options.RSAKey // - // Supported algorithms: + // Supported key types: // * options.RSAKey // * options.Ed25519Key - WithAlgorithm(algorithm string) options.KeyGenerateOption + WithType(algorithm string) options.KeyGenerateOption // WithSize is an option for Generate which specifies the size of the key to // generated. Default is 0 diff --git a/core/coreiface/options/key.go b/core/coreiface/options/key.go index c84f0f8f8b8..114361875a5 100644 --- a/core/coreiface/options/key.go +++ b/core/coreiface/options/key.go @@ -3,6 +3,8 @@ package options const ( RSAKey = "rsa" Ed25519Key = "ed25519" + + DefaultRSALen = 2048 ) type KeyGenerateSettings struct { @@ -20,7 +22,7 @@ type KeyRenameOption func(*KeyRenameSettings) error func KeyGenerateOptions(opts ...KeyGenerateOption) (*KeyGenerateSettings, error) { options := &KeyGenerateSettings{ Algorithm: RSAKey, - Size: 0, + Size: -1, } for _, opt := range opts { @@ -48,7 +50,7 @@ func KeyRenameOptions(opts ...KeyRenameOption) (*KeyRenameSettings, error) { type KeyOptions struct{} -func (api *KeyOptions) WithAlgorithm(algorithm string) KeyGenerateOption { +func (api *KeyOptions) WithType(algorithm string) KeyGenerateOption { return func(settings *KeyGenerateSettings) error { settings.Algorithm = algorithm return nil From ef926cb0e353d66321a5bc364c53b9adc2b7800b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 2 Jan 2018 00:53:48 +0100 Subject: [PATCH 027/286] coreapi: Name tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@d28b9301ac2ca1a9e209680ba5bb613f19cbb6fe This commit was moved from ipfs/boxo@78823e7ccbdc16b651c269f86e4cf5915144250a --- core/coreiface/interface.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index dc836566991..cdbb2508bd0 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -157,7 +157,10 @@ type KeyAPI interface { WithType(algorithm string) options.KeyGenerateOption // WithSize is an option for Generate which specifies the size of the key to - // generated. Default is 0 + // generated. Default is -1 + // + // value of -1 means 'use default size for key type': + // * 2048 for RSA WithSize(size int) options.KeyGenerateOption // Rename renames oldName key to newName. Returns the key and whether another From 4124018bc2dbec4efc870ce6046e941bc8987fc3 Mon Sep 17 00:00:00 2001 From: ForrestWeston Date: Mon, 22 Jan 2018 14:44:46 -0800 Subject: [PATCH 028/286] interface docs for coreapi interface License: MIT Signed-off-by: ForrestWeston This commit was moved from ipfs/interface-go-ipfs-core@2c3137f0557f44ca23730ff134b38b9426731e56 This commit was moved from ipfs/boxo@4d4c3dc176859461010b576f9af66919f34aaed3 --- core/coreiface/interface.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index cdbb2508bd0..720f935e28e 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -17,9 +17,13 @@ import ( // Path is a generic wrapper for paths used in the API. A path can be resolved // to a CID using one of Resolve functions in the API. type Path interface { + // String returns the path as a string. String() string + // Cid returns cid referred to by path Cid() *cid.Cid + // Root returns cid of root path Root() *cid.Cid + // Resolved returns whether path has been fully resolved Resolved() bool } @@ -33,22 +37,31 @@ type Reader interface { io.Closer } +// IpnsEntry specifies the interface to IpnsEntries type IpnsEntry interface { + // Name returns IpnsEntry name Name() string + // Value returns IpnsEntry value Value() Path } +// Key specifies the interface to Keys in KeyAPI Keystore type Key interface { + // Key returns key name Name() string + // Path returns key path Path() Path } // CoreAPI defines an unified interface to IPFS for Go programs. type CoreAPI interface { - // Unixfs returns an implementation of Unixfs API + // Unixfs returns an implementation of Unixfs API. Unixfs() UnixfsAPI + // Dag returns an implementation of Dag API. Dag() DagAPI + // Name returns an implementation of Name API. Name() NameAPI + // Key returns an implementation of Key API. Key() KeyAPI // ResolvePath resolves the path using Unixfs resolver From 4727b6e77612b3a2534f77853c113856be0a1842 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 24 Jan 2018 15:55:28 -0800 Subject: [PATCH 029/286] gx: mass update License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@318e958cdd426798e644612d76dc294463975f71 This commit was moved from ipfs/boxo@5e7d211f6eb13d87e9a47729d28beb2a4250aa14 --- core/coreiface/interface.go | 4 ++-- core/coreiface/options/dag.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 720f935e28e..6e00d51ab43 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -10,8 +10,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmNwUEK7QbwSqyKBu3mMtToo8SUc6wQJ7gdZq4gGGJqfnf/go-ipld-format" - cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid" + cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" + ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" ) // Path is a generic wrapper for paths used in the API. A path can be resolved diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index 7850c4bc3a8..b56fcd81a6e 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -3,7 +3,7 @@ package options import ( "math" - cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid" + cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" ) type DagPutSettings struct { From 9f5914daf7841d111ce090c3214a39035e653261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 14 Dec 2017 23:55:24 +0100 Subject: [PATCH 030/286] coreapi: Basic object API implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@52f5b7ce1f8cc0503ec9d9ce070afdee7997049c This commit was moved from ipfs/boxo@f10a09d9b25f8ec1a43f7e93f9fe182ca5ef82ff --- core/coreiface/interface.go | 44 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 720f935e28e..2c31d01b17d 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -191,27 +191,29 @@ type KeyAPI interface { Remove(ctx context.Context, name string) (Path, error) } -// type ObjectAPI interface { -// New() (cid.Cid, Object) -// Get(string) (Object, error) -// Links(string) ([]*Link, error) -// Data(string) (Reader, error) -// Stat(string) (ObjectStat, error) -// Put(Object) (cid.Cid, error) -// SetData(string, Reader) (cid.Cid, error) -// AppendData(string, Data) (cid.Cid, error) -// AddLink(string, string, string) (cid.Cid, error) -// RmLink(string, string) (cid.Cid, error) -// } - -// type ObjectStat struct { -// Cid cid.Cid -// NumLinks int -// BlockSize int -// LinksSize int -// DataSize int -// CumulativeSize int -// } +//TODO: Should this use paths instead of cids? +type ObjectAPI interface { + New(ctx context.Context) (Node, error) + Put(context.Context, Node) error + Get(context.Context, Path) (Node, error) + Data(context.Context, Path) (io.Reader, error) + Links(context.Context, Path) ([]*Link, error) + Stat(context.Context, Path) (*ObjectStat, error) + + AddLink(ctx context.Context, base Path, name string, child Path, create bool) (Node, error) //TODO: make create optional + RmLink(context.Context, Path, string) (Node, error) + AppendData(context.Context, Path, io.Reader) (Node, error) + SetData(context.Context, Path, io.Reader) (Node, error) +} + +type ObjectStat struct { + Cid *cid.Cid + NumLinks int + BlockSize int + LinksSize int + DataSize int + CumulativeSize int +} var ErrIsDir = errors.New("object is a directory") var ErrOffline = errors.New("can't resolve, ipfs node is offline") From b031da2463b9041ca7d09064746067a69b8ae7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 22 Dec 2017 17:22:53 +0100 Subject: [PATCH 031/286] coreapi: Object api review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@3b4b26deb1bc75aefe85df809afca5e3e09f71c6 This commit was moved from ipfs/boxo@85688ca1e91bcfa3cc7441142e5391b760b2b43c --- core/coreiface/interface.go | 10 ++++-- core/coreiface/options/object.go | 56 ++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 core/coreiface/options/object.go diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 2c31d01b17d..db993a5c34e 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -193,14 +193,18 @@ type KeyAPI interface { //TODO: Should this use paths instead of cids? type ObjectAPI interface { - New(ctx context.Context) (Node, error) - Put(context.Context, Node) error + New(context.Context, ...options.ObjectNewOption) (Node, error) + WithType(string) options.ObjectNewOption + + Put(context.Context, Node) (Path, error) Get(context.Context, Path) (Node, error) Data(context.Context, Path) (io.Reader, error) Links(context.Context, Path) ([]*Link, error) Stat(context.Context, Path) (*ObjectStat, error) - AddLink(ctx context.Context, base Path, name string, child Path, create bool) (Node, error) //TODO: make create optional + AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Node, error) + WithCreate(create bool) options.ObjectAddLinkOption + RmLink(context.Context, Path, string) (Node, error) AppendData(context.Context, Path, io.Reader) (Node, error) SetData(context.Context, Path, io.Reader) (Node, error) diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go new file mode 100644 index 00000000000..6a144ab2b69 --- /dev/null +++ b/core/coreiface/options/object.go @@ -0,0 +1,56 @@ +package options + +type ObjectNewSettings struct { + Type string +} + +type ObjectAddLinkSettings struct { + Create bool +} + +type ObjectNewOption func(*ObjectNewSettings) error +type ObjectAddLinkOption func(*ObjectAddLinkSettings) error + +func ObjectNewOptions(opts ...ObjectNewOption) (*ObjectNewSettings, error) { + options := &ObjectNewSettings{ + Type: "empty", + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +func ObjectAddLinkOptions(opts ...ObjectAddLinkOption) (*ObjectAddLinkSettings, error) { + options := &ObjectAddLinkSettings{ + Create: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +type ObjectOptions struct{} + +func (api *ObjectOptions) WithType(t string) ObjectNewOption { + return func(settings *ObjectNewSettings) error { + settings.Type = t + return nil + } +} + +func (api *ObjectOptions) WithCreate(create bool) ObjectAddLinkOption { + return func(settings *ObjectAddLinkSettings) error { + settings.Create = create + return nil + } +} From a806b175fa13ec957955c7678a8165d6c1ef25fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 2 Jan 2018 21:22:20 +0100 Subject: [PATCH 032/286] coreapi: object docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@55c56578038a9e748aa996f7f9cb7dc1b546f1ac This commit was moved from ipfs/boxo@36545a88bcc2f636493de49939e8105d7fd1977c --- core/coreiface/interface.go | 55 ++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index db993a5c34e..7809c8b99b7 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -191,31 +191,72 @@ type KeyAPI interface { Remove(ctx context.Context, name string) (Path, error) } -//TODO: Should this use paths instead of cids? +// ObjectAPI specifies the interface to MerkleDAG and contains useful utilities +// for manipulating MerkleDAG data structures. type ObjectAPI interface { + // New creates new, empty (by default) dag-node. New(context.Context, ...options.ObjectNewOption) (Node, error) + + // WithType is an option for New which allows to change the type of created + // dag node. + // + // Supported types: + // * 'empty' - Empty node + // * 'unixfs-dir' - Empty UnixFS directory WithType(string) options.ObjectNewOption + // Put imports the node into merkledag Put(context.Context, Node) (Path, error) + + // Get returns the node for the path Get(context.Context, Path) (Node, error) + + // Data returns reader for data of the node Data(context.Context, Path) (io.Reader, error) + + // Links returns lint or links the node contains Links(context.Context, Path) ([]*Link, error) + + // Stat returns information about the node Stat(context.Context, Path) (*ObjectStat, error) + // AddLink adds a link under the specified path. child path can point to a + // subdirectory within the patent which must be present (can be overridden + // with WithCreate option). AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Node, error) + + // WithCreate is an option for AddLink which specifies whether create required + // directories for the child WithCreate(create bool) options.ObjectAddLinkOption - RmLink(context.Context, Path, string) (Node, error) + // RmLink removes a link from the node + RmLink(ctx context.Context, base Path, link string) (Node, error) + + // AppendData appends data to the node AppendData(context.Context, Path, io.Reader) (Node, error) + + // SetData sets the data contained in the node SetData(context.Context, Path, io.Reader) (Node, error) } +// ObjectStat provides information about dag nodes type ObjectStat struct { - Cid *cid.Cid - NumLinks int - BlockSize int - LinksSize int - DataSize int + // Cid is the CID of the node + Cid *cid.Cid + + // NumLinks is number of links the node contains + NumLinks int + + // BlockSize is size of the raw serialized node + BlockSize int + + // LinksSize is size of the links block section + LinksSize int + + // DataSize is the size of data block section + DataSize int + + // CumulativeSize is size of node CumulativeSize int } From 540ec53bf8308b9b45d1ebbfc6e23d775ec779f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Jan 2018 17:20:16 +0100 Subject: [PATCH 033/286] coreapi: implement object.Put MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@104bc87d13e259e45b68c3d00231e140a7b88fb6 This commit was moved from ipfs/boxo@8162a16f7c173b07fa645d5a20121f1ad29e5198 --- core/coreiface/interface.go | 15 +++++++++++++-- core/coreiface/options/object.go | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 7809c8b99b7..3e0e3d46057 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -64,6 +64,9 @@ type CoreAPI interface { // Key returns an implementation of Key API. Key() KeyAPI + // ObjectAPI returns an implementation of Object API + Object() ObjectAPI + // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, Path) (Path, error) @@ -205,8 +208,16 @@ type ObjectAPI interface { // * 'unixfs-dir' - Empty UnixFS directory WithType(string) options.ObjectNewOption - // Put imports the node into merkledag - Put(context.Context, Node) (Path, error) + // Put imports the data into merkledag + Put(context.Context, io.Reader, ...options.ObjectPutOption) (Path, error) + + // WithInputEnc is an option for Put which specifies the input encoding of the + // data. Default is "json". + // + // Supported encodings: + // * "protobuf" + // * "json" + WithInputEnc(e string) options.ObjectPutOption // Get returns the node for the path Get(context.Context, Path) (Node, error) diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go index 6a144ab2b69..fe86a1cdede 100644 --- a/core/coreiface/options/object.go +++ b/core/coreiface/options/object.go @@ -4,11 +4,16 @@ type ObjectNewSettings struct { Type string } +type ObjectPutSettings struct { + InputEnc string +} + type ObjectAddLinkSettings struct { Create bool } type ObjectNewOption func(*ObjectNewSettings) error +type ObjectPutOption func(*ObjectPutSettings) error type ObjectAddLinkOption func(*ObjectAddLinkSettings) error func ObjectNewOptions(opts ...ObjectNewOption) (*ObjectNewSettings, error) { @@ -25,6 +30,20 @@ func ObjectNewOptions(opts ...ObjectNewOption) (*ObjectNewSettings, error) { return options, nil } +func ObjectPutOptions(opts ...ObjectPutOption) (*ObjectPutSettings, error) { + options := &ObjectPutSettings{ + InputEnc: "json", + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + func ObjectAddLinkOptions(opts ...ObjectAddLinkOption) (*ObjectAddLinkSettings, error) { options := &ObjectAddLinkSettings{ Create: false, @@ -48,6 +67,13 @@ func (api *ObjectOptions) WithType(t string) ObjectNewOption { } } +func (api *ObjectOptions) WithInputEnc(e string) ObjectPutOption { + return func(settings *ObjectPutSettings) error { + settings.InputEnc = e + return nil + } +} + func (api *ObjectOptions) WithCreate(create bool) ObjectAddLinkOption { return func(settings *ObjectAddLinkSettings) error { settings.Create = create From a8a84d5b1bc8125a5113e80b994193e8f3fab9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 5 Jan 2018 01:13:07 +0100 Subject: [PATCH 034/286] coreapi: object API tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@858d49b07c296b36a58fa4d4469f5e08a9f9b5e7 This commit was moved from ipfs/boxo@d878d812272fc70b7e3e799f139056885dab474f --- core/coreiface/interface.go | 18 +++++++++++++----- core/coreiface/options/object.go | 9 +++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 3e0e3d46057..9dca7f3c94f 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -219,6 +219,14 @@ type ObjectAPI interface { // * "json" WithInputEnc(e string) options.ObjectPutOption + // WithDataType specifies the encoding of data field when using Josn or XML + // input encoding. + // + // Supported types: + // * "text" (default) + // * "base64" + WithDataType(t string) options.ObjectPutOption + // Get returns the node for the path Get(context.Context, Path) (Node, error) @@ -234,20 +242,20 @@ type ObjectAPI interface { // AddLink adds a link under the specified path. child path can point to a // subdirectory within the patent which must be present (can be overridden // with WithCreate option). - AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Node, error) + AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Path, error) // WithCreate is an option for AddLink which specifies whether create required // directories for the child WithCreate(create bool) options.ObjectAddLinkOption // RmLink removes a link from the node - RmLink(ctx context.Context, base Path, link string) (Node, error) + RmLink(ctx context.Context, base Path, link string) (Path, error) // AppendData appends data to the node - AppendData(context.Context, Path, io.Reader) (Node, error) + AppendData(context.Context, Path, io.Reader) (Path, error) // SetData sets the data contained in the node - SetData(context.Context, Path, io.Reader) (Node, error) + SetData(context.Context, Path, io.Reader) (Path, error) } // ObjectStat provides information about dag nodes @@ -267,7 +275,7 @@ type ObjectStat struct { // DataSize is the size of data block section DataSize int - // CumulativeSize is size of node + // CumulativeSize is size of the tree (BlockSize + link sizes) CumulativeSize int } diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go index fe86a1cdede..9c8c9a9ddd1 100644 --- a/core/coreiface/options/object.go +++ b/core/coreiface/options/object.go @@ -6,6 +6,7 @@ type ObjectNewSettings struct { type ObjectPutSettings struct { InputEnc string + DataType string } type ObjectAddLinkSettings struct { @@ -33,6 +34,7 @@ func ObjectNewOptions(opts ...ObjectNewOption) (*ObjectNewSettings, error) { func ObjectPutOptions(opts ...ObjectPutOption) (*ObjectPutSettings, error) { options := &ObjectPutSettings{ InputEnc: "json", + DataType: "text", } for _, opt := range opts { @@ -74,6 +76,13 @@ func (api *ObjectOptions) WithInputEnc(e string) ObjectPutOption { } } +func (api *ObjectOptions) WithDataType(t string) ObjectPutOption { + return func(settings *ObjectPutSettings) error { + settings.DataType = t + return nil + } +} + func (api *ObjectOptions) WithCreate(create bool) ObjectAddLinkOption { return func(settings *ObjectAddLinkSettings) error { settings.Create = create From c56118567677371082f7ff08a2556b101a887b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 5 Jan 2018 01:50:14 +0100 Subject: [PATCH 035/286] coreapi: draft block API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@3cd2995b5bd80584d23ba16037045558a17d04b9 This commit was moved from ipfs/boxo@3a525b897573cdf1e8d493d004e6b9623f07527b --- core/coreiface/interface.go | 18 ++++++++++++++++++ core/coreiface/options/block.go | 14 ++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 core/coreiface/options/block.go diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index ddcdc8db67f..147a85412b3 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -53,6 +53,11 @@ type Key interface { Path() Path } +type BlockStat interface { + Size() int + Path() Path +} + // CoreAPI defines an unified interface to IPFS for Go programs. type CoreAPI interface { // Unixfs returns an implementation of Unixfs API. @@ -87,6 +92,19 @@ type UnixfsAPI interface { Ls(context.Context, Path) ([]*Link, error) } +type BlockAPI interface { + Put(context.Context, io.Reader) (Path, error) + WithCodec(codec uint64) options.BlockPutOption + WithHash(mhType uint64, mhLen int) options.BlockPutOption + + Get(context.Context) (io.Reader, error) + + Rm(context.Context) error + WithForce(force bool) options.BlockRmOption + + Stat(context.Context) (BlockStat, error) +} + // DagAPI specifies the interface to IPLD type DagAPI interface { // Put inserts data using specified format and input encoding. diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go new file mode 100644 index 00000000000..e2473e3f737 --- /dev/null +++ b/core/coreiface/options/block.go @@ -0,0 +1,14 @@ +package options + +type BlockPutSettings struct { + Codec uint64 + MhType uint64 + MhLength int +} + +type BlockRmSettings struct { + Force bool +} + +type BlockPutOption func(*BlockPutSettings) error +type BlockRmOption func(*BlockRmSettings) error From 6b6fdcde60d8198b343e0449533a3fa3e306cff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 6 Jan 2018 16:57:41 +0100 Subject: [PATCH 036/286] coreapi: implement block API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@a7509ebfcac3b153716fc1d2cf4bf021d8ece1b5 This commit was moved from ipfs/boxo@bfcc5b4d08e6efbcfb31f0551db2630613b94b49 --- core/coreiface/interface.go | 12 ++++--- core/coreiface/options/block.go | 61 ++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 147a85412b3..bbe544344bd 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -62,6 +62,8 @@ type BlockStat interface { type CoreAPI interface { // Unixfs returns an implementation of Unixfs API. Unixfs() UnixfsAPI + // Block returns an implementation of Block API. + Block() BlockAPI // Dag returns an implementation of Dag API. Dag() DagAPI // Name returns an implementation of Name API. @@ -93,16 +95,16 @@ type UnixfsAPI interface { } type BlockAPI interface { - Put(context.Context, io.Reader) (Path, error) - WithCodec(codec uint64) options.BlockPutOption + Put(context.Context, io.Reader, ...options.BlockPutOption) (Path, error) + WithFormat(codec string) options.BlockPutOption WithHash(mhType uint64, mhLen int) options.BlockPutOption - Get(context.Context) (io.Reader, error) + Get(context.Context, Path) (io.Reader, error) - Rm(context.Context) error + Rm(context.Context, Path, ...options.BlockRmOption) error WithForce(force bool) options.BlockRmOption - Stat(context.Context) (BlockStat, error) + Stat(context.Context, Path) (BlockStat, error) } // DagAPI specifies the interface to IPLD diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index e2473e3f737..7e6ad3230bb 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -1,7 +1,12 @@ package options +import ( + //cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid" + "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash" +) + type BlockPutSettings struct { - Codec uint64 + Codec string MhType uint64 MhLength int } @@ -12,3 +17,57 @@ type BlockRmSettings struct { type BlockPutOption func(*BlockPutSettings) error type BlockRmOption func(*BlockRmSettings) error + +func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, error) { + options := &BlockPutSettings{ + Codec: "v0", + MhType: multihash.SHA2_256, + MhLength: -1, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +func BlockRmOptions(opts ...BlockRmOption) (*BlockRmSettings, error) { + options := &BlockRmSettings{ + Force: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +type BlockOptions struct{} + +func (api *BlockOptions) WithFormat(codec string) BlockPutOption { + return func(settings *BlockPutSettings) error { + settings.Codec = codec + return nil + } +} + +func (api *BlockOptions) WithHash(mhType uint64, mhLen int) BlockPutOption { + return func(settings *BlockPutSettings) error { + settings.MhType = mhType + settings.MhLength = mhLen + return nil + } +} + +func (api *BlockOptions) WithForce(force bool) BlockRmOption { + return func(settings *BlockRmSettings) error { + settings.Force = force + return nil + } +} From 3615341299acfa25c0061a7afaf60339dc596913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 6 Jan 2018 17:13:33 +0100 Subject: [PATCH 037/286] corapi: block docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@1ffde91c6cc373e97ed28eb80ad3fb9ddf5103e1 This commit was moved from ipfs/boxo@db1f6da007f8c3d45668459b81d4b99559b0cea7 --- core/coreiface/interface.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index bbe544344bd..2402ecf8138 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -94,16 +94,35 @@ type UnixfsAPI interface { Ls(context.Context, Path) ([]*Link, error) } +// BlockAPI specifies the interface to the block layer type BlockAPI interface { + // Put imports raw block data, hashing it using specified settings. Put(context.Context, io.Reader, ...options.BlockPutOption) (Path, error) + + // WithFormat is an option for Put which specifies the multicodec to use to + // serialize the object. Default is "v0" WithFormat(codec string) options.BlockPutOption + + // WithHash is an option for Put which specifies the multihash settings to use + // when hashing the object. Default is mh.SHA2_256 (0x12). + // If mhLen is set to -1, default length for the hash will be used WithHash(mhType uint64, mhLen int) options.BlockPutOption + // Get attempts to resolve the path and return a reader for data in the block Get(context.Context, Path) (io.Reader, error) + // Rm removes the block specified by the path from local blockstore. + // By default an error will be returned if the block can't be found locally. + // + // NOTE: If the specified block is pinned it won't be removed and no error + // will be returned Rm(context.Context, Path, ...options.BlockRmOption) error + + // WithForce is an option for Rm which, when set to true, will ignore + // non-existing blocks WithForce(force bool) options.BlockRmOption + // Stat returns information on Stat(context.Context, Path) (BlockStat, error) } From b47c82f3c79aa8bcfae27c7f022f62e5362a0b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 31 Jan 2018 00:34:51 +0100 Subject: [PATCH 038/286] coreapi: update block after update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@bf7867a20c4aed75aead015b6c720b16645e9626 This commit was moved from ipfs/boxo@72b62f5f64893169686ccb5569f41545c3ba8c67 --- core/coreiface/interface.go | 4 ++++ core/coreiface/options/block.go | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 2402ecf8138..95351e7d045 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -62,12 +62,16 @@ type BlockStat interface { type CoreAPI interface { // Unixfs returns an implementation of Unixfs API. Unixfs() UnixfsAPI + // Block returns an implementation of Block API. Block() BlockAPI + // Dag returns an implementation of Dag API. Dag() DagAPI + // Name returns an implementation of Name API. Name() NameAPI + // Key returns an implementation of Key API. Key() KeyAPI diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 7e6ad3230bb..bbb14612f44 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -1,8 +1,7 @@ package options import ( - //cid "gx/ipfs/QmeSrf6pzut73u6zLQkRFQ3ygt3k6XFT2kjdYP8Tnkwwyg/go-cid" - "gx/ipfs/QmYeKnKpubCMRiq3PGZcTREErthbb5Q9cXsCoSkD9bjEBd/go-multihash" + "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash" ) type BlockPutSettings struct { From 9e02119ee9a6281648fd71aa658a0eaf4a04f341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 9 Jan 2018 01:10:03 +0100 Subject: [PATCH 039/286] coreapi: pin draft MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@b3293937f6e9b665c70038d40b304844fd015930 This commit was moved from ipfs/boxo@7b5b64eefb105adf64cc51224ea381a15239767a --- core/coreiface/interface.go | 44 ++++++++++++++++++++++++++ core/coreiface/options/pin.go | 58 +++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 core/coreiface/options/pin.go diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 95351e7d045..40fa4131e40 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -58,6 +58,15 @@ type BlockStat interface { Path() Path } +// Pin holds information about pinned resource +type Pin interface { + // Path to the pinned object + Path() Path + + // Type of the pin + Type() string +} + // CoreAPI defines an unified interface to IPFS for Go programs. type CoreAPI interface { // Unixfs returns an implementation of Unixfs API. @@ -322,5 +331,40 @@ type ObjectStat struct { CumulativeSize int } +// PinAPI specifies the interface to pining +type PinAPI interface { + // Add creates new pin, be default recursive - pinning the whole referenced + // tree + Add(context.Context, Path, ...options.PinAddOption) error + + // WithRecursive is an option for Add which specifies whether to pin an entire + // object tree or just one object. Default: true + WithRecursive(bool) options.PinAddOption + + // Ls returns list of pinned objects on this node + Ls(context.Context) ([]Pin, error) + + // WithType is an option for Ls which allows to specify which pin types should + // be returned + // + // Supported values: + // * "direct" - directly pinned objects + // * "recursive" - roots of recursive pins + // * "indirect" - indirectly pinned objects (referenced by recursively pinned + // objects) + // * "all" - all pinned objects (default) + WithType(string) options.PinLsOption + + // Rm removes pin for object specified by the path + Rm(context.Context, Path) error + + // Update changes one pin to another, skipping checks for matching paths in + // the old tree + Update(ctx context.Context, from Path, to Path) error + + // Verify verifies the integrity of pinned objects + Verify(context.Context) error +} + var ErrIsDir = errors.New("object is a directory") var ErrOffline = errors.New("can't resolve, ipfs node is offline") diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go new file mode 100644 index 00000000000..4ad16d55584 --- /dev/null +++ b/core/coreiface/options/pin.go @@ -0,0 +1,58 @@ +package options + +type PinAddSettings struct { + Recursive bool +} + +type PinLsSettings struct { + Type string +} + +type PinAddOption func(*PinAddSettings) error +type PinLsOption func(settings *PinLsSettings) error + +func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { + options := &PinAddSettings{ + Recursive: true, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + + return options, nil +} + +func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { + options := &PinLsSettings{ + Type: "all", + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + + return options, nil +} + +type PinOptions struct{} + +func (api *PinOptions) WithRecursive(recucsive bool) PinAddOption { + return func(settings *PinAddSettings) error { + settings.Recursive = recucsive + return nil + } +} + +func (api *PinOptions) WithType(t string) PinLsOption { + return func(settings *PinLsSettings) error { + settings.Type = t + return nil + } +} From ae6dbb3642d43bb9b1bbb798a564a120965ab21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 10 Jan 2018 18:41:06 +0100 Subject: [PATCH 040/286] coreapi: implement pin api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@4597fde83e61fa8d63fa7aef8a3118f7e441b6db This commit was moved from ipfs/boxo@c1c32446e398484fac04c9a35c4ca92f930bbe2a --- core/coreiface/interface.go | 25 ++++++++++++++++++++++--- core/coreiface/options/pin.go | 27 +++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 40fa4131e40..75a168bf3e8 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -67,6 +67,24 @@ type Pin interface { Type() string } +// PinStatus holds information about pin health +type PinStatus interface { + // Ok indicates whether the pin has been verified to be correct + Ok() bool + + // BadNodes returns any bad (usually missing) nodes from the pin + BadNodes() []BadPinNode +} + +// BadPinNode is a node that has been marked as bad by Pin.Verify +type BadPinNode interface { + // Path is the path of the node + Path() Path + + // Err is the reason why the node has been marked as bad + Err() error +} + // CoreAPI defines an unified interface to IPFS for Go programs. type CoreAPI interface { // Unixfs returns an implementation of Unixfs API. @@ -83,6 +101,7 @@ type CoreAPI interface { // Key returns an implementation of Key API. Key() KeyAPI + Pin() PinAPI // ObjectAPI returns an implementation of Object API Object() ObjectAPI @@ -342,7 +361,7 @@ type PinAPI interface { WithRecursive(bool) options.PinAddOption // Ls returns list of pinned objects on this node - Ls(context.Context) ([]Pin, error) + Ls(context.Context, ...options.PinLsOption) ([]Pin, error) // WithType is an option for Ls which allows to specify which pin types should // be returned @@ -360,10 +379,10 @@ type PinAPI interface { // Update changes one pin to another, skipping checks for matching paths in // the old tree - Update(ctx context.Context, from Path, to Path) error + Update(ctx context.Context, from Path, to Path, opts ...options.PinUpdateOption) error // Verify verifies the integrity of pinned objects - Verify(context.Context) error + Verify(context.Context) (<-chan PinStatus, error) } var ErrIsDir = errors.New("object is a directory") diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index 4ad16d55584..f97f7b16ee1 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -8,8 +8,13 @@ type PinLsSettings struct { Type string } +type PinUpdateSettings struct { + Unpin bool +} + type PinAddOption func(*PinAddSettings) error type PinLsOption func(settings *PinLsSettings) error +type PinUpdateOption func(*PinUpdateSettings) error func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { options := &PinAddSettings{ @@ -41,6 +46,21 @@ func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { return options, nil } +func PinUpdateOptions(opts ...PinUpdateOption) (*PinUpdateSettings, error) { + options := &PinUpdateSettings{ + Unpin: true, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + + return options, nil +} + type PinOptions struct{} func (api *PinOptions) WithRecursive(recucsive bool) PinAddOption { @@ -56,3 +76,10 @@ func (api *PinOptions) WithType(t string) PinLsOption { return nil } } + +func (api *PinOptions) WithUnpin(unpin bool) PinUpdateOption { + return func(settings *PinUpdateSettings) error { + settings.Unpin = unpin + return nil + } +} From a313b37f486d3e8ad1cbdfcb3f61e884b7e30b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 17:59:43 +0100 Subject: [PATCH 041/286] coreapi: move unixfs errors to the top MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@848f12365b041d32adfa2ba7d5e3b30a1bc4233b This commit was moved from ipfs/boxo@963f83df40b7e960430e8da91aef942e58278acd --- core/coreiface/interface.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 75a168bf3e8..4d68b5f4be9 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -14,6 +14,9 @@ import ( ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" ) +var ErrIsDir = errors.New("object is a directory") +var ErrOffline = errors.New("can't resolve, ipfs node is offline") + // Path is a generic wrapper for paths used in the API. A path can be resolved // to a CID using one of Resolve functions in the API. type Path interface { @@ -384,6 +387,3 @@ type PinAPI interface { // Verify verifies the integrity of pinned objects Verify(context.Context) (<-chan PinStatus, error) } - -var ErrIsDir = errors.New("object is a directory") -var ErrOffline = errors.New("can't resolve, ipfs node is offline") From 3f4a3d552477f2c4387e67f79ff30991a2121525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 18:31:28 +0100 Subject: [PATCH 042/286] coreapi: don't alias ipld types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@ab9053378b45e67758591727b9140366d4874fc9 This commit was moved from ipfs/boxo@222c7a617e1ee17ba106b5e5279c15931138abc9 --- core/coreiface/interface.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go index 4d68b5f4be9..02525c0d2b7 100644 --- a/core/coreiface/interface.go +++ b/core/coreiface/interface.go @@ -30,11 +30,6 @@ type Path interface { Resolved() bool } -// TODO: should we really copy these? -// if we didn't, godoc would generate nice links straight to go-ipld-format -type Node ipld.Node -type Link ipld.Link - type Reader interface { io.ReadSeeker io.Closer @@ -114,7 +109,7 @@ type CoreAPI interface { // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node - ResolveNode(context.Context, Path) (Node, error) + ResolveNode(context.Context, Path) (ipld.Node, error) } // UnixfsAPI is the basic interface to immutable files in IPFS @@ -126,7 +121,7 @@ type UnixfsAPI interface { Cat(context.Context, Path) (Reader, error) // Ls returns the list of links in a directory - Ls(context.Context, Path) ([]*Link, error) + Ls(context.Context, Path) ([]*ipld.Link, error) } // BlockAPI specifies the interface to the block layer @@ -183,7 +178,7 @@ type DagAPI interface { WithHash(mhType uint64, mhLen int) options.DagPutOption // Get attempts to resolve and get the node specified by the path - Get(ctx context.Context, path Path) (Node, error) + Get(ctx context.Context, path Path) (ipld.Node, error) // Tree returns list of paths within a node specified by the path. Tree(ctx context.Context, path Path, opts ...options.DagTreeOption) ([]Path, error) @@ -272,7 +267,7 @@ type KeyAPI interface { // for manipulating MerkleDAG data structures. type ObjectAPI interface { // New creates new, empty (by default) dag-node. - New(context.Context, ...options.ObjectNewOption) (Node, error) + New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) // WithType is an option for New which allows to change the type of created // dag node. @@ -302,13 +297,13 @@ type ObjectAPI interface { WithDataType(t string) options.ObjectPutOption // Get returns the node for the path - Get(context.Context, Path) (Node, error) + Get(context.Context, Path) (ipld.Node, error) // Data returns reader for data of the node Data(context.Context, Path) (io.Reader, error) // Links returns lint or links the node contains - Links(context.Context, Path) ([]*Link, error) + Links(context.Context, Path) ([]*ipld.Link, error) // Stat returns information about the node Stat(context.Context, Path) (*ObjectStat, error) From cdda2d3e4b7274fc60c237b3b72083f86a710779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 18:46:45 +0100 Subject: [PATCH 043/286] coreapi: split the interface into multiple files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@d4077754e8de62308542ca3838c8f280ca4aad22 This commit was moved from ipfs/boxo@a05b8c4e76d49997baeb11f87f247965fe2b33ed --- core/coreiface/block.go | 49 +++++ core/coreiface/coreapi.go | 38 ++++ core/coreiface/dag.go | 42 ++++ core/coreiface/errors.go | 6 + core/coreiface/interface.go | 384 ------------------------------------ core/coreiface/key.go | 51 +++++ core/coreiface/name.go | 55 ++++++ core/coreiface/object.go | 96 +++++++++ core/coreiface/path.go | 18 ++ core/coreiface/pin.go | 69 +++++++ core/coreiface/unixfs.go | 20 ++ core/coreiface/util.go | 10 + 12 files changed, 454 insertions(+), 384 deletions(-) create mode 100644 core/coreiface/block.go create mode 100644 core/coreiface/coreapi.go create mode 100644 core/coreiface/dag.go create mode 100644 core/coreiface/errors.go delete mode 100644 core/coreiface/interface.go create mode 100644 core/coreiface/key.go create mode 100644 core/coreiface/name.go create mode 100644 core/coreiface/object.go create mode 100644 core/coreiface/path.go create mode 100644 core/coreiface/pin.go create mode 100644 core/coreiface/unixfs.go create mode 100644 core/coreiface/util.go diff --git a/core/coreiface/block.go b/core/coreiface/block.go new file mode 100644 index 00000000000..f38a664c302 --- /dev/null +++ b/core/coreiface/block.go @@ -0,0 +1,49 @@ +package iface + +import ( + "context" + "io" + + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +// BlockStat contains information about a block +type BlockStat interface { + // Size is the size of a block + Size() int + + // Path returns path to the block + Path() Path +} + +// BlockAPI specifies the interface to the block layer +type BlockAPI interface { + // Put imports raw block data, hashing it using specified settings. + Put(context.Context, io.Reader, ...options.BlockPutOption) (Path, error) + + // WithFormat is an option for Put which specifies the multicodec to use to + // serialize the object. Default is "v0" + WithFormat(codec string) options.BlockPutOption + + // WithHash is an option for Put which specifies the multihash settings to use + // when hashing the object. Default is mh.SHA2_256 (0x12). + // If mhLen is set to -1, default length for the hash will be used + WithHash(mhType uint64, mhLen int) options.BlockPutOption + + // Get attempts to resolve the path and return a reader for data in the block + Get(context.Context, Path) (io.Reader, error) + + // Rm removes the block specified by the path from local blockstore. + // By default an error will be returned if the block can't be found locally. + // + // NOTE: If the specified block is pinned it won't be removed and no error + // will be returned + Rm(context.Context, Path, ...options.BlockRmOption) error + + // WithForce is an option for Rm which, when set to true, will ignore + // non-existing blocks + WithForce(force bool) options.BlockRmOption + + // Stat returns information on + Stat(context.Context, Path) (BlockStat, error) +} diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go new file mode 100644 index 00000000000..f1388e5bcd7 --- /dev/null +++ b/core/coreiface/coreapi.go @@ -0,0 +1,38 @@ +// Package iface defines IPFS Core API which is a set of interfaces used to +// interact with IPFS nodes. +package iface + +import ( + "context" + + ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" +) + +// CoreAPI defines an unified interface to IPFS for Go programs. +type CoreAPI interface { + // Unixfs returns an implementation of Unixfs API. + Unixfs() UnixfsAPI + + // Block returns an implementation of Block API. + Block() BlockAPI + + // Dag returns an implementation of Dag API. + Dag() DagAPI + + // Name returns an implementation of Name API. + Name() NameAPI + + // Key returns an implementation of Key API. + Key() KeyAPI + Pin() PinAPI + + // ObjectAPI returns an implementation of Object API + Object() ObjectAPI + + // ResolvePath resolves the path using Unixfs resolver + ResolvePath(context.Context, Path) (Path, error) + + // ResolveNode resolves the path (if not resolved already) using Unixfs + // resolver, gets and returns the resolved Node + ResolveNode(context.Context, Path) (ipld.Node, error) +} diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go new file mode 100644 index 00000000000..1635d71b1cb --- /dev/null +++ b/core/coreiface/dag.go @@ -0,0 +1,42 @@ +package iface + +import ( + "context" + "io" + + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + + ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" +) + +// DagAPI specifies the interface to IPLD +type DagAPI interface { + // Put inserts data using specified format and input encoding. + // Unless used with WithCodec or WithHash, the defaults "dag-cbor" and + // "sha256" are used. + Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) (Path, error) + + // WithInputEnc is an option for Put which specifies the input encoding of the + // data. Default is "json", most formats/codecs support "raw" + WithInputEnc(enc string) options.DagPutOption + + // WithCodec is an option for Put which specifies the multicodec to use to + // serialize the object. Default is cid.DagCBOR (0x71) + WithCodec(codec uint64) options.DagPutOption + + // WithHash is an option for Put which specifies the multihash settings to use + // when hashing the object. Default is based on the codec used + // (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for + // the hash will be used + WithHash(mhType uint64, mhLen int) options.DagPutOption + + // Get attempts to resolve and get the node specified by the path + Get(ctx context.Context, path Path) (ipld.Node, error) + + // Tree returns list of paths within a node specified by the path. + Tree(ctx context.Context, path Path, opts ...options.DagTreeOption) ([]Path, error) + + // WithDepth is an option for Tree which specifies maximum depth of the + // returned tree. Default is -1 (no depth limit) + WithDepth(depth int) options.DagTreeOption +} diff --git a/core/coreiface/errors.go b/core/coreiface/errors.go new file mode 100644 index 00000000000..73442be11ac --- /dev/null +++ b/core/coreiface/errors.go @@ -0,0 +1,6 @@ +package iface + +import "errors" + +var ErrIsDir = errors.New("object is a directory") +var ErrOffline = errors.New("can't resolve, ipfs node is offline") diff --git a/core/coreiface/interface.go b/core/coreiface/interface.go deleted file mode 100644 index 02525c0d2b7..00000000000 --- a/core/coreiface/interface.go +++ /dev/null @@ -1,384 +0,0 @@ -// Package iface defines IPFS Core API which is a set of interfaces used to -// interact with IPFS nodes. -package iface - -import ( - "context" - "errors" - "io" - "time" - - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" - ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" -) - -var ErrIsDir = errors.New("object is a directory") -var ErrOffline = errors.New("can't resolve, ipfs node is offline") - -// Path is a generic wrapper for paths used in the API. A path can be resolved -// to a CID using one of Resolve functions in the API. -type Path interface { - // String returns the path as a string. - String() string - // Cid returns cid referred to by path - Cid() *cid.Cid - // Root returns cid of root path - Root() *cid.Cid - // Resolved returns whether path has been fully resolved - Resolved() bool -} - -type Reader interface { - io.ReadSeeker - io.Closer -} - -// IpnsEntry specifies the interface to IpnsEntries -type IpnsEntry interface { - // Name returns IpnsEntry name - Name() string - // Value returns IpnsEntry value - Value() Path -} - -// Key specifies the interface to Keys in KeyAPI Keystore -type Key interface { - // Key returns key name - Name() string - // Path returns key path - Path() Path -} - -type BlockStat interface { - Size() int - Path() Path -} - -// Pin holds information about pinned resource -type Pin interface { - // Path to the pinned object - Path() Path - - // Type of the pin - Type() string -} - -// PinStatus holds information about pin health -type PinStatus interface { - // Ok indicates whether the pin has been verified to be correct - Ok() bool - - // BadNodes returns any bad (usually missing) nodes from the pin - BadNodes() []BadPinNode -} - -// BadPinNode is a node that has been marked as bad by Pin.Verify -type BadPinNode interface { - // Path is the path of the node - Path() Path - - // Err is the reason why the node has been marked as bad - Err() error -} - -// CoreAPI defines an unified interface to IPFS for Go programs. -type CoreAPI interface { - // Unixfs returns an implementation of Unixfs API. - Unixfs() UnixfsAPI - - // Block returns an implementation of Block API. - Block() BlockAPI - - // Dag returns an implementation of Dag API. - Dag() DagAPI - - // Name returns an implementation of Name API. - Name() NameAPI - - // Key returns an implementation of Key API. - Key() KeyAPI - Pin() PinAPI - - // ObjectAPI returns an implementation of Object API - Object() ObjectAPI - - // ResolvePath resolves the path using Unixfs resolver - ResolvePath(context.Context, Path) (Path, error) - - // ResolveNode resolves the path (if not resolved already) using Unixfs - // resolver, gets and returns the resolved Node - ResolveNode(context.Context, Path) (ipld.Node, error) -} - -// UnixfsAPI is the basic interface to immutable files in IPFS -type UnixfsAPI interface { - // Add imports the data from the reader into merkledag file - Add(context.Context, io.Reader) (Path, error) - - // Cat returns a reader for the file - Cat(context.Context, Path) (Reader, error) - - // Ls returns the list of links in a directory - Ls(context.Context, Path) ([]*ipld.Link, error) -} - -// BlockAPI specifies the interface to the block layer -type BlockAPI interface { - // Put imports raw block data, hashing it using specified settings. - Put(context.Context, io.Reader, ...options.BlockPutOption) (Path, error) - - // WithFormat is an option for Put which specifies the multicodec to use to - // serialize the object. Default is "v0" - WithFormat(codec string) options.BlockPutOption - - // WithHash is an option for Put which specifies the multihash settings to use - // when hashing the object. Default is mh.SHA2_256 (0x12). - // If mhLen is set to -1, default length for the hash will be used - WithHash(mhType uint64, mhLen int) options.BlockPutOption - - // Get attempts to resolve the path and return a reader for data in the block - Get(context.Context, Path) (io.Reader, error) - - // Rm removes the block specified by the path from local blockstore. - // By default an error will be returned if the block can't be found locally. - // - // NOTE: If the specified block is pinned it won't be removed and no error - // will be returned - Rm(context.Context, Path, ...options.BlockRmOption) error - - // WithForce is an option for Rm which, when set to true, will ignore - // non-existing blocks - WithForce(force bool) options.BlockRmOption - - // Stat returns information on - Stat(context.Context, Path) (BlockStat, error) -} - -// DagAPI specifies the interface to IPLD -type DagAPI interface { - // Put inserts data using specified format and input encoding. - // Unless used with WithCodec or WithHash, the defaults "dag-cbor" and - // "sha256" are used. - Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) (Path, error) - - // WithInputEnc is an option for Put which specifies the input encoding of the - // data. Default is "json", most formats/codecs support "raw" - WithInputEnc(enc string) options.DagPutOption - - // WithCodec is an option for Put which specifies the multicodec to use to - // serialize the object. Default is cid.DagCBOR (0x71) - WithCodec(codec uint64) options.DagPutOption - - // WithHash is an option for Put which specifies the multihash settings to use - // when hashing the object. Default is based on the codec used - // (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for - // the hash will be used - WithHash(mhType uint64, mhLen int) options.DagPutOption - - // Get attempts to resolve and get the node specified by the path - Get(ctx context.Context, path Path) (ipld.Node, error) - - // Tree returns list of paths within a node specified by the path. - Tree(ctx context.Context, path Path, opts ...options.DagTreeOption) ([]Path, error) - - // WithDepth is an option for Tree which specifies maximum depth of the - // returned tree. Default is -1 (no depth limit) - WithDepth(depth int) options.DagTreeOption -} - -// NameAPI specifies the interface to IPNS. -// -// IPNS is a PKI namespace, where names are the hashes of public keys, and the -// private key enables publishing new (signed) values. In both publish and -// resolve, the default name used is the node's own PeerID, which is the hash of -// its public key. -// -// You can use .Key API to list and generate more names and their respective keys. -type NameAPI interface { - // Publish announces new IPNS name - Publish(ctx context.Context, path Path, opts ...options.NamePublishOption) (IpnsEntry, error) - - // WithValidTime is an option for Publish which specifies for how long the - // entry will remain valid. Default value is 24h - WithValidTime(validTime time.Duration) options.NamePublishOption - - // WithKey is an option for Publish which specifies the key to use for - // publishing. Default value is "self" which is the node's own PeerID. - // The key parameter must be either PeerID or keystore key alias. - // - // You can use KeyAPI to list and generate more names and their respective keys. - WithKey(key string) options.NamePublishOption - - // Resolve attempts to resolve the newest version of the specified name - Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (Path, error) - - // WithRecursive is an option for Resolve which specifies whether to perform a - // recursive lookup. Default value is false - WithRecursive(recursive bool) options.NameResolveOption - - // WithLocal is an option for Resolve which specifies if the lookup should be - // offline. Default value is false - WithLocal(local bool) options.NameResolveOption - - // WithCache is an option for Resolve which specifies if cache should be used. - // Default value is true - WithCache(cache bool) options.NameResolveOption -} - -// KeyAPI specifies the interface to Keystore -type KeyAPI interface { - // Generate generates new key, stores it in the keystore under the specified - // name and returns a base58 encoded multihash of it's public key - Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (Key, error) - - // WithType is an option for Generate which specifies which algorithm - // should be used for the key. Default is options.RSAKey - // - // Supported key types: - // * options.RSAKey - // * options.Ed25519Key - WithType(algorithm string) options.KeyGenerateOption - - // WithSize is an option for Generate which specifies the size of the key to - // generated. Default is -1 - // - // value of -1 means 'use default size for key type': - // * 2048 for RSA - WithSize(size int) options.KeyGenerateOption - - // Rename renames oldName key to newName. Returns the key and whether another - // key was overwritten, or an error - Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (Key, bool, error) - - // WithForce is an option for Rename which specifies whether to allow to - // replace existing keys. - WithForce(force bool) options.KeyRenameOption - - // List lists keys stored in keystore - List(ctx context.Context) ([]Key, error) - - // Remove removes keys from keystore. Returns ipns path of the removed key - Remove(ctx context.Context, name string) (Path, error) -} - -// ObjectAPI specifies the interface to MerkleDAG and contains useful utilities -// for manipulating MerkleDAG data structures. -type ObjectAPI interface { - // New creates new, empty (by default) dag-node. - New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) - - // WithType is an option for New which allows to change the type of created - // dag node. - // - // Supported types: - // * 'empty' - Empty node - // * 'unixfs-dir' - Empty UnixFS directory - WithType(string) options.ObjectNewOption - - // Put imports the data into merkledag - Put(context.Context, io.Reader, ...options.ObjectPutOption) (Path, error) - - // WithInputEnc is an option for Put which specifies the input encoding of the - // data. Default is "json". - // - // Supported encodings: - // * "protobuf" - // * "json" - WithInputEnc(e string) options.ObjectPutOption - - // WithDataType specifies the encoding of data field when using Josn or XML - // input encoding. - // - // Supported types: - // * "text" (default) - // * "base64" - WithDataType(t string) options.ObjectPutOption - - // Get returns the node for the path - Get(context.Context, Path) (ipld.Node, error) - - // Data returns reader for data of the node - Data(context.Context, Path) (io.Reader, error) - - // Links returns lint or links the node contains - Links(context.Context, Path) ([]*ipld.Link, error) - - // Stat returns information about the node - Stat(context.Context, Path) (*ObjectStat, error) - - // AddLink adds a link under the specified path. child path can point to a - // subdirectory within the patent which must be present (can be overridden - // with WithCreate option). - AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Path, error) - - // WithCreate is an option for AddLink which specifies whether create required - // directories for the child - WithCreate(create bool) options.ObjectAddLinkOption - - // RmLink removes a link from the node - RmLink(ctx context.Context, base Path, link string) (Path, error) - - // AppendData appends data to the node - AppendData(context.Context, Path, io.Reader) (Path, error) - - // SetData sets the data contained in the node - SetData(context.Context, Path, io.Reader) (Path, error) -} - -// ObjectStat provides information about dag nodes -type ObjectStat struct { - // Cid is the CID of the node - Cid *cid.Cid - - // NumLinks is number of links the node contains - NumLinks int - - // BlockSize is size of the raw serialized node - BlockSize int - - // LinksSize is size of the links block section - LinksSize int - - // DataSize is the size of data block section - DataSize int - - // CumulativeSize is size of the tree (BlockSize + link sizes) - CumulativeSize int -} - -// PinAPI specifies the interface to pining -type PinAPI interface { - // Add creates new pin, be default recursive - pinning the whole referenced - // tree - Add(context.Context, Path, ...options.PinAddOption) error - - // WithRecursive is an option for Add which specifies whether to pin an entire - // object tree or just one object. Default: true - WithRecursive(bool) options.PinAddOption - - // Ls returns list of pinned objects on this node - Ls(context.Context, ...options.PinLsOption) ([]Pin, error) - - // WithType is an option for Ls which allows to specify which pin types should - // be returned - // - // Supported values: - // * "direct" - directly pinned objects - // * "recursive" - roots of recursive pins - // * "indirect" - indirectly pinned objects (referenced by recursively pinned - // objects) - // * "all" - all pinned objects (default) - WithType(string) options.PinLsOption - - // Rm removes pin for object specified by the path - Rm(context.Context, Path) error - - // Update changes one pin to another, skipping checks for matching paths in - // the old tree - Update(ctx context.Context, from Path, to Path, opts ...options.PinUpdateOption) error - - // Verify verifies the integrity of pinned objects - Verify(context.Context) (<-chan PinStatus, error) -} diff --git a/core/coreiface/key.go b/core/coreiface/key.go new file mode 100644 index 00000000000..730e855d78e --- /dev/null +++ b/core/coreiface/key.go @@ -0,0 +1,51 @@ +package iface + +import ( + "context" + + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +// Key specifies the interface to Keys in KeyAPI Keystore +type Key interface { + // Key returns key name + Name() string + // Path returns key path + Path() Path +} + +// KeyAPI specifies the interface to Keystore +type KeyAPI interface { + // Generate generates new key, stores it in the keystore under the specified + // name and returns a base58 encoded multihash of it's public key + Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (Key, error) + + // WithType is an option for Generate which specifies which algorithm + // should be used for the key. Default is options.RSAKey + // + // Supported key types: + // * options.RSAKey + // * options.Ed25519Key + WithType(algorithm string) options.KeyGenerateOption + + // WithSize is an option for Generate which specifies the size of the key to + // generated. Default is -1 + // + // value of -1 means 'use default size for key type': + // * 2048 for RSA + WithSize(size int) options.KeyGenerateOption + + // Rename renames oldName key to newName. Returns the key and whether another + // key was overwritten, or an error + Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (Key, bool, error) + + // WithForce is an option for Rename which specifies whether to allow to + // replace existing keys. + WithForce(force bool) options.KeyRenameOption + + // List lists keys stored in keystore + List(ctx context.Context) ([]Key, error) + + // Remove removes keys from keystore. Returns ipns path of the removed key + Remove(ctx context.Context, name string) (Path, error) +} diff --git a/core/coreiface/name.go b/core/coreiface/name.go new file mode 100644 index 00000000000..6d17d840ad8 --- /dev/null +++ b/core/coreiface/name.go @@ -0,0 +1,55 @@ +package iface + +import ( + "context" + "time" + + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +// IpnsEntry specifies the interface to IpnsEntries +type IpnsEntry interface { + // Name returns IpnsEntry name + Name() string + // Value returns IpnsEntry value + Value() Path +} + +// NameAPI specifies the interface to IPNS. +// +// IPNS is a PKI namespace, where names are the hashes of public keys, and the +// private key enables publishing new (signed) values. In both publish and +// resolve, the default name used is the node's own PeerID, which is the hash of +// its public key. +// +// You can use .Key API to list and generate more names and their respective keys. +type NameAPI interface { + // Publish announces new IPNS name + Publish(ctx context.Context, path Path, opts ...options.NamePublishOption) (IpnsEntry, error) + + // WithValidTime is an option for Publish which specifies for how long the + // entry will remain valid. Default value is 24h + WithValidTime(validTime time.Duration) options.NamePublishOption + + // WithKey is an option for Publish which specifies the key to use for + // publishing. Default value is "self" which is the node's own PeerID. + // The key parameter must be either PeerID or keystore key alias. + // + // You can use KeyAPI to list and generate more names and their respective keys. + WithKey(key string) options.NamePublishOption + + // Resolve attempts to resolve the newest version of the specified name + Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (Path, error) + + // WithRecursive is an option for Resolve which specifies whether to perform a + // recursive lookup. Default value is false + WithRecursive(recursive bool) options.NameResolveOption + + // WithLocal is an option for Resolve which specifies if the lookup should be + // offline. Default value is false + WithLocal(local bool) options.NameResolveOption + + // WithCache is an option for Resolve which specifies if cache should be used. + // Default value is true + WithCache(cache bool) options.NameResolveOption +} diff --git a/core/coreiface/object.go b/core/coreiface/object.go new file mode 100644 index 00000000000..75837f93ec6 --- /dev/null +++ b/core/coreiface/object.go @@ -0,0 +1,96 @@ +package iface + +import ( + "context" + "io" + + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + + cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" + ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" +) + +// ObjectStat provides information about dag nodes +type ObjectStat struct { + // Cid is the CID of the node + Cid *cid.Cid + + // NumLinks is number of links the node contains + NumLinks int + + // BlockSize is size of the raw serialized node + BlockSize int + + // LinksSize is size of the links block section + LinksSize int + + // DataSize is the size of data block section + DataSize int + + // CumulativeSize is size of the tree (BlockSize + link sizes) + CumulativeSize int +} + +// ObjectAPI specifies the interface to MerkleDAG and contains useful utilities +// for manipulating MerkleDAG data structures. +type ObjectAPI interface { + // New creates new, empty (by default) dag-node. + New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) + + // WithType is an option for New which allows to change the type of created + // dag node. + // + // Supported types: + // * 'empty' - Empty node + // * 'unixfs-dir' - Empty UnixFS directory + WithType(string) options.ObjectNewOption + + // Put imports the data into merkledag + Put(context.Context, io.Reader, ...options.ObjectPutOption) (Path, error) + + // WithInputEnc is an option for Put which specifies the input encoding of the + // data. Default is "json". + // + // Supported encodings: + // * "protobuf" + // * "json" + WithInputEnc(e string) options.ObjectPutOption + + // WithDataType specifies the encoding of data field when using Josn or XML + // input encoding. + // + // Supported types: + // * "text" (default) + // * "base64" + WithDataType(t string) options.ObjectPutOption + + // Get returns the node for the path + Get(context.Context, Path) (ipld.Node, error) + + // Data returns reader for data of the node + Data(context.Context, Path) (io.Reader, error) + + // Links returns lint or links the node contains + Links(context.Context, Path) ([]*ipld.Link, error) + + // Stat returns information about the node + Stat(context.Context, Path) (*ObjectStat, error) + + // AddLink adds a link under the specified path. child path can point to a + // subdirectory within the patent which must be present (can be overridden + // with WithCreate option). + AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Path, error) + + // WithCreate is an option for AddLink which specifies whether create required + // directories for the child + WithCreate(create bool) options.ObjectAddLinkOption + + // RmLink removes a link from the node + RmLink(ctx context.Context, base Path, link string) (Path, error) + + // AppendData appends data to the node + AppendData(context.Context, Path, io.Reader) (Path, error) + + // SetData sets the data contained in the node + SetData(context.Context, Path, io.Reader) (Path, error) +} diff --git a/core/coreiface/path.go b/core/coreiface/path.go new file mode 100644 index 00000000000..b2160b94261 --- /dev/null +++ b/core/coreiface/path.go @@ -0,0 +1,18 @@ +package iface + +import ( + cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" +) + +// Path is a generic wrapper for paths used in the API. A path can be resolved +// to a CID using one of Resolve functions in the API. +type Path interface { + // String returns the path as a string. + String() string + // Cid returns cid referred to by path + Cid() *cid.Cid + // Root returns cid of root path + Root() *cid.Cid + // Resolved returns whether path has been fully resolved + Resolved() bool +} diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go new file mode 100644 index 00000000000..47a5a0bb282 --- /dev/null +++ b/core/coreiface/pin.go @@ -0,0 +1,69 @@ +package iface + +import ( + "context" + + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +// Pin holds information about pinned resource +type Pin interface { + // Path to the pinned object + Path() Path + + // Type of the pin + Type() string +} + +// PinStatus holds information about pin health +type PinStatus interface { + // Ok indicates whether the pin has been verified to be correct + Ok() bool + + // BadNodes returns any bad (usually missing) nodes from the pin + BadNodes() []BadPinNode +} + +// BadPinNode is a node that has been marked as bad by Pin.Verify +type BadPinNode interface { + // Path is the path of the node + Path() Path + + // Err is the reason why the node has been marked as bad + Err() error +} + +// PinAPI specifies the interface to pining +type PinAPI interface { + // Add creates new pin, be default recursive - pinning the whole referenced + // tree + Add(context.Context, Path, ...options.PinAddOption) error + + // WithRecursive is an option for Add which specifies whether to pin an entire + // object tree or just one object. Default: true + WithRecursive(bool) options.PinAddOption + + // Ls returns list of pinned objects on this node + Ls(context.Context, ...options.PinLsOption) ([]Pin, error) + + // WithType is an option for Ls which allows to specify which pin types should + // be returned + // + // Supported values: + // * "direct" - directly pinned objects + // * "recursive" - roots of recursive pins + // * "indirect" - indirectly pinned objects (referenced by recursively pinned + // objects) + // * "all" - all pinned objects (default) + WithType(string) options.PinLsOption + + // Rm removes pin for object specified by the path + Rm(context.Context, Path) error + + // Update changes one pin to another, skipping checks for matching paths in + // the old tree + Update(ctx context.Context, from Path, to Path, opts ...options.PinUpdateOption) error + + // Verify verifies the integrity of pinned objects + Verify(context.Context) (<-chan PinStatus, error) +} diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go new file mode 100644 index 00000000000..c1b4efa4322 --- /dev/null +++ b/core/coreiface/unixfs.go @@ -0,0 +1,20 @@ +package iface + +import ( + "context" + "io" + + ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" +) + +// UnixfsAPI is the basic interface to immutable files in IPFS +type UnixfsAPI interface { + // Add imports the data from the reader into merkledag file + Add(context.Context, io.Reader) (Path, error) + + // Cat returns a reader for the file + Cat(context.Context, Path) (Reader, error) + + // Ls returns the list of links in a directory + Ls(context.Context, Path) ([]*ipld.Link, error) +} diff --git a/core/coreiface/util.go b/core/coreiface/util.go new file mode 100644 index 00000000000..8fd3e058fa5 --- /dev/null +++ b/core/coreiface/util.go @@ -0,0 +1,10 @@ +package iface + +import ( + "io" +) + +type Reader interface { + io.ReadSeeker + io.Closer +} From 809fb6b34a9ccb507a7917265227a6941458fe1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 18:52:10 +0100 Subject: [PATCH 044/286] coreapi: minor doc fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@dba6c1b7a33059613de8019eafb527031e52e61d This commit was moved from ipfs/boxo@64d53e28ce0e428dadef3a318a1f44eb983376e7 --- core/coreiface/coreapi.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index f1388e5bcd7..9428b3b634a 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -8,22 +8,24 @@ import ( ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" ) -// CoreAPI defines an unified interface to IPFS for Go programs. +// CoreAPI defines an unified interface to IPFS for Go programs type CoreAPI interface { - // Unixfs returns an implementation of Unixfs API. + // Unixfs returns an implementation of Unixfs API Unixfs() UnixfsAPI - // Block returns an implementation of Block API. + // Block returns an implementation of Block API Block() BlockAPI - // Dag returns an implementation of Dag API. + // Dag returns an implementation of Dag API Dag() DagAPI - // Name returns an implementation of Name API. + // Name returns an implementation of Name API Name() NameAPI - // Key returns an implementation of Key API. + // Key returns an implementation of Key API Key() KeyAPI + + // Pin returns an implementation of Pin API Pin() PinAPI // ObjectAPI returns an implementation of Object API From f3162d6ec66cecaf16eb7cd2f7db03035741db37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 22:17:27 +0100 Subject: [PATCH 045/286] coreapi: var block for errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@60fc569676d93341f657737a221de2228a178183 This commit was moved from ipfs/boxo@5de1a8368e0d7b6abe9226f7e789ab8a521fb886 --- core/coreiface/errors.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/coreiface/errors.go b/core/coreiface/errors.go index 73442be11ac..81f978971d7 100644 --- a/core/coreiface/errors.go +++ b/core/coreiface/errors.go @@ -2,5 +2,7 @@ package iface import "errors" -var ErrIsDir = errors.New("object is a directory") -var ErrOffline = errors.New("can't resolve, ipfs node is offline") +var ( + ErrIsDir = errors.New("object is a directory") + ErrOffline = errors.New("can't resolve, ipfs node is offline") +) From 5e488491670bdb45a3fa957b624f44a068cb40a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 11 Mar 2018 18:55:35 +0100 Subject: [PATCH 046/286] coreapi: remove options from interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@38ccf0555876033759418de2c43b5d9c727b2c19 This commit was moved from ipfs/boxo@595afb8260f48d77dfff80a7d4a191f185adfb87 --- core/coreiface/block.go | 13 ------------- core/coreiface/dag.go | 18 ------------------ core/coreiface/key.go | 19 ------------------- core/coreiface/name.go | 24 ------------------------ core/coreiface/object.go | 28 ---------------------------- core/coreiface/options/block.go | 17 +++++++++++++---- core/coreiface/options/dag.go | 22 +++++++++++++++++----- core/coreiface/options/key.go | 23 +++++++++++++++++++---- core/coreiface/options/name.go | 27 +++++++++++++++++++++------ core/coreiface/options/object.go | 32 +++++++++++++++++++++++++++----- core/coreiface/options/pin.go | 23 +++++++++++++++++++---- core/coreiface/pin.go | 15 --------------- 12 files changed, 116 insertions(+), 145 deletions(-) diff --git a/core/coreiface/block.go b/core/coreiface/block.go index f38a664c302..a9e577d7655 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -21,15 +21,6 @@ type BlockAPI interface { // Put imports raw block data, hashing it using specified settings. Put(context.Context, io.Reader, ...options.BlockPutOption) (Path, error) - // WithFormat is an option for Put which specifies the multicodec to use to - // serialize the object. Default is "v0" - WithFormat(codec string) options.BlockPutOption - - // WithHash is an option for Put which specifies the multihash settings to use - // when hashing the object. Default is mh.SHA2_256 (0x12). - // If mhLen is set to -1, default length for the hash will be used - WithHash(mhType uint64, mhLen int) options.BlockPutOption - // Get attempts to resolve the path and return a reader for data in the block Get(context.Context, Path) (io.Reader, error) @@ -40,10 +31,6 @@ type BlockAPI interface { // will be returned Rm(context.Context, Path, ...options.BlockRmOption) error - // WithForce is an option for Rm which, when set to true, will ignore - // non-existing blocks - WithForce(force bool) options.BlockRmOption - // Stat returns information on Stat(context.Context, Path) (BlockStat, error) } diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 1635d71b1cb..f20c88f25ae 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -16,27 +16,9 @@ type DagAPI interface { // "sha256" are used. Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) (Path, error) - // WithInputEnc is an option for Put which specifies the input encoding of the - // data. Default is "json", most formats/codecs support "raw" - WithInputEnc(enc string) options.DagPutOption - - // WithCodec is an option for Put which specifies the multicodec to use to - // serialize the object. Default is cid.DagCBOR (0x71) - WithCodec(codec uint64) options.DagPutOption - - // WithHash is an option for Put which specifies the multihash settings to use - // when hashing the object. Default is based on the codec used - // (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for - // the hash will be used - WithHash(mhType uint64, mhLen int) options.DagPutOption - // Get attempts to resolve and get the node specified by the path Get(ctx context.Context, path Path) (ipld.Node, error) // Tree returns list of paths within a node specified by the path. Tree(ctx context.Context, path Path, opts ...options.DagTreeOption) ([]Path, error) - - // WithDepth is an option for Tree which specifies maximum depth of the - // returned tree. Default is -1 (no depth limit) - WithDepth(depth int) options.DagTreeOption } diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 730e855d78e..928aa265f8c 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -20,29 +20,10 @@ type KeyAPI interface { // name and returns a base58 encoded multihash of it's public key Generate(ctx context.Context, name string, opts ...options.KeyGenerateOption) (Key, error) - // WithType is an option for Generate which specifies which algorithm - // should be used for the key. Default is options.RSAKey - // - // Supported key types: - // * options.RSAKey - // * options.Ed25519Key - WithType(algorithm string) options.KeyGenerateOption - - // WithSize is an option for Generate which specifies the size of the key to - // generated. Default is -1 - // - // value of -1 means 'use default size for key type': - // * 2048 for RSA - WithSize(size int) options.KeyGenerateOption - // Rename renames oldName key to newName. Returns the key and whether another // key was overwritten, or an error Rename(ctx context.Context, oldName string, newName string, opts ...options.KeyRenameOption) (Key, bool, error) - // WithForce is an option for Rename which specifies whether to allow to - // replace existing keys. - WithForce(force bool) options.KeyRenameOption - // List lists keys stored in keystore List(ctx context.Context) ([]Key, error) diff --git a/core/coreiface/name.go b/core/coreiface/name.go index 6d17d840ad8..a6aad0c3e6f 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -2,7 +2,6 @@ package iface import ( "context" - "time" options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) @@ -27,29 +26,6 @@ type NameAPI interface { // Publish announces new IPNS name Publish(ctx context.Context, path Path, opts ...options.NamePublishOption) (IpnsEntry, error) - // WithValidTime is an option for Publish which specifies for how long the - // entry will remain valid. Default value is 24h - WithValidTime(validTime time.Duration) options.NamePublishOption - - // WithKey is an option for Publish which specifies the key to use for - // publishing. Default value is "self" which is the node's own PeerID. - // The key parameter must be either PeerID or keystore key alias. - // - // You can use KeyAPI to list and generate more names and their respective keys. - WithKey(key string) options.NamePublishOption - // Resolve attempts to resolve the newest version of the specified name Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (Path, error) - - // WithRecursive is an option for Resolve which specifies whether to perform a - // recursive lookup. Default value is false - WithRecursive(recursive bool) options.NameResolveOption - - // WithLocal is an option for Resolve which specifies if the lookup should be - // offline. Default value is false - WithLocal(local bool) options.NameResolveOption - - // WithCache is an option for Resolve which specifies if cache should be used. - // Default value is true - WithCache(cache bool) options.NameResolveOption } diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 75837f93ec6..548b15a7369 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -37,33 +37,9 @@ type ObjectAPI interface { // New creates new, empty (by default) dag-node. New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) - // WithType is an option for New which allows to change the type of created - // dag node. - // - // Supported types: - // * 'empty' - Empty node - // * 'unixfs-dir' - Empty UnixFS directory - WithType(string) options.ObjectNewOption - // Put imports the data into merkledag Put(context.Context, io.Reader, ...options.ObjectPutOption) (Path, error) - // WithInputEnc is an option for Put which specifies the input encoding of the - // data. Default is "json". - // - // Supported encodings: - // * "protobuf" - // * "json" - WithInputEnc(e string) options.ObjectPutOption - - // WithDataType specifies the encoding of data field when using Josn or XML - // input encoding. - // - // Supported types: - // * "text" (default) - // * "base64" - WithDataType(t string) options.ObjectPutOption - // Get returns the node for the path Get(context.Context, Path) (ipld.Node, error) @@ -81,10 +57,6 @@ type ObjectAPI interface { // with WithCreate option). AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Path, error) - // WithCreate is an option for AddLink which specifies whether create required - // directories for the child - WithCreate(create bool) options.ObjectAddLinkOption - // RmLink removes a link from the node RmLink(ctx context.Context, base Path, link string) (Path, error) diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index bbb14612f44..20320705e98 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -47,16 +47,23 @@ func BlockRmOptions(opts ...BlockRmOption) (*BlockRmSettings, error) { return options, nil } -type BlockOptions struct{} +type blockOpts struct{} -func (api *BlockOptions) WithFormat(codec string) BlockPutOption { +var Block blockOpts + +// Format is an option for Block.Put which specifies the multicodec to use to +// serialize the object. Default is "v0" +func (_ blockOpts) Format(codec string) BlockPutOption { return func(settings *BlockPutSettings) error { settings.Codec = codec return nil } } -func (api *BlockOptions) WithHash(mhType uint64, mhLen int) BlockPutOption { +// Hash is an option for Block.Put which specifies the multihash settings to use +// when hashing the object. Default is mh.SHA2_256 (0x12). +// If mhLen is set to -1, default length for the hash will be used +func (_ blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { return func(settings *BlockPutSettings) error { settings.MhType = mhType settings.MhLength = mhLen @@ -64,7 +71,9 @@ func (api *BlockOptions) WithHash(mhType uint64, mhLen int) BlockPutOption { } } -func (api *BlockOptions) WithForce(force bool) BlockRmOption { +// Force is an option for Block.Rm which, when set to true, will ignore +// non-existing blocks +func (_ blockOpts) Force(force bool) BlockRmOption { return func(settings *BlockRmSettings) error { settings.Force = force return nil diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index b56fcd81a6e..ec258cf95ff 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -51,23 +51,33 @@ func DagTreeOptions(opts ...DagTreeOption) (*DagTreeSettings, error) { return options, nil } -type DagOptions struct{} +type dagOpts struct{} -func (api *DagOptions) WithInputEnc(enc string) DagPutOption { +var Dag dagOpts + +// InputEnc is an option for Dag.Put which specifies the input encoding of the +// data. Default is "json", most formats/codecs support "raw" +func (_ dagOpts) InputEnc(enc string) DagPutOption { return func(settings *DagPutSettings) error { settings.InputEnc = enc return nil } } -func (api *DagOptions) WithCodec(codec uint64) DagPutOption { +// Codec is an option for Dag.Put which specifies the multicodec to use to +// serialize the object. Default is cid.DagCBOR (0x71) +func (_ dagOpts) Codec(codec uint64) DagPutOption { return func(settings *DagPutSettings) error { settings.Codec = codec return nil } } -func (api *DagOptions) WithHash(mhType uint64, mhLen int) DagPutOption { +// Hash is an option for Dag.Put which specifies the multihash settings to use +// when hashing the object. Default is based on the codec used +// (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for +// the hash will be used +func (_ dagOpts) Hash(mhType uint64, mhLen int) DagPutOption { return func(settings *DagPutSettings) error { settings.MhType = mhType settings.MhLength = mhLen @@ -75,7 +85,9 @@ func (api *DagOptions) WithHash(mhType uint64, mhLen int) DagPutOption { } } -func (api *DagOptions) WithDepth(depth int) DagTreeOption { +// Depth is an option for Dag.Tree which specifies maximum depth of the +// returned tree. Default is -1 (no depth limit) +func (_ dagOpts) Depth(depth int) DagTreeOption { return func(settings *DagTreeSettings) error { settings.Depth = depth return nil diff --git a/core/coreiface/options/key.go b/core/coreiface/options/key.go index 114361875a5..a29261d1448 100644 --- a/core/coreiface/options/key.go +++ b/core/coreiface/options/key.go @@ -48,23 +48,38 @@ func KeyRenameOptions(opts ...KeyRenameOption) (*KeyRenameSettings, error) { return options, nil } -type KeyOptions struct{} +type keyOpts struct{} -func (api *KeyOptions) WithType(algorithm string) KeyGenerateOption { +var Key keyOpts + +// Type is an option for Key.Generate which specifies which algorithm +// should be used for the key. Default is options.RSAKey +// +// Supported key types: +// * options.RSAKey +// * options.Ed25519Key +func (_ keyOpts) Type(algorithm string) KeyGenerateOption { return func(settings *KeyGenerateSettings) error { settings.Algorithm = algorithm return nil } } -func (api *KeyOptions) WithSize(size int) KeyGenerateOption { +// Size is an option for Key.Generate which specifies the size of the key to +// generated. Default is -1 +// +// value of -1 means 'use default size for key type': +// * 2048 for RSA +func (_ keyOpts) Size(size int) KeyGenerateOption { return func(settings *KeyGenerateSettings) error { settings.Size = size return nil } } -func (api *KeyOptions) WithForce(force bool) KeyRenameOption { +// Force is an option for Key.Rename which specifies whether to allow to +// replace existing keys. +func (_ keyOpts) Force(force bool) KeyRenameOption { return func(settings *KeyRenameSettings) error { settings.Force = force return nil diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index 9f8aaafc83e..1f6de0ee32f 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -55,37 +55,52 @@ func NameResolveOptions(opts ...NameResolveOption) (*NameResolveSettings, error) return options, nil } -type NameOptions struct{} +type nameOpts struct{} -func (api *NameOptions) WithValidTime(validTime time.Duration) NamePublishOption { +var Name nameOpts + +// ValidTime is an option for Name.Publish which specifies for how long the +// entry will remain valid. Default value is 24h +func (_ nameOpts) ValidTime(validTime time.Duration) NamePublishOption { return func(settings *NamePublishSettings) error { settings.ValidTime = validTime return nil } } -func (api *NameOptions) WithKey(key string) NamePublishOption { +// Key is an option for Name.Publish which specifies the key to use for +// publishing. Default value is "self" which is the node's own PeerID. +// The key parameter must be either PeerID or keystore key alias. +// +// You can use KeyAPI to list and generate more names and their respective keys. +func (_ nameOpts) Key(key string) NamePublishOption { return func(settings *NamePublishSettings) error { settings.Key = key return nil } } -func (api *NameOptions) WithRecursive(recursive bool) NameResolveOption { +// Recursive is an option for Name.Resolve which specifies whether to perform a +// recursive lookup. Default value is false +func (_ nameOpts) Recursive(recursive bool) NameResolveOption { return func(settings *NameResolveSettings) error { settings.Recursive = recursive return nil } } -func (api *NameOptions) WithLocal(local bool) NameResolveOption { +// Local is an option for Name.Resolve which specifies if the lookup should be +// offline. Default value is false +func (_ nameOpts) Local(local bool) NameResolveOption { return func(settings *NameResolveSettings) error { settings.Local = local return nil } } -func (api *NameOptions) WithCache(cache bool) NameResolveOption { +// Cache is an option for Name.Resolve which specifies if cache should be used. +// Default value is true +func (_ nameOpts) Cache(cache bool) NameResolveOption { return func(settings *NameResolveSettings) error { settings.Cache = cache return nil diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go index 9c8c9a9ddd1..00e41d28b06 100644 --- a/core/coreiface/options/object.go +++ b/core/coreiface/options/object.go @@ -60,30 +60,52 @@ func ObjectAddLinkOptions(opts ...ObjectAddLinkOption) (*ObjectAddLinkSettings, return options, nil } -type ObjectOptions struct{} +type objectOpts struct{} -func (api *ObjectOptions) WithType(t string) ObjectNewOption { +var Object objectOpts + +// Type is an option for Object.New which allows to change the type of created +// dag node. +// +// Supported types: +// * 'empty' - Empty node +// * 'unixfs-dir' - Empty UnixFS directory +func (_ objectOpts) Type(t string) ObjectNewOption { return func(settings *ObjectNewSettings) error { settings.Type = t return nil } } -func (api *ObjectOptions) WithInputEnc(e string) ObjectPutOption { +// InputEnc is an option for Object.Put which specifies the input encoding of the +// data. Default is "json". +// +// Supported encodings: +// * "protobuf" +// * "json" +func (_ objectOpts) InputEnc(e string) ObjectPutOption { return func(settings *ObjectPutSettings) error { settings.InputEnc = e return nil } } -func (api *ObjectOptions) WithDataType(t string) ObjectPutOption { +// DataType is an option for Object.Put which specifies the encoding of data +// field when using Json or XML input encoding. +// +// Supported types: +// * "text" (default) +// * "base64" +func (_ objectOpts) DataType(t string) ObjectPutOption { return func(settings *ObjectPutSettings) error { settings.DataType = t return nil } } -func (api *ObjectOptions) WithCreate(create bool) ObjectAddLinkOption { +// Create is an option for Object.AddLink which specifies whether create required +// directories for the child +func (_ objectOpts) Create(create bool) ObjectAddLinkOption { return func(settings *ObjectAddLinkSettings) error { settings.Create = create return nil diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index f97f7b16ee1..680ed391d36 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -61,23 +61,38 @@ func PinUpdateOptions(opts ...PinUpdateOption) (*PinUpdateSettings, error) { return options, nil } -type PinOptions struct{} +type pinOpts struct{} -func (api *PinOptions) WithRecursive(recucsive bool) PinAddOption { +var Pin pinOpts + +// Recursive is an option for Pin.Add which specifies whether to pin an entire +// object tree or just one object. Default: true +func (_ pinOpts) Recursive(recucsive bool) PinAddOption { return func(settings *PinAddSettings) error { settings.Recursive = recucsive return nil } } -func (api *PinOptions) WithType(t string) PinLsOption { +// Type is an option for Pin.Ls which allows to specify which pin types should +// be returned +// +// Supported values: +// * "direct" - directly pinned objects +// * "recursive" - roots of recursive pins +// * "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// * "all" - all pinned objects (default) +func (_ pinOpts) Type(t string) PinLsOption { return func(settings *PinLsSettings) error { settings.Type = t return nil } } -func (api *PinOptions) WithUnpin(unpin bool) PinUpdateOption { +// Unpin is an option for Pin.Update which specifies whether to remove the old pin. +// Default is true. +func (_ pinOpts) Unpin(unpin bool) PinUpdateOption { return func(settings *PinUpdateSettings) error { settings.Unpin = unpin return nil diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 47a5a0bb282..5994c758686 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -39,24 +39,9 @@ type PinAPI interface { // tree Add(context.Context, Path, ...options.PinAddOption) error - // WithRecursive is an option for Add which specifies whether to pin an entire - // object tree or just one object. Default: true - WithRecursive(bool) options.PinAddOption - // Ls returns list of pinned objects on this node Ls(context.Context, ...options.PinLsOption) ([]Pin, error) - // WithType is an option for Ls which allows to specify which pin types should - // be returned - // - // Supported values: - // * "direct" - directly pinned objects - // * "recursive" - roots of recursive pins - // * "indirect" - indirectly pinned objects (referenced by recursively pinned - // objects) - // * "all" - all pinned objects (default) - WithType(string) options.PinLsOption - // Rm removes pin for object specified by the path Rm(context.Context, Path) error From 8fea8513e3acbd23258c873a02808daf62ced490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 25 Mar 2018 13:58:29 +0200 Subject: [PATCH 047/286] coreapi: use defined functions for pin type option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@2e3f9758c88ce4572922c3fd4e8ef51c703e183d This commit was moved from ipfs/boxo@8a0f4029598ebf3be0d56e91fe07675702349a6d --- core/coreiface/options/pin.go | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index 680ed391d36..7cb4d09d267 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -61,10 +61,38 @@ func PinUpdateOptions(opts ...PinUpdateOption) (*PinUpdateSettings, error) { return options, nil } -type pinOpts struct{} +type pinType struct{} + +type pinOpts struct { + Type pinType +} var Pin pinOpts +// All is an option for Pin.Ls which will make it return all pins. It is +// the default +func (_ pinType) All() PinLsOption { + return Pin.pinType("all") +} + +// Recursive is an option for Pin.Ls which will make it only return recursive +// pins +func (_ pinType) Recursive() PinLsOption { + return Pin.pinType("recursive") +} + +// Direct is an option for Pin.Ls which will make it only return direct (non +// recursive) pins +func (_ pinType) Direct() PinLsOption { + return Pin.pinType("direct") +} + +// Indirect is an option for Pin.Ls which will make it only return indirect pins +// (objects referenced by other recursively pinned objects) +func (_ pinType) Indirect() PinLsOption { + return Pin.pinType("indirect") +} + // Recursive is an option for Pin.Add which specifies whether to pin an entire // object tree or just one object. Default: true func (_ pinOpts) Recursive(recucsive bool) PinAddOption { @@ -83,7 +111,7 @@ func (_ pinOpts) Recursive(recucsive bool) PinAddOption { // * "indirect" - indirectly pinned objects (referenced by recursively pinned // objects) // * "all" - all pinned objects (default) -func (_ pinOpts) Type(t string) PinLsOption { +func (_ pinOpts) pinType(t string) PinLsOption { return func(settings *PinLsSettings) error { settings.Type = t return nil From b5d36c8a1b2d8477021f4a7c3b044bfc5913e173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 25 Mar 2018 14:09:59 +0200 Subject: [PATCH 048/286] coreapi: don't use underscores in opt reciever funcs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@8b65fc5e1ed16902cda0e3e36fe624b01856b182 This commit was moved from ipfs/boxo@6bd3ea5ab8c0df771963b4f8a9f5cfdc18a95b6d --- core/coreiface/options/block.go | 6 +++--- core/coreiface/options/dag.go | 8 ++++---- core/coreiface/options/key.go | 6 +++--- core/coreiface/options/name.go | 10 +++++----- core/coreiface/options/object.go | 8 ++++---- core/coreiface/options/pin.go | 14 +++++++------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 20320705e98..55964b2b71a 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -53,7 +53,7 @@ var Block blockOpts // Format is an option for Block.Put which specifies the multicodec to use to // serialize the object. Default is "v0" -func (_ blockOpts) Format(codec string) BlockPutOption { +func (blockOpts) Format(codec string) BlockPutOption { return func(settings *BlockPutSettings) error { settings.Codec = codec return nil @@ -63,7 +63,7 @@ func (_ blockOpts) Format(codec string) BlockPutOption { // Hash is an option for Block.Put which specifies the multihash settings to use // when hashing the object. Default is mh.SHA2_256 (0x12). // If mhLen is set to -1, default length for the hash will be used -func (_ blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { +func (blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { return func(settings *BlockPutSettings) error { settings.MhType = mhType settings.MhLength = mhLen @@ -73,7 +73,7 @@ func (_ blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { // Force is an option for Block.Rm which, when set to true, will ignore // non-existing blocks -func (_ blockOpts) Force(force bool) BlockRmOption { +func (blockOpts) Force(force bool) BlockRmOption { return func(settings *BlockRmSettings) error { settings.Force = force return nil diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index ec258cf95ff..96eea5b460e 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -57,7 +57,7 @@ var Dag dagOpts // InputEnc is an option for Dag.Put which specifies the input encoding of the // data. Default is "json", most formats/codecs support "raw" -func (_ dagOpts) InputEnc(enc string) DagPutOption { +func (dagOpts) InputEnc(enc string) DagPutOption { return func(settings *DagPutSettings) error { settings.InputEnc = enc return nil @@ -66,7 +66,7 @@ func (_ dagOpts) InputEnc(enc string) DagPutOption { // Codec is an option for Dag.Put which specifies the multicodec to use to // serialize the object. Default is cid.DagCBOR (0x71) -func (_ dagOpts) Codec(codec uint64) DagPutOption { +func (dagOpts) Codec(codec uint64) DagPutOption { return func(settings *DagPutSettings) error { settings.Codec = codec return nil @@ -77,7 +77,7 @@ func (_ dagOpts) Codec(codec uint64) DagPutOption { // when hashing the object. Default is based on the codec used // (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for // the hash will be used -func (_ dagOpts) Hash(mhType uint64, mhLen int) DagPutOption { +func (dagOpts) Hash(mhType uint64, mhLen int) DagPutOption { return func(settings *DagPutSettings) error { settings.MhType = mhType settings.MhLength = mhLen @@ -87,7 +87,7 @@ func (_ dagOpts) Hash(mhType uint64, mhLen int) DagPutOption { // Depth is an option for Dag.Tree which specifies maximum depth of the // returned tree. Default is -1 (no depth limit) -func (_ dagOpts) Depth(depth int) DagTreeOption { +func (dagOpts) Depth(depth int) DagTreeOption { return func(settings *DagTreeSettings) error { settings.Depth = depth return nil diff --git a/core/coreiface/options/key.go b/core/coreiface/options/key.go index a29261d1448..80beea35299 100644 --- a/core/coreiface/options/key.go +++ b/core/coreiface/options/key.go @@ -58,7 +58,7 @@ var Key keyOpts // Supported key types: // * options.RSAKey // * options.Ed25519Key -func (_ keyOpts) Type(algorithm string) KeyGenerateOption { +func (keyOpts) Type(algorithm string) KeyGenerateOption { return func(settings *KeyGenerateSettings) error { settings.Algorithm = algorithm return nil @@ -70,7 +70,7 @@ func (_ keyOpts) Type(algorithm string) KeyGenerateOption { // // value of -1 means 'use default size for key type': // * 2048 for RSA -func (_ keyOpts) Size(size int) KeyGenerateOption { +func (keyOpts) Size(size int) KeyGenerateOption { return func(settings *KeyGenerateSettings) error { settings.Size = size return nil @@ -79,7 +79,7 @@ func (_ keyOpts) Size(size int) KeyGenerateOption { // Force is an option for Key.Rename which specifies whether to allow to // replace existing keys. -func (_ keyOpts) Force(force bool) KeyRenameOption { +func (keyOpts) Force(force bool) KeyRenameOption { return func(settings *KeyRenameSettings) error { settings.Force = force return nil diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index 1f6de0ee32f..48aecf18ba8 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -61,7 +61,7 @@ var Name nameOpts // ValidTime is an option for Name.Publish which specifies for how long the // entry will remain valid. Default value is 24h -func (_ nameOpts) ValidTime(validTime time.Duration) NamePublishOption { +func (nameOpts) ValidTime(validTime time.Duration) NamePublishOption { return func(settings *NamePublishSettings) error { settings.ValidTime = validTime return nil @@ -73,7 +73,7 @@ func (_ nameOpts) ValidTime(validTime time.Duration) NamePublishOption { // The key parameter must be either PeerID or keystore key alias. // // You can use KeyAPI to list and generate more names and their respective keys. -func (_ nameOpts) Key(key string) NamePublishOption { +func (nameOpts) Key(key string) NamePublishOption { return func(settings *NamePublishSettings) error { settings.Key = key return nil @@ -82,7 +82,7 @@ func (_ nameOpts) Key(key string) NamePublishOption { // Recursive is an option for Name.Resolve which specifies whether to perform a // recursive lookup. Default value is false -func (_ nameOpts) Recursive(recursive bool) NameResolveOption { +func (nameOpts) Recursive(recursive bool) NameResolveOption { return func(settings *NameResolveSettings) error { settings.Recursive = recursive return nil @@ -91,7 +91,7 @@ func (_ nameOpts) Recursive(recursive bool) NameResolveOption { // Local is an option for Name.Resolve which specifies if the lookup should be // offline. Default value is false -func (_ nameOpts) Local(local bool) NameResolveOption { +func (nameOpts) Local(local bool) NameResolveOption { return func(settings *NameResolveSettings) error { settings.Local = local return nil @@ -100,7 +100,7 @@ func (_ nameOpts) Local(local bool) NameResolveOption { // Cache is an option for Name.Resolve which specifies if cache should be used. // Default value is true -func (_ nameOpts) Cache(cache bool) NameResolveOption { +func (nameOpts) Cache(cache bool) NameResolveOption { return func(settings *NameResolveSettings) error { settings.Cache = cache return nil diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go index 00e41d28b06..aca02d67263 100644 --- a/core/coreiface/options/object.go +++ b/core/coreiface/options/object.go @@ -70,7 +70,7 @@ var Object objectOpts // Supported types: // * 'empty' - Empty node // * 'unixfs-dir' - Empty UnixFS directory -func (_ objectOpts) Type(t string) ObjectNewOption { +func (objectOpts) Type(t string) ObjectNewOption { return func(settings *ObjectNewSettings) error { settings.Type = t return nil @@ -83,7 +83,7 @@ func (_ objectOpts) Type(t string) ObjectNewOption { // Supported encodings: // * "protobuf" // * "json" -func (_ objectOpts) InputEnc(e string) ObjectPutOption { +func (objectOpts) InputEnc(e string) ObjectPutOption { return func(settings *ObjectPutSettings) error { settings.InputEnc = e return nil @@ -96,7 +96,7 @@ func (_ objectOpts) InputEnc(e string) ObjectPutOption { // Supported types: // * "text" (default) // * "base64" -func (_ objectOpts) DataType(t string) ObjectPutOption { +func (objectOpts) DataType(t string) ObjectPutOption { return func(settings *ObjectPutSettings) error { settings.DataType = t return nil @@ -105,7 +105,7 @@ func (_ objectOpts) DataType(t string) ObjectPutOption { // Create is an option for Object.AddLink which specifies whether create required // directories for the child -func (_ objectOpts) Create(create bool) ObjectAddLinkOption { +func (objectOpts) Create(create bool) ObjectAddLinkOption { return func(settings *ObjectAddLinkSettings) error { settings.Create = create return nil diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index 7cb4d09d267..e46c27246a3 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -71,31 +71,31 @@ var Pin pinOpts // All is an option for Pin.Ls which will make it return all pins. It is // the default -func (_ pinType) All() PinLsOption { +func (pinType) All() PinLsOption { return Pin.pinType("all") } // Recursive is an option for Pin.Ls which will make it only return recursive // pins -func (_ pinType) Recursive() PinLsOption { +func (pinType) Recursive() PinLsOption { return Pin.pinType("recursive") } // Direct is an option for Pin.Ls which will make it only return direct (non // recursive) pins -func (_ pinType) Direct() PinLsOption { +func (pinType) Direct() PinLsOption { return Pin.pinType("direct") } // Indirect is an option for Pin.Ls which will make it only return indirect pins // (objects referenced by other recursively pinned objects) -func (_ pinType) Indirect() PinLsOption { +func (pinType) Indirect() PinLsOption { return Pin.pinType("indirect") } // Recursive is an option for Pin.Add which specifies whether to pin an entire // object tree or just one object. Default: true -func (_ pinOpts) Recursive(recucsive bool) PinAddOption { +func (pinOpts) Recursive(recucsive bool) PinAddOption { return func(settings *PinAddSettings) error { settings.Recursive = recucsive return nil @@ -111,7 +111,7 @@ func (_ pinOpts) Recursive(recucsive bool) PinAddOption { // * "indirect" - indirectly pinned objects (referenced by recursively pinned // objects) // * "all" - all pinned objects (default) -func (_ pinOpts) pinType(t string) PinLsOption { +func (pinOpts) pinType(t string) PinLsOption { return func(settings *PinLsSettings) error { settings.Type = t return nil @@ -120,7 +120,7 @@ func (_ pinOpts) pinType(t string) PinLsOption { // Unpin is an option for Pin.Update which specifies whether to remove the old pin. // Default is true. -func (_ pinOpts) Unpin(unpin bool) PinUpdateOption { +func (pinOpts) Unpin(unpin bool) PinUpdateOption { return func(settings *PinUpdateSettings) error { settings.Unpin = unpin return nil From 7ffe2f640d3ee26d8aee1f418f1e7c805478fafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 19 Mar 2018 03:41:28 +0100 Subject: [PATCH 049/286] misc: Fix a few typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@646b14412abd5b2382fc11f37e40ef592c557fcb This commit was moved from ipfs/boxo@76ac2a8842d68a73acece177235ec746ca637793 --- core/coreiface/options/pin.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index e46c27246a3..9d1107f927d 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -95,9 +95,9 @@ func (pinType) Indirect() PinLsOption { // Recursive is an option for Pin.Add which specifies whether to pin an entire // object tree or just one object. Default: true -func (pinOpts) Recursive(recucsive bool) PinAddOption { +func (pinOpts) Recursive(recursive bool) PinAddOption { return func(settings *PinAddSettings) error { - settings.Recursive = recucsive + settings.Recursive = recursive return nil } } From 557277dda8b6c276d95f9fcec7721c014c60b5ee Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 8 Jun 2018 22:01:00 -0700 Subject: [PATCH 050/286] gx update go-log, sys, go-crypto * go-log * sys * go-crypto License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@0e613d93eacb5247a4ca23790a5fe82dde8917dc This commit was moved from ipfs/boxo@724c6143570accc8e163cc355b46eff0338f52e5 --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/object.go | 4 ++-- core/coreiface/options/block.go | 2 +- core/coreiface/options/dag.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/unixfs.go | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 9428b3b634a..220f8df5038 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" + ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index f20c88f25ae..3c4dc0c3aba 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" + ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format" ) // DagAPI specifies the interface to IPLD diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 548b15a7369..d53f4d2142c 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" - ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" + ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format" + cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 55964b2b71a..d6da99774c1 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -1,7 +1,7 @@ package options import ( - "gx/ipfs/QmZyZDi491cCNTLfAhwcaDii2Kg4pwKRkhqQzURGDvY6ua/go-multihash" + "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" ) type BlockPutSettings struct { diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index 96eea5b460e..b5e6dcea128 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -3,7 +3,7 @@ package options import ( "math" - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" + cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" ) type DagPutSettings struct { diff --git a/core/coreiface/path.go b/core/coreiface/path.go index b2160b94261..929b97bcd94 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" + cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" ) // Path is a generic wrapper for paths used in the API. A path can be resolved diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index c1b4efa4322..11e14cc8493 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,7 +4,7 @@ import ( "context" "io" - ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" + ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format" ) // UnixfsAPI is the basic interface to immutable files in IPFS From 7ffcd2a1be865e92ce369998a9a8147f45ce7e5c Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 16 Jul 2018 15:16:49 -0700 Subject: [PATCH 051/286] update go-cid alternative to #5243 that updates go-cid and all packages that depend on it License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@2c9291a232cb0febaf3bb029694ce2fb3155d3f9 This commit was moved from ipfs/boxo@c77c8df70d4c804e1f3acd068a8ef58937e7ef9e --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/object.go | 4 ++-- core/coreiface/options/dag.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/unixfs.go | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 220f8df5038..a77ad636720 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format" + ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 3c4dc0c3aba..158db7419d5 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format" + ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" ) // DagAPI specifies the interface to IPLD diff --git a/core/coreiface/object.go b/core/coreiface/object.go index d53f4d2142c..a18a38ebe5d 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format" - cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" + cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" + ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index b5e6dcea128..57465deee91 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -3,7 +3,7 @@ package options import ( "math" - cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" + cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" ) type DagPutSettings struct { diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 929b97bcd94..51513772fd4 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" + cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" ) // Path is a generic wrapper for paths used in the API. A path can be resolved diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 11e14cc8493..c59451d002f 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,7 +4,7 @@ import ( "context" "io" - ipld "gx/ipfs/QmWi2BYBL5gJ3CiAiQchg6rn1A8iBsrWy51EYxvHVjFvLb/go-ipld-format" + ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" ) // UnixfsAPI is the basic interface to immutable files in IPFS From 63e861e549469348c5b075da5920df32c12689b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 2 Feb 2018 16:00:37 +0100 Subject: [PATCH 052/286] coreapi: expand public path api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@ad6db2fc4cff3178bb50aacbe30559078661907b This commit was moved from ipfs/boxo@3b1cf7aed3af88561e5b851f79d4b480c59d1ce5 --- core/coreiface/coreapi.go | 13 +++++++++++++ core/coreiface/options/path.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 core/coreiface/options/path.go diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index a77ad636720..179531352d4 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,6 +5,9 @@ package iface import ( "context" + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + + cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" ) @@ -37,4 +40,14 @@ type CoreAPI interface { // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node ResolveNode(context.Context, Path) (ipld.Node, error) + + // ParsePath parses string path to a Path + ParsePath(context.Context, string, ...options.ParsePathOption) (Path, error) + + // WithResolve is an option for ParsePath which when set to true tells + // ParsePath to also resolve the path + WithResolve(bool) options.ParsePathOption + + // ParseCid creates new path from the provided CID + ParseCid(*cid.Cid) Path } diff --git a/core/coreiface/options/path.go b/core/coreiface/options/path.go new file mode 100644 index 00000000000..bf6eed65b8c --- /dev/null +++ b/core/coreiface/options/path.go @@ -0,0 +1,30 @@ +package options + +type ParsePathSettings struct { + Resolve bool +} + +type ParsePathOption func(*ParsePathSettings) error + +func ParsePathOptions(opts ...ParsePathOption) (*ParsePathSettings, error) { + options := &ParsePathSettings{ + Resolve: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +type ApiOptions struct{} + +func (api *ApiOptions) WithResolve(r bool) ParsePathOption { + return func(settings *ParsePathSettings) error { + settings.Resolve = r + return nil + } +} From 161503c26f9fdc99045fc10d731bb8036769e390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 8 Feb 2018 17:39:05 +0100 Subject: [PATCH 053/286] coreapi: separate path into two types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@79875b01300b77c8437ec0ca1b22d497edb79cd9 This commit was moved from ipfs/boxo@5a61226d830993d09c7d76d970b1c5a9de94f834 --- core/coreiface/block.go | 4 ++-- core/coreiface/coreapi.go | 14 ++++---------- core/coreiface/dag.go | 2 +- core/coreiface/object.go | 10 +++++----- core/coreiface/options/path.go | 30 ------------------------------ core/coreiface/path.go | 15 +++++++++++++-- core/coreiface/pin.go | 4 ++-- core/coreiface/unixfs.go | 2 +- 8 files changed, 28 insertions(+), 53 deletions(-) delete mode 100644 core/coreiface/options/path.go diff --git a/core/coreiface/block.go b/core/coreiface/block.go index a9e577d7655..468c0094788 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -13,13 +13,13 @@ type BlockStat interface { Size() int // Path returns path to the block - Path() Path + Path() ResolvedPath } // BlockAPI specifies the interface to the block layer type BlockAPI interface { // Put imports raw block data, hashing it using specified settings. - Put(context.Context, io.Reader, ...options.BlockPutOption) (Path, error) + Put(context.Context, io.Reader, ...options.BlockPutOption) (ResolvedPath, error) // Get attempts to resolve the path and return a reader for data in the block Get(context.Context, Path) (io.Reader, error) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 179531352d4..615b039b313 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,10 +5,8 @@ package iface import ( "context" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - - cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" + cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" ) // CoreAPI defines an unified interface to IPFS for Go programs @@ -35,19 +33,15 @@ type CoreAPI interface { Object() ObjectAPI // ResolvePath resolves the path using Unixfs resolver - ResolvePath(context.Context, Path) (Path, error) + ResolvePath(context.Context, Path) (ResolvedPath, error) // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node ResolveNode(context.Context, Path) (ipld.Node, error) // ParsePath parses string path to a Path - ParsePath(context.Context, string, ...options.ParsePathOption) (Path, error) - - // WithResolve is an option for ParsePath which when set to true tells - // ParsePath to also resolve the path - WithResolve(bool) options.ParsePathOption + ParsePath(context.Context, string) (Path, error) // ParseCid creates new path from the provided CID - ParseCid(*cid.Cid) Path + ParseCid(*cid.Cid) ResolvedPath } diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 158db7419d5..3f92ebab34c 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -14,7 +14,7 @@ type DagAPI interface { // Put inserts data using specified format and input encoding. // Unless used with WithCodec or WithHash, the defaults "dag-cbor" and // "sha256" are used. - Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) (Path, error) + Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) (ResolvedPath, error) // Get attempts to resolve and get the node specified by the path Get(ctx context.Context, path Path) (ipld.Node, error) diff --git a/core/coreiface/object.go b/core/coreiface/object.go index a18a38ebe5d..ea9aa59480b 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -38,7 +38,7 @@ type ObjectAPI interface { New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) // Put imports the data into merkledag - Put(context.Context, io.Reader, ...options.ObjectPutOption) (Path, error) + Put(context.Context, io.Reader, ...options.ObjectPutOption) (ResolvedPath, error) // Get returns the node for the path Get(context.Context, Path) (ipld.Node, error) @@ -55,14 +55,14 @@ type ObjectAPI interface { // AddLink adds a link under the specified path. child path can point to a // subdirectory within the patent which must be present (can be overridden // with WithCreate option). - AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (Path, error) + AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (ResolvedPath, error) // RmLink removes a link from the node - RmLink(ctx context.Context, base Path, link string) (Path, error) + RmLink(ctx context.Context, base Path, link string) (ResolvedPath, error) // AppendData appends data to the node - AppendData(context.Context, Path, io.Reader) (Path, error) + AppendData(context.Context, Path, io.Reader) (ResolvedPath, error) // SetData sets the data contained in the node - SetData(context.Context, Path, io.Reader) (Path, error) + SetData(context.Context, Path, io.Reader) (ResolvedPath, error) } diff --git a/core/coreiface/options/path.go b/core/coreiface/options/path.go deleted file mode 100644 index bf6eed65b8c..00000000000 --- a/core/coreiface/options/path.go +++ /dev/null @@ -1,30 +0,0 @@ -package options - -type ParsePathSettings struct { - Resolve bool -} - -type ParsePathOption func(*ParsePathSettings) error - -func ParsePathOptions(opts ...ParsePathOption) (*ParsePathSettings, error) { - options := &ParsePathSettings{ - Resolve: false, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -type ApiOptions struct{} - -func (api *ApiOptions) WithResolve(r bool) ParsePathOption { - return func(settings *ParsePathSettings) error { - settings.Resolve = r - return nil - } -} diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 51513772fd4..4cfd916deb9 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -6,13 +6,24 @@ import ( // Path is a generic wrapper for paths used in the API. A path can be resolved // to a CID using one of Resolve functions in the API. +// TODO: figure out/explain namespaces type Path interface { // String returns the path as a string. String() string + + // Namespace returns the first component of the path + Namespace() string +} + +// ResolvedPath is a resolved Path +type ResolvedPath interface { // Cid returns cid referred to by path Cid() *cid.Cid + // Root returns cid of root path Root() *cid.Cid - // Resolved returns whether path has been fully resolved - Resolved() bool + + //TODO: Path remainder + + Path } diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 5994c758686..2e119cbeae8 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -9,7 +9,7 @@ import ( // Pin holds information about pinned resource type Pin interface { // Path to the pinned object - Path() Path + Path() ResolvedPath // Type of the pin Type() string @@ -27,7 +27,7 @@ type PinStatus interface { // BadPinNode is a node that has been marked as bad by Pin.Verify type BadPinNode interface { // Path is the path of the node - Path() Path + Path() ResolvedPath // Err is the reason why the node has been marked as bad Err() error diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index c59451d002f..1ddc2067444 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -10,7 +10,7 @@ import ( // UnixfsAPI is the basic interface to immutable files in IPFS type UnixfsAPI interface { // Add imports the data from the reader into merkledag file - Add(context.Context, io.Reader) (Path, error) + Add(context.Context, io.Reader) (ResolvedPath, error) // Cat returns a reader for the file Cat(context.Context, Path) (Reader, error) From fd3e7b365a6752016b836ab1dd1eef45580522cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 30 Mar 2018 22:21:57 +0200 Subject: [PATCH 054/286] coreapi: remove ctx from ParsePath, split ParseCid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@e4a333226c4cff7d76082700c14391133af6a7e5 This commit was moved from ipfs/boxo@38520ef87802adf0c77aaece8cc9d203b65461d5 --- core/coreiface/coreapi.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 615b039b313..f5e81adce6d 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -40,8 +40,11 @@ type CoreAPI interface { ResolveNode(context.Context, Path) (ipld.Node, error) // ParsePath parses string path to a Path - ParsePath(context.Context, string) (Path, error) + ParsePath(string) (Path, error) - // ParseCid creates new path from the provided CID - ParseCid(*cid.Cid) ResolvedPath + // IpfsPath creates new /ipfs path from the provided CID + IpfsPath(*cid.Cid) ResolvedPath + + // IpldPath creates new /ipld path from the provided CID + IpldPath(*cid.Cid) ResolvedPath } From 2aed59e080591ca0e2a41feb5e011332340cf965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 30 Mar 2018 22:44:23 +0200 Subject: [PATCH 055/286] coreapi: path.Mutable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@bbff408d0ee7a756bce56956d0e72f0a3df6bbbc This commit was moved from ipfs/boxo@620bec8b444b2c41107a2aa8a0ed39062be3b877 --- core/coreiface/path.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 4cfd916deb9..bb87a6b3bce 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -6,13 +6,25 @@ import ( // Path is a generic wrapper for paths used in the API. A path can be resolved // to a CID using one of Resolve functions in the API. -// TODO: figure out/explain namespaces +// +// Paths must be prefixed with a valid prefix: +// +// * /ipfs - Immutable unixfs path (files) +// * /ipld - Immutable ipld path (data) +// * /ipns - Mutable names. Usually resolves to one of the immutable paths +//TODO: /local (MFS) type Path interface { // String returns the path as a string. String() string // Namespace returns the first component of the path Namespace() string + + // Mutable returns false if the data pointed to by this path in guaranteed + // to not change. + // + // Note that resolved mutable path can be immutable. + Mutable() bool } // ResolvedPath is a resolved Path From 16ea6d13bacead469e49ea8135fc5d42342626fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 3 Apr 2018 14:49:33 +0200 Subject: [PATCH 056/286] coreapi: path remainders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@a6d0272a575722dbaef8c21c869e7625692fe7f6 This commit was moved from ipfs/boxo@d0da662cf78f21d6e3d170b11e33da14444f838b --- core/coreiface/path.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index bb87a6b3bce..b4a9f0dbd9a 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -29,13 +29,14 @@ type Path interface { // ResolvedPath is a resolved Path type ResolvedPath interface { - // Cid returns cid referred to by path + // Cid returns the CID referred to by path Cid() *cid.Cid - // Root returns cid of root path + // Root returns the CID of root path Root() *cid.Cid - //TODO: Path remainder + // Remainder returns unresolved part of the path + Remainder() string Path } From 06f1d1a19a8863b41d9e9d7095ba00333be49598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 20 Apr 2018 13:56:33 +0200 Subject: [PATCH 057/286] coreapi: add more docs for path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@5abaad9e8573557e0bd7f3b1b45838053a85ffd7 This commit was moved from ipfs/boxo@d1d67409e744a2a697a3c05de0eb34b0bfbed175 --- core/coreiface/path.go | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index b4a9f0dbd9a..d233afae53e 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -17,7 +17,9 @@ type Path interface { // String returns the path as a string. String() string - // Namespace returns the first component of the path + // Namespace returns the first component of the path. + // + // For example path "/ipfs/QmHash", calling Namespace() will return "ipfs" Namespace() string // Mutable returns false if the data pointed to by this path in guaranteed @@ -29,13 +31,29 @@ type Path interface { // ResolvedPath is a resolved Path type ResolvedPath interface { - // Cid returns the CID referred to by path + // Cid returns the CID of the object referenced by the path. + // + // Example: + // If you have 3 linked objects: QmRoot -> A -> B, and resolve path + // "/ipfs/QmRoot/A/B", the Cid method will return the CID of object B Cid() *cid.Cid - // Root returns the CID of root path + // Root returns the CID of the root object of the path + // + // Example: + // If you have 3 linked objects: QmRoot -> A -> B, and resolve path + // "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot Root() *cid.Cid // Remainder returns unresolved part of the path + // + // Example: + // If you have 2 linked objects: QmRoot -> A, where A is a CBOR node + // containing the following data: + // + // {"foo": {"bar": 42}} + // + // When resolving "/ipld/QmRoot/A/foo/bar", Remainder will return "foo/bar" Remainder() string Path From 70be3f394ba397728f5f31d4a4f2caf4d6c53af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 12 Jun 2018 02:57:57 +0200 Subject: [PATCH 058/286] coreapi: more docs for ResolvedPath MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@1806f0f94a444c88f0c842e03a454619e6d42e56 This commit was moved from ipfs/boxo@88c3a9e6cc05757813f6a3266244543529c58cf6 --- core/coreiface/path.go | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index d233afae53e..acdcd85da70 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -29,13 +29,38 @@ type Path interface { Mutable() bool } -// ResolvedPath is a resolved Path +// ResolvedPath is a path which was resolved to the last resolvable node type ResolvedPath interface { - // Cid returns the CID of the object referenced by the path. + // Cid returns the CID of the node referenced by the path. Remainder of the + // path is guaranteed to be within the node. // - // Example: - // If you have 3 linked objects: QmRoot -> A -> B, and resolve path - // "/ipfs/QmRoot/A/B", the Cid method will return the CID of object B + // Examples: + // If you have 3 linked objects: QmRoot -> A -> B: + // + // cidB := {"foo": {"bar": 42 }} + // cidA := {"B": {"/": cidB }} + // cidRoot := {"A": {"/": cidA }} + // + // And resolve paths: + // * "/ipfs/${cidRoot}" + // * Calling Cid() will return `cidRoot` + // * Calling Root() will return `cidRoot` + // * Calling Remainder() will return `` + // + // * "/ipfs/${cidRoot}/A" + // * Calling Cid() will return `cidA` + // * Calling Root() will return `cidRoot` + // * Calling Remainder() will return `` + // + // * "/ipfs/${cidRoot}/A/B/foo" + // * Calling Cid() will return `cidB` + // * Calling Root() will return `cidRoot` + // * Calling Remainder() will return `foo` + // + // * "/ipfs/${cidRoot}/A/B/foo/bar" + // * Calling Cid() will return `cidB` + // * Calling Root() will return `cidRoot` + // * Calling Remainder() will return `foo/bar` Cid() *cid.Cid // Root returns the CID of the root object of the path @@ -43,6 +68,8 @@ type ResolvedPath interface { // Example: // If you have 3 linked objects: QmRoot -> A -> B, and resolve path // "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot + // + // For more examples see the documentation of Cid() method Root() *cid.Cid // Remainder returns unresolved part of the path @@ -51,9 +78,11 @@ type ResolvedPath interface { // If you have 2 linked objects: QmRoot -> A, where A is a CBOR node // containing the following data: // - // {"foo": {"bar": 42}} + // {"foo": {"bar": 42 }} // // When resolving "/ipld/QmRoot/A/foo/bar", Remainder will return "foo/bar" + // + // For more examples see the documentation of Cid() method Remainder() string Path From b808f144b5b65e02307e0de0624deba9758d529e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 12 Jun 2018 03:52:26 +0200 Subject: [PATCH 059/286] coreapi: move path utils to interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@0a0e69cc424e6136e8f0a1fecabda94e7854bc7f This commit was moved from ipfs/boxo@92ebd6eb7be417dec28e3c8fbc0f0bb4db65d268 --- core/coreiface/coreapi.go | 10 ----- core/coreiface/path.go | 87 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 10 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index f5e81adce6d..82a2ebf4e32 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -6,7 +6,6 @@ import ( "context" ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" - cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid" ) // CoreAPI defines an unified interface to IPFS for Go programs @@ -38,13 +37,4 @@ type CoreAPI interface { // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node ResolveNode(context.Context, Path) (ipld.Node, error) - - // ParsePath parses string path to a Path - ParsePath(string) (Path, error) - - // IpfsPath creates new /ipfs path from the provided CID - IpfsPath(*cid.Cid) ResolvedPath - - // IpldPath creates new /ipld path from the provided CID - IpldPath(*cid.Cid) ResolvedPath } diff --git a/core/coreiface/path.go b/core/coreiface/path.go index acdcd85da70..e097ea3b692 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,9 +1,13 @@ package iface import ( + ipfspath "github.com/ipfs/go-ipfs/path" + cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" ) +//TODO: merge with ipfspath so we don't depend on it + // Path is a generic wrapper for paths used in the API. A path can be resolved // to a CID using one of Resolve functions in the API. // @@ -87,3 +91,86 @@ type ResolvedPath interface { Path } + +// path implements coreiface.Path +type path struct { + path ipfspath.Path +} + +// resolvedPath implements coreiface.resolvedPath +type resolvedPath struct { + path + cid *cid.Cid + root *cid.Cid + remainder string +} + +// IpfsPath creates new /ipfs path from the provided CID +func IpfsPath(c *cid.Cid) ResolvedPath { + return &resolvedPath{ + path: path{ipfspath.Path("/ipfs/" + c.String())}, + cid: c, + root: c, + remainder: "", + } +} + +// IpldPath creates new /ipld path from the provided CID +func IpldPath(c *cid.Cid) ResolvedPath { + return &resolvedPath{ + path: path{ipfspath.Path("/ipld/" + c.String())}, + cid: c, + root: c, + remainder: "", + } +} + +// ParsePath parses string path to a Path +func ParsePath(p string) (Path, error) { + pp, err := ipfspath.ParsePath(p) + if err != nil { + return nil, err + } + + return &path{path: pp}, nil +} + +// NewResolvedPath creates new ResolvedPath. This function performs no checks +// and is intended to be used by resolver implementations. Incorrect inputs may +// cause panics. Handle with care. +func NewResolvedPath(ipath ipfspath.Path, c *cid.Cid, root *cid.Cid, remainder string) ResolvedPath { + return &resolvedPath{ + path: path{ipath}, + cid: c, + root: root, + remainder: remainder, + } +} + +func (p *path) String() string { + return p.path.String() +} + +func (p *path) Namespace() string { + if len(p.path.Segments()) < 1 { + panic("path without namespace") //this shouldn't happen under any scenario + } + return p.path.Segments()[0] +} + +func (p *path) Mutable() bool { + //TODO: MFS: check for /local + return p.Namespace() == "ipns" +} + +func (p *resolvedPath) Cid() *cid.Cid { + return p.cid +} + +func (p *resolvedPath) Root() *cid.Cid { + return p.root +} + +func (p *resolvedPath) Remainder() string { + return p.remainder +} From 68fee2eb3884f58e17551333f47e79cfd64a65c5 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Sat, 28 Jul 2018 23:57:42 -0700 Subject: [PATCH 060/286] Extract path and resolver License: MIT Signed-off-by: Jeromy This commit was moved from ipfs/interface-go-ipfs-core@ebc2b3570f9c962cc9b9a8440fe1a88fea42628f This commit was moved from ipfs/boxo@069cd0e0d729e11cf7d9a4374b004e528fca18de --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index e097ea3b692..49b8cc5ea79 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "github.com/ipfs/go-ipfs/path" + ipfspath "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path" cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" ) From 1841565f9c1c4cb6520540543bddf4a2cef384b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 2 Feb 2018 16:28:02 +0100 Subject: [PATCH 061/286] coreapi: Pin option for Object.Put MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@ca13e9b2ef673c3eb63baecc0cf840036405e214 This commit was moved from ipfs/boxo@8fa8a1e440ea9d280b5c2b717f1de35602f83f08 --- core/coreiface/options/object.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go index aca02d67263..9257ea6077c 100644 --- a/core/coreiface/options/object.go +++ b/core/coreiface/options/object.go @@ -7,6 +7,7 @@ type ObjectNewSettings struct { type ObjectPutSettings struct { InputEnc string DataType string + Pin bool } type ObjectAddLinkSettings struct { @@ -35,6 +36,7 @@ func ObjectPutOptions(opts ...ObjectPutOption) (*ObjectPutSettings, error) { options := &ObjectPutSettings{ InputEnc: "json", DataType: "text", + Pin: false, } for _, opt := range opts { @@ -103,6 +105,15 @@ func (objectOpts) DataType(t string) ObjectPutOption { } } +// WithPin is an option for Object.Put which specifies whether to pin the added +// objects, default is false +func (objectOpts) WithPin(pin bool) ObjectPutOption { + return func(settings *ObjectPutSettings) error { + settings.Pin = pin + return nil + } +} + // Create is an option for Object.AddLink which specifies whether create required // directories for the child func (objectOpts) Create(create bool) ObjectAddLinkOption { From 5dbe176f5331c80be35bce0feeba622113c5545a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 2 Feb 2018 21:50:22 +0100 Subject: [PATCH 062/286] coreapi: implement Object.Diff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@00f6430f32022c0038bb4407cca5d9f136b0ee24 This commit was moved from ipfs/boxo@83c279f0be6bbc7a498345e8b82b7331b8fb356c --- core/coreiface/object.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/core/coreiface/object.go b/core/coreiface/object.go index ea9aa59480b..0a716dc97e7 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -31,6 +31,39 @@ type ObjectStat struct { CumulativeSize int } + +const ( + // DiffAdd is a Type of ObjectChange where a link was added to the graph + DiffAdd = iota + + // DiffRemove is a Type of ObjectChange where a link was removed from the graph + DiffRemove + + // DiffMod is a Type of ObjectChange where a link was changed in the graph + DiffMod +) + +// ObjectChange represents a change ia a graph +// TODO: do we want this to be an interface? +type ObjectChange struct { + // Type of the change, either: + // * DiffAdd - Added a link + // * DiffRemove - Removed a link + // * DiffMod - Modified a link + Type int + + // Path to the changed link + Path string + + // Before holds the link path before the change. Note that when a link is + // added, this will be nil. + Before Path + + // After holds the link path after the change. Note that when a link is + // removed, this will be nil. + After Path +} + // ObjectAPI specifies the interface to MerkleDAG and contains useful utilities // for manipulating MerkleDAG data structures. type ObjectAPI interface { @@ -65,4 +98,8 @@ type ObjectAPI interface { // SetData sets the data contained in the node SetData(context.Context, Path, io.Reader) (ResolvedPath, error) + + // Diff returns a set of changes needed to transform the first object into the + // second. + Diff(context.Context, Path, Path) ([]ObjectChange, error) } From cb79396b3531b910737e28a6e4bd4bc35a4ffdeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 2 Feb 2018 22:36:01 +0100 Subject: [PATCH 063/286] commands: switch object commands to CoreAPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@9fe2a845730cb243ba72ceb3a1be7871467b416b This commit was moved from ipfs/boxo@157bb70fa94828c5c37466e6cc75e2058454ed2c --- core/coreiface/object.go | 5 ++--- core/coreiface/options/object.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 0a716dc97e7..1c7caeb77bc 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -31,7 +31,6 @@ type ObjectStat struct { CumulativeSize int } - const ( // DiffAdd is a Type of ObjectChange where a link was added to the graph DiffAdd = iota @@ -57,11 +56,11 @@ type ObjectChange struct { // Before holds the link path before the change. Note that when a link is // added, this will be nil. - Before Path + Before ResolvedPath // After holds the link path after the change. Note that when a link is // removed, this will be nil. - After Path + After ResolvedPath } // ObjectAPI specifies the interface to MerkleDAG and contains useful utilities diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go index 9257ea6077c..e484a9f3632 100644 --- a/core/coreiface/options/object.go +++ b/core/coreiface/options/object.go @@ -105,9 +105,9 @@ func (objectOpts) DataType(t string) ObjectPutOption { } } -// WithPin is an option for Object.Put which specifies whether to pin the added +// Pin is an option for Object.Put which specifies whether to pin the added // objects, default is false -func (objectOpts) WithPin(pin bool) ObjectPutOption { +func (objectOpts) Pin(pin bool) ObjectPutOption { return func(settings *ObjectPutSettings) error { settings.Pin = pin return nil From 5b28066131841060f97c7291189df9271d7d680b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 25 Jul 2018 22:49:17 +0200 Subject: [PATCH 064/286] object coreapi: Address review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@af43bf0a5b8a8eb409dc5e3731cf86afd5b67304 This commit was moved from ipfs/boxo@c1cdbfdc59df5b72610ae52ff80a44cb81f679c9 --- core/coreiface/object.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 1c7caeb77bc..3eb0ea9ef37 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -31,25 +31,27 @@ type ObjectStat struct { CumulativeSize int } +// ChangeType denotes type of change in ObjectChange +type ChangeType int + const ( - // DiffAdd is a Type of ObjectChange where a link was added to the graph - DiffAdd = iota + // DiffAdd is set when a link was added to the graph + DiffAdd ChangeType = iota - // DiffRemove is a Type of ObjectChange where a link was removed from the graph + // DiffRemove is set when a link was removed from the graph DiffRemove - // DiffMod is a Type of ObjectChange where a link was changed in the graph + // DiffMod is set when a link was changed in the graph DiffMod ) // ObjectChange represents a change ia a graph -// TODO: do we want this to be an interface? type ObjectChange struct { // Type of the change, either: // * DiffAdd - Added a link // * DiffRemove - Removed a link // * DiffMod - Modified a link - Type int + Type ChangeType // Path to the changed link Path string From 04c548b1d2e75aa0f31755a90b1d059ff9210dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 3 Aug 2018 18:06:57 +0200 Subject: [PATCH 065/286] coreapi: dag: Batching interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@f4b74679d1eb5597e430a52f4cca826d511898c3 This commit was moved from ipfs/boxo@83081a0c1b91bb9554d56ea074ef28ca02b38ed9 --- core/coreiface/dag.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 3f92ebab34c..a128e97c5bc 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -4,21 +4,36 @@ import ( "context" "io" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" ) -// DagAPI specifies the interface to IPLD -type DagAPI interface { +// DagOps groups operations that can be batched together +type DagOps interface { // Put inserts data using specified format and input encoding. // Unless used with WithCodec or WithHash, the defaults "dag-cbor" and // "sha256" are used. Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) (ResolvedPath, error) +} + +// DagBatch is the batching version of DagAPI. All implementations of DagBatch +// should be threadsafe +type DagBatch interface { + DagOps + + Commit(ctx context.Context) error +} + +// DagAPI specifies the interface to IPLD +type DagAPI interface { + DagOps // Get attempts to resolve and get the node specified by the path Get(ctx context.Context, path Path) (ipld.Node, error) // Tree returns list of paths within a node specified by the path. Tree(ctx context.Context, path Path, opts ...options.DagTreeOption) ([]Path, error) + + Batch(ctx context.Context) DagBatch } From a9097b5738eaf33a7ae2a723ccacdfd225863833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 3 Aug 2018 18:19:45 +0200 Subject: [PATCH 066/286] coreapi: dag: Missing batch docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@77b458e7426ae384692ed7c70a3a6179f4adc1b3 This commit was moved from ipfs/boxo@de98b9bd4549e5e475d3d096c519ae685ac008cc --- core/coreiface/dag.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index a128e97c5bc..01d6112e74b 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -22,6 +22,7 @@ type DagOps interface { type DagBatch interface { DagOps + // Commit commits nodes to the datastore and announces them to the network Commit(ctx context.Context) error } @@ -35,5 +36,6 @@ type DagAPI interface { // Tree returns list of paths within a node specified by the path. Tree(ctx context.Context, path Path, opts ...options.DagTreeOption) ([]Path, error) + // Batch creates new DagBatch Batch(ctx context.Context) DagBatch } From eea330740907c05834d39687ddc1596387f5743f Mon Sep 17 00:00:00 2001 From: Jeromy Date: Sun, 5 Aug 2018 13:22:51 -0700 Subject: [PATCH 067/286] Update bitswap deps License: MIT Signed-off-by: Jeromy This commit was moved from ipfs/interface-go-ipfs-core@24dde48825577a7f5e052be01025f22a413cc57b This commit was moved from ipfs/boxo@3bb8c057c6fe89c2bcc4824581cb3e444f0459c8 --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 49b8cc5ea79..069474c23c6 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmYKNMEUK7nCVAefgXF1LVtZEZg3uRmBqiae4FJRXDNAyJ/go-path" + ipfspath "gx/ipfs/Qme34dT9spiPgunbueNtziRX4SvfLHDFZQvmTBVK8p4qNT/go-path" cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" ) From e4f5db5aa62f7982c2361a80b111d636de4640a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 3 Aug 2018 16:46:25 +0200 Subject: [PATCH 068/286] coreapi: key: some changes to match command functionality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@12537a60f5318fec2fdf2c02a3afd3786b673f07 This commit was moved from ipfs/boxo@f9afe981175685c29705b480a2a68688d14c3a3b --- core/coreiface/key.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 928aa265f8c..9e9c7e4002a 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -4,14 +4,20 @@ import ( "context" options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + + "gx/ipfs/QmdVrMn1LhB4ybb8hMVaMLXnA8XRSewMnK6YqXKXoTcRvN/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore type Key interface { // Key returns key name Name() string + // Path returns key path Path() Path + + // Id returns key PeerID + Id() peer.ID } // KeyAPI specifies the interface to Keystore @@ -28,5 +34,5 @@ type KeyAPI interface { List(ctx context.Context) ([]Key, error) // Remove removes keys from keystore. Returns ipns path of the removed key - Remove(ctx context.Context, name string) (Path, error) + Remove(ctx context.Context, name string) (Key, error) } From 16c6be00861e9c59cb66bad9a412a94d61db64a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 7 Aug 2018 15:10:34 +0200 Subject: [PATCH 069/286] key cmd: fix codeclimate warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@814f82cf806d4fefc9f5158e85807b4c96751637 This commit was moved from ipfs/boxo@55223e9427daacfa41800357a551aad8bce06ea1 --- core/coreiface/key.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 9e9c7e4002a..2abf3559b73 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -16,8 +16,8 @@ type Key interface { // Path returns key path Path() Path - // Id returns key PeerID - Id() peer.ID + // ID returns key PeerID + ID() peer.ID } // KeyAPI specifies the interface to Keystore From 390006651bde2fab907f89e3d946b83c5021f677 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 6 Aug 2018 22:10:53 -0700 Subject: [PATCH 070/286] gx: update deps License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@365f5eb472016cac6e893ccd44a114eb9b8cfcd5 This commit was moved from ipfs/boxo@aa067a121b31b26ae87a5a2494f574c55e2e7edc --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 069474c23c6..4c4c5153282 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/Qme34dT9spiPgunbueNtziRX4SvfLHDFZQvmTBVK8p4qNT/go-path" + ipfspath "gx/ipfs/QmY2QaawxgJw2rn7WsFNkWEYph3z2azpyYdrhAc1JctDmE/go-path" cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" ) From e24a33d4cbf6ac3c67eac3320f42c5ecd7795b67 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 8 Aug 2018 18:51:17 -0700 Subject: [PATCH 071/286] update gogo-protobuf fixes #3214 License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@1ef16343d8d91bd685c8b4dc6554fda5e4531b36 This commit was moved from ipfs/boxo@e415aa12146cdbaffdc1619687c307cd9de09842 --- core/coreiface/key.go | 2 +- core/coreiface/path.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 2abf3559b73..3730f359247 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmdVrMn1LhB4ybb8hMVaMLXnA8XRSewMnK6YqXKXoTcRvN/go-libp2p-peer" + "gx/ipfs/QmcZSzKEM5yDfpZbeEEZaVmaZ1zXm6JWTbrQZSB8hCVPzk/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 4c4c5153282..c51d316454e 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmY2QaawxgJw2rn7WsFNkWEYph3z2azpyYdrhAc1JctDmE/go-path" + ipfspath "gx/ipfs/QmPqCBrmkm7jNfYi7xFS7mUZsrN6DEumBMrxLnL7axNJx1/go-path" cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" ) From 0d7b9a837e694a50d8cd1f9e179b2c569c4a11df Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Sun, 12 Aug 2018 19:15:07 -0400 Subject: [PATCH 072/286] Gx updates and fixes to use new cid.Builder interface. License: MIT Signed-off-by: Kevin Atkinson This commit was moved from ipfs/interface-go-ipfs-core@05f527a4ab81c36f8965de35bdb8352a92a61718 This commit was moved from ipfs/boxo@d91c0d7ac499f29b5b49219df4c1fdbf2e222bcd --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/object.go | 4 ++-- core/coreiface/options/dag.go | 2 +- core/coreiface/path.go | 4 ++-- core/coreiface/unixfs.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 82a2ebf4e32..d7614f01de1 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" + ipld "gx/ipfs/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 01d6112e74b..77577d0fce3 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -6,7 +6,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" + ipld "gx/ipfs/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/go-ipld-format" ) // DagOps groups operations that can be batched together diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 3eb0ea9ef37..dc86f46c1c3 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" - ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" + ipld "gx/ipfs/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/go-ipld-format" + cid "gx/ipfs/Qmdu2AYUV7yMoVBQPxXNfe7FJcdx16kYtsx6jAPKWQYF1y/go-cid" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index 57465deee91..a43a144fc9c 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -3,7 +3,7 @@ package options import ( "math" - cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" + cid "gx/ipfs/Qmdu2AYUV7yMoVBQPxXNfe7FJcdx16kYtsx6jAPKWQYF1y/go-cid" ) type DagPutSettings struct { diff --git a/core/coreiface/path.go b/core/coreiface/path.go index c51d316454e..28e0f431c0d 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,9 +1,9 @@ package iface import ( - ipfspath "gx/ipfs/QmPqCBrmkm7jNfYi7xFS7mUZsrN6DEumBMrxLnL7axNJx1/go-path" + ipfspath "gx/ipfs/QmTG5WFmAM4uAnqGskeAPijdpTmmNDLJNCQ71NqfdvC6hV/go-path" - cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid" + cid "gx/ipfs/Qmdu2AYUV7yMoVBQPxXNfe7FJcdx16kYtsx6jAPKWQYF1y/go-cid" ) //TODO: merge with ipfspath so we don't depend on it diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 1ddc2067444..0ec63d5163c 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,7 +4,7 @@ import ( "context" "io" - ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format" + ipld "gx/ipfs/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/go-ipld-format" ) // UnixfsAPI is the basic interface to immutable files in IPFS From e1f39ec60e3ada6404a5d5681b872c0b483e7c1b Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 13 Aug 2018 14:29:22 -0700 Subject: [PATCH 073/286] update go-datastore to use []byte values instead of {}interface values * Most of our datastores barf on non []byte values. * We have to have a bunch of "is this a []byte" checks. * Saves some allocations. License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@bb2d55c26ae125a50a6250df13479d70a84e4073 This commit was moved from ipfs/boxo@454f0f425c406d96427b7e0a262a33081c308dbf --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 28e0f431c0d..d2933ece588 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmTG5WFmAM4uAnqGskeAPijdpTmmNDLJNCQ71NqfdvC6hV/go-path" + ipfspath "gx/ipfs/QmV1W98rBAovVJGkeYHfqJ19JdT9dQbbWsCq9zPaMyrxYx/go-path" cid "gx/ipfs/Qmdu2AYUV7yMoVBQPxXNfe7FJcdx16kYtsx6jAPKWQYF1y/go-cid" ) From 9bef462a53b0edbc64bc2ad2c6c3e122895a17cf Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 15 Aug 2018 08:30:22 -0700 Subject: [PATCH 074/286] gx: update go-cid License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@9d5772a1cf4ffcf6d9c7717e074d30540d36f263 This commit was moved from ipfs/boxo@aac8a89a8ac8584416db46bc1968cd3e185241db --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/object.go | 4 ++-- core/coreiface/options/dag.go | 2 +- core/coreiface/path.go | 4 ++-- core/coreiface/unixfs.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index d7614f01de1..ab53740697a 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - ipld "gx/ipfs/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/go-ipld-format" + ipld "gx/ipfs/QmaA8GkXUYinkkndvg7T6Tx7gYXemhxjaxLisEPes7Rf1P/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 77577d0fce3..d547e8531dc 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -6,7 +6,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/go-ipld-format" + ipld "gx/ipfs/QmaA8GkXUYinkkndvg7T6Tx7gYXemhxjaxLisEPes7Rf1P/go-ipld-format" ) // DagOps groups operations that can be batched together diff --git a/core/coreiface/object.go b/core/coreiface/object.go index dc86f46c1c3..812b69a6471 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/go-ipld-format" - cid "gx/ipfs/Qmdu2AYUV7yMoVBQPxXNfe7FJcdx16kYtsx6jAPKWQYF1y/go-cid" + cid "gx/ipfs/QmYjnkEL7i731PirfVH1sis89evN7jt4otSHw5D2xXXwUV/go-cid" + ipld "gx/ipfs/QmaA8GkXUYinkkndvg7T6Tx7gYXemhxjaxLisEPes7Rf1P/go-ipld-format" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index a43a144fc9c..e89e4d707b2 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -3,7 +3,7 @@ package options import ( "math" - cid "gx/ipfs/Qmdu2AYUV7yMoVBQPxXNfe7FJcdx16kYtsx6jAPKWQYF1y/go-cid" + cid "gx/ipfs/QmYjnkEL7i731PirfVH1sis89evN7jt4otSHw5D2xXXwUV/go-cid" ) type DagPutSettings struct { diff --git a/core/coreiface/path.go b/core/coreiface/path.go index d2933ece588..49cea48ccd5 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,9 +1,9 @@ package iface import ( - ipfspath "gx/ipfs/QmV1W98rBAovVJGkeYHfqJ19JdT9dQbbWsCq9zPaMyrxYx/go-path" + ipfspath "gx/ipfs/QmWMcvZbNvk5codeqbm7L89C9kqSwka4KaHnDb8HRnxsSL/go-path" - cid "gx/ipfs/Qmdu2AYUV7yMoVBQPxXNfe7FJcdx16kYtsx6jAPKWQYF1y/go-cid" + cid "gx/ipfs/QmYjnkEL7i731PirfVH1sis89evN7jt4otSHw5D2xXXwUV/go-cid" ) //TODO: merge with ipfspath so we don't depend on it diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 0ec63d5163c..b42f56ba83c 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,7 +4,7 @@ import ( "context" "io" - ipld "gx/ipfs/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/go-ipld-format" + ipld "gx/ipfs/QmaA8GkXUYinkkndvg7T6Tx7gYXemhxjaxLisEPes7Rf1P/go-ipld-format" ) // UnixfsAPI is the basic interface to immutable files in IPFS From daa7186346d3f4263b3ebd2665695d933dccf2b5 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 21 Aug 2018 17:10:11 -0700 Subject: [PATCH 075/286] gx: update go-cid, go-libp2p-peer, go-ipfs-cmds, go-ipfs-cmdkit License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@14b366d332ad7524863889d6eddc696b550c57dd This commit was moved from ipfs/boxo@66c959b336ec55e8b2f9fbb8bd17f0922fdc0473 --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/key.go | 2 +- core/coreiface/object.go | 4 ++-- core/coreiface/options/dag.go | 2 +- core/coreiface/path.go | 4 ++-- core/coreiface/unixfs.go | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index ab53740697a..696eefbaf14 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - ipld "gx/ipfs/QmaA8GkXUYinkkndvg7T6Tx7gYXemhxjaxLisEPes7Rf1P/go-ipld-format" + ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index d547e8531dc..d3270928c05 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -6,7 +6,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmaA8GkXUYinkkndvg7T6Tx7gYXemhxjaxLisEPes7Rf1P/go-ipld-format" + ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format" ) // DagOps groups operations that can be batched together diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 3730f359247..cc7c409fd0e 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmcZSzKEM5yDfpZbeEEZaVmaZ1zXm6JWTbrQZSB8hCVPzk/go-libp2p-peer" + "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 812b69a6471..750638a332c 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - cid "gx/ipfs/QmYjnkEL7i731PirfVH1sis89evN7jt4otSHw5D2xXXwUV/go-cid" - ipld "gx/ipfs/QmaA8GkXUYinkkndvg7T6Tx7gYXemhxjaxLisEPes7Rf1P/go-ipld-format" + ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format" + cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index e89e4d707b2..689bb5c5328 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -3,7 +3,7 @@ package options import ( "math" - cid "gx/ipfs/QmYjnkEL7i731PirfVH1sis89evN7jt4otSHw5D2xXXwUV/go-cid" + cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" ) type DagPutSettings struct { diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 49cea48ccd5..25b09f4863a 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,9 +1,9 @@ package iface import ( - ipfspath "gx/ipfs/QmWMcvZbNvk5codeqbm7L89C9kqSwka4KaHnDb8HRnxsSL/go-path" + ipfspath "gx/ipfs/QmdMPBephdLYNESkruDX2hcDTgFYhoCt4LimWhgnomSdV2/go-path" - cid "gx/ipfs/QmYjnkEL7i731PirfVH1sis89evN7jt4otSHw5D2xXXwUV/go-cid" + cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" ) //TODO: merge with ipfspath so we don't depend on it diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index b42f56ba83c..80f7ba39604 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,7 +4,7 @@ import ( "context" "io" - ipld "gx/ipfs/QmaA8GkXUYinkkndvg7T6Tx7gYXemhxjaxLisEPes7Rf1P/go-ipld-format" + ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format" ) // UnixfsAPI is the basic interface to immutable files in IPFS From 7475c9a2465004489a6f1382a087127b5576c9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 2 Aug 2018 09:48:52 +0200 Subject: [PATCH 076/286] block cmd: use coreapi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@f4e38c0970c260e17d89348001eb15769e4650d8 This commit was moved from ipfs/boxo@e0f2bd3ae8cc797a0cdb789d8d7166b21d0264e9 --- core/coreiface/block.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/block.go b/core/coreiface/block.go index 468c0094788..b99b05fdb72 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -19,7 +19,7 @@ type BlockStat interface { // BlockAPI specifies the interface to the block layer type BlockAPI interface { // Put imports raw block data, hashing it using specified settings. - Put(context.Context, io.Reader, ...options.BlockPutOption) (ResolvedPath, error) + Put(context.Context, io.Reader, ...options.BlockPutOption) (BlockStat, error) // Get attempts to resolve the path and return a reader for data in the block Get(context.Context, Path) (io.Reader, error) From 9716a02efe48ba601eac8a07426d8f9f3a495c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 13 Aug 2018 21:39:41 +0200 Subject: [PATCH 077/286] coreapi: block: don't allow creation of invalid cidv0s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@f9d6dcc420879110f6d332e3de5a2048c07497e9 This commit was moved from ipfs/boxo@1c96fc32d211d18837b63a3befd65a24c600e430 --- core/coreiface/options/block.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index d6da99774c1..99445cca3e8 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -19,7 +19,7 @@ type BlockRmOption func(*BlockRmSettings) error func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, error) { options := &BlockPutSettings{ - Codec: "v0", + Codec: "", MhType: multihash.SHA2_256, MhLength: -1, } From b089e7cadcdb8cdf85874ea606bb64e7a1023487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 15 Aug 2018 14:01:19 +0200 Subject: [PATCH 078/286] coreapi: block: move option logic to options package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@68340710253f13b5c5376a9f882608cb0ab17f8c This commit was moved from ipfs/boxo@571c6def44851832a3617c699f1b166d1c9dc959 --- core/coreiface/options/block.go | 44 +++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 99445cca3e8..36b3baa0ebf 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -1,7 +1,9 @@ package options import ( - "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" + "fmt" + mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" + cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" ) type BlockPutSettings struct { @@ -17,20 +19,52 @@ type BlockRmSettings struct { type BlockPutOption func(*BlockPutSettings) error type BlockRmOption func(*BlockRmSettings) error -func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, error) { +func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, cid.Prefix, error) { options := &BlockPutSettings{ Codec: "", - MhType: multihash.SHA2_256, + MhType: mh.SHA2_256, MhLength: -1, } for _, opt := range opts { err := opt(options) if err != nil { - return nil, err + return nil, cid.Prefix{}, err } } - return options, nil + + var pref cid.Prefix + pref.Version = 1 + + if options.Codec == "" { + if options.MhType != mh.SHA2_256 || (options.MhLength != -1 && options.MhLength != 32) { + options.Codec = "protobuf" + } else { + options.Codec = "v0" + } + } + + if options.Codec == "v0" && options.MhType == mh.SHA2_256 { + pref.Version = 0 + } + + formatval, ok := cid.Codecs[options.Codec] + if !ok { + return nil, cid.Prefix{}, fmt.Errorf("unrecognized format: %s", options.Codec) + } + + if options.Codec == "v0" { + if options.MhType != mh.SHA2_256 || (options.MhLength != -1 && options.MhLength != 32) { + return nil, cid.Prefix{}, fmt.Errorf("only sha2-255-32 is allowed with CIDv0") + } + } + + pref.Codec = formatval + + pref.MhType = options.MhType + pref.MhLength = options.MhLength + + return options, pref, nil } func BlockRmOptions(opts ...BlockRmOption) (*BlockRmSettings, error) { From 3936b1e39d482574d75aa1e189c33f6c97d90544 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 29 Aug 2018 21:04:56 -0700 Subject: [PATCH 079/286] gx update deps License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@db3f7c2c47e384fabdc30a1b9141b92f56375f5d This commit was moved from ipfs/boxo@15e2043dc4f58e44d5676386753c2b8ec5be5229 --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 25b09f4863a..7873fe2bf70 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmdMPBephdLYNESkruDX2hcDTgFYhoCt4LimWhgnomSdV2/go-path" + ipfspath "gx/ipfs/QmTKaiDxQqVxmA1bRipSuP7hnTSgnMSmEa98NYeS6fcoiv/go-path" cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" ) From ae4189615030c7c4180f055426fdac04111ce15d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 7 Sep 2018 23:40:08 -0700 Subject: [PATCH 080/286] gx: update peerstore Also: * Updates go-floodsub to fix a data race. * Updates golang-lru License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@618aaa45543916248c209032a2e0309793666dd3 This commit was moved from ipfs/boxo@55f24526833cddd68b49a7858a48d8019b00a617 --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 7873fe2bf70..c2b4cd86970 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmTKaiDxQqVxmA1bRipSuP7hnTSgnMSmEa98NYeS6fcoiv/go-path" + ipfspath "gx/ipfs/QmNgXoHgXU1HzNb2HEZmRww9fDKE9NfDsvQwWLHiKHpvKM/go-path" cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" ) From 0787fb8f31349a102368878f3ea92ea59b0385bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 19:07:50 +0100 Subject: [PATCH 081/286] coreapi: dht interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@bbd736fdecec3e18d61e72b5a4beb9234f66c1ec This commit was moved from ipfs/boxo@6c40247cc1931a891782c579d48f517a7945569b --- core/coreiface/dht.go | 28 ++++++++++++++++++++++++++++ core/coreiface/options/dht.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 core/coreiface/dht.go create mode 100644 core/coreiface/options/dht.go diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go new file mode 100644 index 00000000000..1c8e68bd162 --- /dev/null +++ b/core/coreiface/dht.go @@ -0,0 +1,28 @@ +package iface + +import ( + "context" + + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + + ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr" + peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" +) + +// DhtAPI specifies the interface to the DHT +type DhtAPI interface { + // FindPeer queries the DHT for all of the multiaddresses associated with a + // Peer ID + FindPeer(context.Context, peer.ID) (<-chan ma.Multiaddr, error) + + // FindProviders finds peers in the DHT who can provide a specific value + // given a key. + FindProviders(context.Context, Path) (<-chan peer.ID, error) //TODO: is path the right choice here? + + // Provide announces to the network that you are providing given values + Provide(context.Context, Path, ...options.DhtProvideOption) error + + // WithRecursive is an option for Provide which specifies whether to provide + // the given path recursively + WithRecursive(recursive bool) options.DhtProvideOption +} diff --git a/core/coreiface/options/dht.go b/core/coreiface/options/dht.go new file mode 100644 index 00000000000..92fd14f4aa2 --- /dev/null +++ b/core/coreiface/options/dht.go @@ -0,0 +1,30 @@ +package options + +type DhtProvideSettings struct { + Recursive bool +} + +type DhtProvideOption func(*DhtProvideSettings) error + +func DhtProvideOptions(opts ...DhtProvideOption) (*DhtProvideSettings, error) { + options := &DhtProvideSettings{ + Recursive: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +type DhtOptions struct{} + +func (api *DhtOptions) WithRecursive(recursive bool) DhtProvideOption { + return func(settings *DhtProvideSettings) error { + settings.Recursive = recursive + return nil + } +} From e11318040f8b6c396e64cfbfad1e31332275b7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 19:12:54 +0100 Subject: [PATCH 082/286] coreapi: implement dht api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@db9865b9ee918e7db54e6cffa41a0e8950b3e170 This commit was moved from ipfs/boxo@1ca0f8b291354c50b54f51c7afd42bafcee8a0a6 --- core/coreiface/coreapi.go | 3 +++ core/coreiface/dht.go | 6 +++++- core/coreiface/options/dht.go | 26 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 696eefbaf14..9811b75be85 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -31,6 +31,9 @@ type CoreAPI interface { // ObjectAPI returns an implementation of Object API Object() ObjectAPI + // Dht returns an implementation of Dht API + Dht() DhtAPI + // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, Path) (ResolvedPath, error) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 1c8e68bd162..ce8509e01a8 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -17,7 +17,11 @@ type DhtAPI interface { // FindProviders finds peers in the DHT who can provide a specific value // given a key. - FindProviders(context.Context, Path) (<-chan peer.ID, error) //TODO: is path the right choice here? + FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan peer.ID, error) //TODO: is path the right choice here? + + // WithNumProviders is an option for FindProviders which specifies the + // number of peers to look for. Default is 20 + WithNumProviders(numProviders int) options.DhtFindProvidersOption // Provide announces to the network that you are providing given values Provide(context.Context, Path, ...options.DhtProvideOption) error diff --git a/core/coreiface/options/dht.go b/core/coreiface/options/dht.go index 92fd14f4aa2..3867e32c075 100644 --- a/core/coreiface/options/dht.go +++ b/core/coreiface/options/dht.go @@ -4,7 +4,12 @@ type DhtProvideSettings struct { Recursive bool } +type DhtFindProvidersSettings struct { + NumProviders int +} + type DhtProvideOption func(*DhtProvideSettings) error +type DhtFindProvidersOption func(*DhtFindProvidersSettings) error func DhtProvideOptions(opts ...DhtProvideOption) (*DhtProvideSettings, error) { options := &DhtProvideSettings{ @@ -20,6 +25,20 @@ func DhtProvideOptions(opts ...DhtProvideOption) (*DhtProvideSettings, error) { return options, nil } +func DhtFindProvidersOptions(opts ...DhtFindProvidersOption) (*DhtFindProvidersSettings, error) { + options := &DhtFindProvidersSettings{ + NumProviders: 20, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + type DhtOptions struct{} func (api *DhtOptions) WithRecursive(recursive bool) DhtProvideOption { @@ -28,3 +47,10 @@ func (api *DhtOptions) WithRecursive(recursive bool) DhtProvideOption { return nil } } + +func (api *DhtOptions) WithNumProviders(numProviders int) DhtFindProvidersOption { + return func(settings *DhtFindProvidersSettings) error { + settings.NumProviders = numProviders + return nil + } +} From afebd69388663cc1834e6f3e5660d91883cf6938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 19:17:30 +0100 Subject: [PATCH 083/286] coreapi: test using mock swarm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@db721461cc7c24fba56f74cfd6eb9c8064d0f8c5 This commit was moved from ipfs/boxo@0e411a61d02330a3b2544fb300e4577c1e0a1087 --- core/coreiface/dht.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index ce8509e01a8..1d23ece1f0d 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr" - peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" + peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" + ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" ) // DhtAPI specifies the interface to the DHT From e8da394b2146191447cf5812e4a8bcc846effcd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 19 Jul 2018 13:18:05 +0200 Subject: [PATCH 084/286] coreapi: dht: simplify the implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@22a12c2c233473aafa66ced10e222162a7711868 This commit was moved from ipfs/boxo@78b1cf5653e1cc2d8192db2b541fa09e2dbb2c7f --- core/coreiface/dht.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 1d23ece1f0d..01b7d7367ac 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -3,21 +3,21 @@ package iface import ( "context" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/go-ipfs/core/coreapi/interface/options" peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" - ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" + pstore "gx/ipfs/Qmda4cPRvSRyox3SqgJN6DfSZGU5TtHufPTp9uXjFj71X6/go-libp2p-peerstore" ) // DhtAPI specifies the interface to the DHT type DhtAPI interface { // FindPeer queries the DHT for all of the multiaddresses associated with a // Peer ID - FindPeer(context.Context, peer.ID) (<-chan ma.Multiaddr, error) + FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error) // FindProviders finds peers in the DHT who can provide a specific value // given a key. - FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan peer.ID, error) //TODO: is path the right choice here? + FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error) // WithNumProviders is an option for FindProviders which specifies the // number of peers to look for. Default is 20 From db3e060d61725dc22e97d7dab4ea69b3990f1170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 19 Jul 2018 13:27:06 +0200 Subject: [PATCH 085/286] coreapi: dht: refactor options after rebase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@656fc75b6f65435e224b7bd1e392ee8daf90f9b2 This commit was moved from ipfs/boxo@2bef47921404e491af08c3f66fc8475f53526685 --- core/coreiface/dht.go | 8 -------- core/coreiface/options/dht.go | 12 +++++++++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 01b7d7367ac..f9a08df342e 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -19,14 +19,6 @@ type DhtAPI interface { // given a key. FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error) - // WithNumProviders is an option for FindProviders which specifies the - // number of peers to look for. Default is 20 - WithNumProviders(numProviders int) options.DhtFindProvidersOption - // Provide announces to the network that you are providing given values Provide(context.Context, Path, ...options.DhtProvideOption) error - - // WithRecursive is an option for Provide which specifies whether to provide - // the given path recursively - WithRecursive(recursive bool) options.DhtProvideOption } diff --git a/core/coreiface/options/dht.go b/core/coreiface/options/dht.go index 3867e32c075..f989fa5e785 100644 --- a/core/coreiface/options/dht.go +++ b/core/coreiface/options/dht.go @@ -39,16 +39,22 @@ func DhtFindProvidersOptions(opts ...DhtFindProvidersOption) (*DhtFindProvidersS return options, nil } -type DhtOptions struct{} +type dhtOpts struct{} -func (api *DhtOptions) WithRecursive(recursive bool) DhtProvideOption { +var Dht dhtOpts + +// WithRecursive is an option for Dht.Provide which specifies whether to provide +// the given path recursively +func (dhtOpts) WithRecursive(recursive bool) DhtProvideOption { return func(settings *DhtProvideSettings) error { settings.Recursive = recursive return nil } } -func (api *DhtOptions) WithNumProviders(numProviders int) DhtFindProvidersOption { +// WithNumProviders is an option for Dht.FindProviders which specifies the +// number of peers to look for. Default is 20 +func (dhtOpts) WithNumProviders(numProviders int) DhtFindProvidersOption { return func(settings *DhtFindProvidersSettings) error { settings.NumProviders = numProviders return nil From 1baa0c0a71135bed10d4602d53ae642860d47d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 26 Jul 2018 15:09:26 +0200 Subject: [PATCH 086/286] coreapi dht: add a note on name change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@da52b4bfdb425964a3b5909bdbeacdfdb57cef40 This commit was moved from ipfs/boxo@1ee72b14142c20703fe9bd9690543d42491b5a91 --- core/coreiface/dht.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index f9a08df342e..cd704c3e373 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -10,6 +10,8 @@ import ( ) // DhtAPI specifies the interface to the DHT +// Note: This API will likely get renamed in near future, see +// https://github.com/ipfs/interface-ipfs-core/issues/249 for more context. type DhtAPI interface { // FindPeer queries the DHT for all of the multiaddresses associated with a // Peer ID From 835950fe4a2548c91a771c7cc67b24991747328f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 10 Aug 2018 13:24:33 +0200 Subject: [PATCH 087/286] move streaming set to thirdparty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@03a210bb130d8d46bc9d8c8bbac953edff53f32f This commit was moved from ipfs/boxo@8de59ef7854d5f337c333acc9902715e274cf2dc --- core/coreiface/dht.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index cd704c3e373..7b8119e4494 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -10,7 +10,7 @@ import ( ) // DhtAPI specifies the interface to the DHT -// Note: This API will likely get renamed in near future, see +// Note: This API will likely get deprecated in near future, see // https://github.com/ipfs/interface-ipfs-core/issues/249 for more context. type DhtAPI interface { // FindPeer queries the DHT for all of the multiaddresses associated with a From f56bdca2e6d56240778d8688e580ca385c2becc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 28 Aug 2018 02:22:09 +0200 Subject: [PATCH 088/286] coreapi: dht: remove option prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@a288d2c93dd22c48050ffb8cadce259377fd2125 This commit was moved from ipfs/boxo@4390a24ff2b4e85d7c999f3a1066c55bb2fa1cd6 --- core/coreiface/options/dht.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/coreiface/options/dht.go b/core/coreiface/options/dht.go index f989fa5e785..e13e1602006 100644 --- a/core/coreiface/options/dht.go +++ b/core/coreiface/options/dht.go @@ -43,18 +43,18 @@ type dhtOpts struct{} var Dht dhtOpts -// WithRecursive is an option for Dht.Provide which specifies whether to provide +// Recursive is an option for Dht.Provide which specifies whether to provide // the given path recursively -func (dhtOpts) WithRecursive(recursive bool) DhtProvideOption { +func (dhtOpts) Recursive(recursive bool) DhtProvideOption { return func(settings *DhtProvideSettings) error { settings.Recursive = recursive return nil } } -// WithNumProviders is an option for Dht.FindProviders which specifies the +// NumProviders is an option for Dht.FindProviders which specifies the // number of peers to look for. Default is 20 -func (dhtOpts) WithNumProviders(numProviders int) DhtFindProvidersOption { +func (dhtOpts) NumProviders(numProviders int) DhtFindProvidersOption { return func(settings *DhtFindProvidersSettings) error { settings.NumProviders = numProviders return nil From 00a0dc6a4b8a9a580abc1e5ed50539f2d5400499 Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Tue, 11 Sep 2018 22:19:44 -0400 Subject: [PATCH 089/286] gx update and fix code to use new Cid type License: MIT Signed-off-by: Kevin Atkinson This commit was moved from ipfs/interface-go-ipfs-core@bdbcb4cff02fb5502fc59563e5cb51c641261390 This commit was moved from ipfs/boxo@a48e694f9d8c710e4354c9818c46ae76d5fece00 --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/object.go | 6 +++--- core/coreiface/options/block.go | 2 +- core/coreiface/options/dag.go | 2 +- core/coreiface/path.go | 22 +++++++++++----------- core/coreiface/unixfs.go | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 9811b75be85..0053d472e6b 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format" + ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index d3270928c05..06bb91dce89 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -6,7 +6,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format" + ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) // DagOps groups operations that can be batched together diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 750638a332c..6b355a302a8 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -6,14 +6,14 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format" - cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" + cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" + ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) // ObjectStat provides information about dag nodes type ObjectStat struct { // Cid is the CID of the node - Cid *cid.Cid + Cid cid.Cid // NumLinks is number of links the node contains NumLinks int diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 36b3baa0ebf..6603136f301 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -2,8 +2,8 @@ package options import ( "fmt" + cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" ) type BlockPutSettings struct { diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index 689bb5c5328..4fdff0489c7 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -3,7 +3,7 @@ package options import ( "math" - cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" + cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) type DagPutSettings struct { diff --git a/core/coreiface/path.go b/core/coreiface/path.go index c2b4cd86970..e11e20cf0a6 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,9 +1,9 @@ package iface import ( - ipfspath "gx/ipfs/QmNgXoHgXU1HzNb2HEZmRww9fDKE9NfDsvQwWLHiKHpvKM/go-path" + ipfspath "gx/ipfs/QmRYx6fJzTWFoeTo3qQn64iDrVC154Gy9waQDhvKRr2ND3/go-path" - cid "gx/ipfs/QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb/go-cid" + cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) //TODO: merge with ipfspath so we don't depend on it @@ -65,7 +65,7 @@ type ResolvedPath interface { // * Calling Cid() will return `cidB` // * Calling Root() will return `cidRoot` // * Calling Remainder() will return `foo/bar` - Cid() *cid.Cid + Cid() cid.Cid // Root returns the CID of the root object of the path // @@ -74,7 +74,7 @@ type ResolvedPath interface { // "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot // // For more examples see the documentation of Cid() method - Root() *cid.Cid + Root() cid.Cid // Remainder returns unresolved part of the path // @@ -100,13 +100,13 @@ type path struct { // resolvedPath implements coreiface.resolvedPath type resolvedPath struct { path - cid *cid.Cid - root *cid.Cid + cid cid.Cid + root cid.Cid remainder string } // IpfsPath creates new /ipfs path from the provided CID -func IpfsPath(c *cid.Cid) ResolvedPath { +func IpfsPath(c cid.Cid) ResolvedPath { return &resolvedPath{ path: path{ipfspath.Path("/ipfs/" + c.String())}, cid: c, @@ -116,7 +116,7 @@ func IpfsPath(c *cid.Cid) ResolvedPath { } // IpldPath creates new /ipld path from the provided CID -func IpldPath(c *cid.Cid) ResolvedPath { +func IpldPath(c cid.Cid) ResolvedPath { return &resolvedPath{ path: path{ipfspath.Path("/ipld/" + c.String())}, cid: c, @@ -138,7 +138,7 @@ func ParsePath(p string) (Path, error) { // NewResolvedPath creates new ResolvedPath. This function performs no checks // and is intended to be used by resolver implementations. Incorrect inputs may // cause panics. Handle with care. -func NewResolvedPath(ipath ipfspath.Path, c *cid.Cid, root *cid.Cid, remainder string) ResolvedPath { +func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) ResolvedPath { return &resolvedPath{ path: path{ipath}, cid: c, @@ -163,11 +163,11 @@ func (p *path) Mutable() bool { return p.Namespace() == "ipns" } -func (p *resolvedPath) Cid() *cid.Cid { +func (p *resolvedPath) Cid() cid.Cid { return p.cid } -func (p *resolvedPath) Root() *cid.Cid { +func (p *resolvedPath) Root() cid.Cid { return p.root } diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 80f7ba39604..4a3aff6fc53 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,7 +4,7 @@ import ( "context" "io" - ipld "gx/ipfs/QmX5CsuHyVZeTLxgRSYkgLSDQKb9UjE8xnhQzCEJWWWFsC/go-ipld-format" + ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) // UnixfsAPI is the basic interface to immutable files in IPFS From 4160bd519c749fec8d300939a6f51e562cfa4c1a Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 11 Sep 2018 20:34:52 -0700 Subject: [PATCH 090/286] gx: fix hashes (some extra files got committed) License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@dec563d93e818189ec52f7eeeb70128c1c62deae This commit was moved from ipfs/boxo@91297a54c6b70a51fdea8f98c646e4191fc5d9ae --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index e11e20cf0a6..c61b3353379 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmRYx6fJzTWFoeTo3qQn64iDrVC154Gy9waQDhvKRr2ND3/go-path" + ipfspath "gx/ipfs/QmX7uSbkNz76yNwBhuwYwRbhihLnJqM73VTCjS3UMJud9A/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 7455bd65c0698e9a7975fd9fb072de6beb126e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 18 Sep 2018 04:30:33 +0200 Subject: [PATCH 091/286] resolve cmd: use coreapi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@c3053e816481188f8b20f1d56c3cfa648d4f39c8 This commit was moved from ipfs/boxo@28fe139695b6494eb257aca0d7e21741497a640a --- core/coreiface/options/name.go | 43 +++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index 48aecf18ba8..9ba4a8770e1 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -14,9 +14,12 @@ type NamePublishSettings struct { } type NameResolveSettings struct { - Recursive bool - Local bool - Cache bool + Depth int + Local bool + Cache bool + + DhtRecordCount int + DhtTimeout time.Duration } type NamePublishOption func(*NamePublishSettings) error @@ -40,9 +43,12 @@ func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) func NameResolveOptions(opts ...NameResolveOption) (*NameResolveSettings, error) { options := &NameResolveSettings{ - Recursive: false, - Local: false, - Cache: true, + Depth: 1, + Local: false, + Cache: true, + + DhtRecordCount: 16, + DhtTimeout: time.Minute, } for _, opt := range opts { @@ -80,11 +86,11 @@ func (nameOpts) Key(key string) NamePublishOption { } } -// Recursive is an option for Name.Resolve which specifies whether to perform a +// Depth is an option for Name.Resolve which specifies the maximum depth of a // recursive lookup. Default value is false -func (nameOpts) Recursive(recursive bool) NameResolveOption { +func (nameOpts) Depth(depth int) NameResolveOption { return func(settings *NameResolveSettings) error { - settings.Recursive = recursive + settings.Depth = depth return nil } } @@ -106,3 +112,22 @@ func (nameOpts) Cache(cache bool) NameResolveOption { return nil } } + +// DhtRecordCount is an option for Name.Resolve which specifies how many records +// we want to validate before selecting the best one (newest). Note that setting +// this value too low will have security implications +func (nameOpts) DhtRecordCount(rc int) NameResolveOption { + return func(settings *NameResolveSettings) error { + settings.DhtRecordCount = rc + return nil + } +} + +// DhtTimeout is an option for Name.Resolve which specifies timeout for +// DHT lookup +func (nameOpts) DhtTimeout(timeout time.Duration) NameResolveOption { + return func(settings *NameResolveSettings) error { + settings.DhtTimeout = timeout + return nil + } +} From 5411cc043c1656f4d4def511bea861932393b7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 19 Sep 2018 11:51:42 +0200 Subject: [PATCH 092/286] coreapi name: accept namesys options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@ca81d824222df0ed2c1ede6a3e166f7aa420b4f7 This commit was moved from ipfs/boxo@cd88b19ccb6d4ff617ea5e4c329c284315fc8707 --- core/coreiface/options/name.go | 36 ++++++---------------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index 9ba4a8770e1..ba3691b03cd 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -2,6 +2,8 @@ package options import ( "time" + + ropts "github.com/ipfs/go-ipfs/namesys/opts" ) const ( @@ -14,12 +16,10 @@ type NamePublishSettings struct { } type NameResolveSettings struct { - Depth int Local bool Cache bool - DhtRecordCount int - DhtTimeout time.Duration + ResolveOpts []ropts.ResolveOpt } type NamePublishOption func(*NamePublishSettings) error @@ -43,12 +43,8 @@ func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) func NameResolveOptions(opts ...NameResolveOption) (*NameResolveSettings, error) { options := &NameResolveSettings{ - Depth: 1, Local: false, Cache: true, - - DhtRecordCount: 16, - DhtTimeout: time.Minute, } for _, opt := range opts { @@ -86,15 +82,6 @@ func (nameOpts) Key(key string) NamePublishOption { } } -// Depth is an option for Name.Resolve which specifies the maximum depth of a -// recursive lookup. Default value is false -func (nameOpts) Depth(depth int) NameResolveOption { - return func(settings *NameResolveSettings) error { - settings.Depth = depth - return nil - } -} - // Local is an option for Name.Resolve which specifies if the lookup should be // offline. Default value is false func (nameOpts) Local(local bool) NameResolveOption { @@ -113,21 +100,10 @@ func (nameOpts) Cache(cache bool) NameResolveOption { } } -// DhtRecordCount is an option for Name.Resolve which specifies how many records -// we want to validate before selecting the best one (newest). Note that setting -// this value too low will have security implications -func (nameOpts) DhtRecordCount(rc int) NameResolveOption { - return func(settings *NameResolveSettings) error { - settings.DhtRecordCount = rc - return nil - } -} - -// DhtTimeout is an option for Name.Resolve which specifies timeout for -// DHT lookup -func (nameOpts) DhtTimeout(timeout time.Duration) NameResolveOption { +// +func (nameOpts) ResolveOption(opt ropts.ResolveOpt) NameResolveOption { return func(settings *NameResolveSettings) error { - settings.DhtTimeout = timeout + settings.ResolveOpts = append(settings.ResolveOpts, opt) return nil } } From e8e2f54912998b5d4f2bd97f45ccc58aef0dbd4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 24 Sep 2018 14:03:57 +0200 Subject: [PATCH 093/286] gx: update go-libp2p-routing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@143c911f1528ad45768b9ea1dd180b865c229fd1 This commit was moved from ipfs/boxo@fdaee8e479945dfe29bec1b56e575b5c9622a454 --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index c61b3353379..75901eaa4cf 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmX7uSbkNz76yNwBhuwYwRbhihLnJqM73VTCjS3UMJud9A/go-path" + ipfspath "gx/ipfs/Qmc17MNY1xUgiE2nopbi6KATWau9qcGZtdmKKuXvFMVUgc/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From ba7a34448e2bed4e26cc1feec81c5c98fe6cfbb6 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 24 Sep 2018 05:36:29 -0700 Subject: [PATCH 094/286] gx: update go-log go-ipld-cbor (and friends) License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@c1e241f73b853d5b8626125d24f8346c6331622b This commit was moved from ipfs/boxo@3bff21ef38fb40c5920de6e475607cd6e31bf0e5 --- core/coreiface/dht.go | 4 ++-- core/coreiface/key.go | 2 +- core/coreiface/path.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 7b8119e4494..2309ceb905b 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" - pstore "gx/ipfs/Qmda4cPRvSRyox3SqgJN6DfSZGU5TtHufPTp9uXjFj71X6/go-libp2p-peerstore" + peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" + pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/key.go b/core/coreiface/key.go index cc7c409fd0e..4305ae20d20 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" + "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 75901eaa4cf..0beab066395 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/Qmc17MNY1xUgiE2nopbi6KATWau9qcGZtdmKKuXvFMVUgc/go-path" + ipfspath "gx/ipfs/QmcjwUb36Z16NJkvDX6ccXPqsFswo6AsRXynyXcLLCphV2/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 8404b8263de39467bda064cdce59293db5914a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 18:54:58 +0100 Subject: [PATCH 095/286] coreapi: swarm interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@bc2ae0a441ed2da875bf2d815766e90b2c2a4d9f This commit was moved from ipfs/boxo@398a8ffdf544dac64be994ce4a34ef3013d9d584 --- core/coreiface/swarm.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 core/coreiface/swarm.go diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go new file mode 100644 index 00000000000..1ec260e07a6 --- /dev/null +++ b/core/coreiface/swarm.go @@ -0,0 +1,37 @@ +package iface + +import ( + "time" + + "context" + ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr" + peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" +) + +// PeerInfo contains information about a peer +type PeerInfo interface { + // ID returns PeerID + ID() peer.ID + + // Address returns the multiaddress via which we are connected with the peer + Address() ma.Multiaddr + + // Latency returns last known round trip time to the peer + Latency() time.Duration + + // Streams returns list of streams established with the peer + // TODO: should this return multicodecs? + Streams() []string +} + +// SwarmAPI specifies the interface to libp2p swarm +type SwarmAPI interface { + // Connect to a given address + Connect(context.Context, ma.Multiaddr) error + + // Disconnect from a given address + Disconnect(context.Context, ma.Multiaddr) error + + // Peers returns the list of peers we are connected to + Peers(context.Context) ([]PeerInfo, error) +} From fc8386301bc0534bac90eeb0b1c3b7b4a908a0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 19:02:57 +0100 Subject: [PATCH 096/286] coreapi: implement swarm api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@3ab7f14240700d0e64e011e5fca7c847afc9ce9e This commit was moved from ipfs/boxo@81615a9f48e0bba90d04b4ac389948124aeff053 --- core/coreiface/coreapi.go | 3 +++ core/coreiface/swarm.go | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 0053d472e6b..0b153b6f9a1 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -34,6 +34,9 @@ type CoreAPI interface { // Dht returns an implementation of Dht API Dht() DhtAPI + // Swarm returns an implementation of Swarm API + Swarm() SwarmAPI + // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, Path) (ResolvedPath, error) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 1ec260e07a6..1f0b1216f63 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -1,9 +1,9 @@ package iface import ( + "context" "time" - "context" ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr" peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" ) @@ -17,11 +17,11 @@ type PeerInfo interface { Address() ma.Multiaddr // Latency returns last known round trip time to the peer - Latency() time.Duration + Latency(context.Context) (time.Duration, error) // Streams returns list of streams established with the peer // TODO: should this return multicodecs? - Streams() []string + Streams(context.Context) ([]string, error) } // SwarmAPI specifies the interface to libp2p swarm From e839e46e938487e891dfea804e4ae18bddbefb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 5 Apr 2018 20:22:49 +0200 Subject: [PATCH 097/286] fix infinite loop in connInfo.ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@89ce6041ad9b851959cdd2434d4f7ab375459599 This commit was moved from ipfs/boxo@7e79c2365ce422f3c26401f2a0c8e1da99515aaf --- core/coreiface/swarm.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 1f0b1216f63..92817e6f4e9 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -4,8 +4,8 @@ import ( "context" "time" - ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr" - peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" + peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" + ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" ) // PeerInfo contains information about a peer From 619855cc7a6f166359654b6ac2e6b1e0efcbe000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 11 Sep 2018 20:50:15 +0200 Subject: [PATCH 098/286] swarm cmd: port to new cmd lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@59f549fe3aa60f48303f6283e09ae05c9224a84c This commit was moved from ipfs/boxo@6e9149c6f900ec598b0345cc97b0979b53ba8cb0 --- core/coreiface/swarm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 92817e6f4e9..2492f26967f 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -4,8 +4,8 @@ import ( "context" "time" - peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" + peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" ) // PeerInfo contains information about a peer From 284fd898dc3cf0f88b5816cb53d87d41676e9746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 17 Sep 2018 16:45:59 +0200 Subject: [PATCH 099/286] coreapi swarm: rewire connect/disconnect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@a48b2a807b98f5fe7eb4c1148bf938498a4836ce This commit was moved from ipfs/boxo@0f6f6ec8a4e5b41f01c658bf46f4d30b69a7ade5 --- core/coreiface/swarm.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 2492f26967f..7bd009f16f9 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -2,14 +2,22 @@ package iface import ( "context" + "errors" "time" ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" - peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" + "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" + "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" + pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore" ) -// PeerInfo contains information about a peer -type PeerInfo interface { +var ( + ErrNotConnected = errors.New("not connected") + ErrConnNotFound = errors.New("conn not found") + ) + +// ConnectionInfo contains information about a peer +type ConnectionInfo interface { // ID returns PeerID ID() peer.ID @@ -20,18 +28,17 @@ type PeerInfo interface { Latency(context.Context) (time.Duration, error) // Streams returns list of streams established with the peer - // TODO: should this return multicodecs? - Streams(context.Context) ([]string, error) + Streams(context.Context) ([]protocol.ID, error) } // SwarmAPI specifies the interface to libp2p swarm type SwarmAPI interface { - // Connect to a given address - Connect(context.Context, ma.Multiaddr) error + // Connect to a given peer + Connect(context.Context, pstore.PeerInfo) error // Disconnect from a given address Disconnect(context.Context, ma.Multiaddr) error // Peers returns the list of peers we are connected to - Peers(context.Context) ([]PeerInfo, error) + Peers(context.Context) ([]ConnectionInfo, error) } From cb1f0c550ff5acbde160286b46a5a18d9a4393df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 17 Sep 2018 19:53:15 +0200 Subject: [PATCH 100/286] coreapi swarm: rewire address listing cmds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@8c35696f74f086858b6acaf8ee6a0ffe570e46cb This commit was moved from ipfs/boxo@4020059a81eb3f31fec83c825d6ce4d9dd8c65c4 --- core/coreiface/key.go | 3 +++ core/coreiface/swarm.go | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 4305ae20d20..cc6dc890044 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -33,6 +33,9 @@ type KeyAPI interface { // List lists keys stored in keystore List(ctx context.Context) ([]Key, error) + // Self returns the 'main' node key + Self(ctx context.Context) (Key, error) + // Remove removes keys from keystore. Returns ipns path of the removed key Remove(ctx context.Context, name string) (Key, error) } diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 7bd009f16f9..caa6a70e327 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -9,12 +9,13 @@ import ( "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore" + net "gx/ipfs/QmfDPh144WGBqRxZb1TGDHerbMnZATrHZggAPw7putNnBq/go-libp2p-net" ) var ( ErrNotConnected = errors.New("not connected") ErrConnNotFound = errors.New("conn not found") - ) +) // ConnectionInfo contains information about a peer type ConnectionInfo interface { @@ -24,6 +25,9 @@ type ConnectionInfo interface { // Address returns the multiaddress via which we are connected with the peer Address() ma.Multiaddr + // Direction returns which way the connection was established + Direction() net.Direction + // Latency returns last known round trip time to the peer Latency(context.Context) (time.Duration, error) @@ -41,4 +45,8 @@ type SwarmAPI interface { // Peers returns the list of peers we are connected to Peers(context.Context) ([]ConnectionInfo, error) + + KnownAddrs(context.Context) (map[peer.ID][]ma.Multiaddr, error) + LocalAddrs(context.Context) ([]ma.Multiaddr, error) + ListenAddrs(context.Context) ([]ma.Multiaddr, error) } From a95fe8e687f56947c1356ee4f10739c541e64891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 2 Oct 2018 12:31:50 +0200 Subject: [PATCH 101/286] coreapi swarm: missing docs, review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@162cac0144b96596576bc9ec7389afaa8eb56135 This commit was moved from ipfs/boxo@9df903d67183fbb9c9ae66de11a4c62f92f7c1ee --- core/coreiface/swarm.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index caa6a70e327..8b464e5c1f0 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -29,10 +29,10 @@ type ConnectionInfo interface { Direction() net.Direction // Latency returns last known round trip time to the peer - Latency(context.Context) (time.Duration, error) + Latency() (time.Duration, error) // Streams returns list of streams established with the peer - Streams(context.Context) ([]protocol.ID, error) + Streams() ([]protocol.ID, error) } // SwarmAPI specifies the interface to libp2p swarm @@ -46,7 +46,12 @@ type SwarmAPI interface { // Peers returns the list of peers we are connected to Peers(context.Context) ([]ConnectionInfo, error) + // KnownAddrs returns the list of all addresses this node is aware of KnownAddrs(context.Context) (map[peer.ID][]ma.Multiaddr, error) + + // LocalAddrs returns the list of announced listening addresses LocalAddrs(context.Context) ([]ma.Multiaddr, error) + + // ListenAddrs returns the list of all listening addresses ListenAddrs(context.Context) ([]ma.Multiaddr, error) } From 99c68ac8c97652369fa2eceac144e81f8177bd4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 19 Sep 2018 23:40:45 +0200 Subject: [PATCH 102/286] Cleanup instances of manual resolver construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@47db102ccd13e62f40e7372b56b33dcf33e63c60 This commit was moved from ipfs/boxo@b7e28a936c5c9edee31e262c366c30fde7d872ab --- core/coreiface/util.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/coreiface/util.go b/core/coreiface/util.go index 8fd3e058fa5..6d58bf40d2b 100644 --- a/core/coreiface/util.go +++ b/core/coreiface/util.go @@ -1,10 +1,20 @@ package iface import ( + "context" "io" ) type Reader interface { - io.ReadSeeker + ReadSeekCloser + Size() uint64 + CtxReadFull(context.Context, []byte) (int, error) +} + +// A ReadSeekCloser implements interfaces to read, copy, seek and close. +type ReadSeekCloser interface { + io.Reader + io.Seeker io.Closer + io.WriterTo } From 7d9ebdcebe6a0691a0921c167b2c513037b1cebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Sep 2018 15:00:51 +0200 Subject: [PATCH 103/286] coreapi unixfs: use fileAdder directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@78136afef00445d43c96ec7c66249b881dcf95ff This commit was moved from ipfs/boxo@60c358b08ca8bbb2773d19533ddd9b9864f3d360 --- core/coreiface/options/unixfs.go | 50 ++++++++++++++++++++++++++++++++ core/coreiface/unixfs.go | 4 ++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 core/coreiface/options/unixfs.go diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go new file mode 100644 index 00000000000..8dc9806a776 --- /dev/null +++ b/core/coreiface/options/unixfs.go @@ -0,0 +1,50 @@ +package options + +import ( + mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" +) + +type UnixfsAddSettings struct { + CidVersion int + MhType uint64 + + InlineLimit int +} + +type UnixfsAddOption func(*UnixfsAddSettings) error + +func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) { + options := &UnixfsAddSettings{ + CidVersion: -1, + MhType: mh.SHA2_256, + + InlineLimit: 0, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + + return options, nil +} + +type unixfsOpts struct{} + +var Unixfs unixfsOpts + +func (unixfsOpts) CidVersion(version int) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.CidVersion = version + return nil + } +} + +func (unixfsOpts) Hash(mhtype uint64) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.MhType = mhtype + return nil + } +} diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 4a3aff6fc53..10febd9faa7 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,13 +4,15 @@ import ( "context" "io" + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) // UnixfsAPI is the basic interface to immutable files in IPFS type UnixfsAPI interface { // Add imports the data from the reader into merkledag file - Add(context.Context, io.Reader) (ResolvedPath, error) + Add(context.Context, io.ReadCloser, ...options.UnixfsAddOption) (ResolvedPath, error) // Cat returns a reader for the file Cat(context.Context, Path) (Reader, error) From d7afe85fe0523066da04d3274cd6f048328ca12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Sep 2018 15:59:53 +0200 Subject: [PATCH 104/286] coreapi unixfs: cid prefix options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@6c7f760b5d8ae479518992b322a7bd1ccc406247 This commit was moved from ipfs/boxo@0df36df660ece10808c7af055b59cd7052aaa7cf --- core/coreiface/options/unixfs.go | 8 ++++++-- core/coreiface/unixfs.go | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 8dc9806a776..ffed75577ea 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -8,7 +8,9 @@ type UnixfsAddSettings struct { CidVersion int MhType uint64 - InlineLimit int + InlineLimit int + RawLeaves bool + RawLeavesSet bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -18,7 +20,9 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) { CidVersion: -1, MhType: mh.SHA2_256, - InlineLimit: 0, + InlineLimit: 0, + RawLeaves: false, + RawLeavesSet: false, } for _, opt := range opts { diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 10febd9faa7..acc3b960ce3 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -10,6 +10,7 @@ import ( ) // UnixfsAPI is the basic interface to immutable files in IPFS +// NOTE: This API is heavily WIP, things are guaranteed to break frequently type UnixfsAPI interface { // Add imports the data from the reader into merkledag file Add(context.Context, io.ReadCloser, ...options.UnixfsAddOption) (ResolvedPath, error) From 9e57389b045a5202e2c91037d9cfaa87df751729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Sep 2018 16:19:32 +0200 Subject: [PATCH 105/286] coreapi unixfs: options for RawLeaves / Inline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@dbdf6fd63ad66e3b5e5649a349ee9ba9534590a0 This commit was moved from ipfs/boxo@6a3bc40fc4c131b19837c1007ba3e65a51de6ab1 --- core/coreiface/options/unixfs.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index ffed75577ea..3c46ed086e6 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -52,3 +52,18 @@ func (unixfsOpts) Hash(mhtype uint64) UnixfsAddOption { return nil } } + +func (unixfsOpts) RawLeaves(enable bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.RawLeaves = enable + settings.RawLeavesSet = true + return nil + } +} + +func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.InlineLimit = limit + return nil + } +} From 82ef32dcaf3619bc2d372ef0a634e56e159cc4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Sep 2018 16:40:31 +0200 Subject: [PATCH 106/286] coreapi unixfs: layout/chunker options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@ee22ac438536720b2646e6071ecc6519f4161a0c This commit was moved from ipfs/boxo@f858a5213f527b1ff67c45692c9e481301678398 --- core/coreiface/options/unixfs.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 3c46ed086e6..fe41af9a801 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -4,6 +4,13 @@ import ( mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" ) +type Layout int + +const ( + BalancedLayout Layout = iota + TrickleLeyout +) + type UnixfsAddSettings struct { CidVersion int MhType uint64 @@ -11,6 +18,9 @@ type UnixfsAddSettings struct { InlineLimit int RawLeaves bool RawLeavesSet bool + + Chunker string + Layout Layout } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -23,6 +33,9 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) { InlineLimit: 0, RawLeaves: false, RawLeavesSet: false, + + Chunker: "size-262144", + Layout: BalancedLayout, } for _, opt := range opts { @@ -67,3 +80,17 @@ func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption { return nil } } + +func (unixfsOpts) Chunker(chunker string) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Chunker = chunker + return nil + } +} + +func (unixfsOpts) Layout(layout Layout) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Layout = layout + return nil + } +} From ac8ff307329da34110495b69df9c003232f78c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Sep 2018 23:05:22 +0200 Subject: [PATCH 107/286] coreapi unixfs: pin/local/hash-only options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@8521907e1a8ac009252669ad3e40be2d93438ad3 This commit was moved from ipfs/boxo@27ded0dea2d8b2ee4c115c9cd40c2d1514927162 --- core/coreiface/options/unixfs.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index fe41af9a801..6012ce77b23 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -21,6 +21,10 @@ type UnixfsAddSettings struct { Chunker string Layout Layout + + Pin bool + OnlyHash bool + Local bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -36,6 +40,10 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) { Chunker: "size-262144", Layout: BalancedLayout, + + Pin: false, + OnlyHash: false, + Local: false, } for _, opt := range opts { @@ -94,3 +102,24 @@ func (unixfsOpts) Layout(layout Layout) UnixfsAddOption { return nil } } + +func (unixfsOpts) Pin(pin bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Pin = pin + return nil + } +} + +func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.OnlyHash = hashOnly + return nil + } +} + +func (unixfsOpts) Local(local bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Local = local + return nil + } +} From 7546c9386701ca6931a8bc0ac3fb202cace91015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Sep 2018 23:15:07 +0200 Subject: [PATCH 108/286] coreapi unixfs: cleanup options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@e62f26507f22f00426172384461c53c7d14b702f This commit was moved from ipfs/boxo@c3289a5e7d437768d5f1ea158a9e093034097c17 --- core/coreiface/options/unixfs.go | 41 +++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 6012ce77b23..6abfd9622ab 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -1,7 +1,12 @@ package options import ( + "errors" + "fmt" + + cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" + dag "gx/ipfs/QmcBoNcAP6qDjgRBew7yjvCqHq7p5jMstE44jPUBWBxzsV/go-merkledag" ) type Layout int @@ -29,7 +34,7 @@ type UnixfsAddSettings struct { type UnixfsAddOption func(*UnixfsAddSettings) error -func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) { +func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, error) { options := &UnixfsAddSettings{ CidVersion: -1, MhType: mh.SHA2_256, @@ -49,11 +54,41 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, error) { for _, opt := range opts { err := opt(options) if err != nil { - return nil, err + return nil, cid.Prefix{}, err + } + } + + // (hash != "sha2-256") -> CIDv1 + if options.MhType != mh.SHA2_256 { + switch options.CidVersion { + case 0: + return nil, cid.Prefix{}, errors.New("CIDv0 only supports sha2-256") + case 1, -1: + options.CidVersion = 1 + default: + return nil, cid.Prefix{}, fmt.Errorf("unknown CID version: %d", options.CidVersion) + } + } else { + if options.CidVersion < 0 { + // Default to CIDv0 + options.CidVersion = 0 } } - return options, nil + // cidV1 -> raw blocks (by default) + if options.CidVersion > 0 && !options.RawLeavesSet { + options.RawLeaves = true + } + + prefix, err := dag.PrefixForCidVersion(options.CidVersion) + if err != nil { + return nil, cid.Prefix{}, err + } + + prefix.MhType = options.MhType + prefix.MhLength = -1 + + return options, prefix, nil } type unixfsOpts struct{} From 8cea9f91e4aa09596b657d00b5d07e1d7b9c1151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Sep 2018 23:44:49 +0200 Subject: [PATCH 109/286] coreapi unixfs: docs on options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@eeb50d8e478fbaff90d4ef5a434834abfff408ad This commit was moved from ipfs/boxo@0039c7d460983de5c06f86459a0fb00b81ed0505 --- core/coreiface/options/unixfs.go | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 6abfd9622ab..9b003e1aff9 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -13,7 +13,7 @@ type Layout int const ( BalancedLayout Layout = iota - TrickleLeyout + TrickleLayout ) type UnixfsAddSettings struct { @@ -95,6 +95,8 @@ type unixfsOpts struct{} var Unixfs unixfsOpts +// CidVersion specifies which CID version to use. Defaults to 0 unless an option +// that depends on CIDv1 is passed. func (unixfsOpts) CidVersion(version int) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.CidVersion = version @@ -102,6 +104,9 @@ func (unixfsOpts) CidVersion(version int) UnixfsAddOption { } } +// Hash function to use. Implies CIDv1 if not set to sha2-256 (default). +// +// Table of functions is declared in https://github.com/multiformats/go-multihash/blob/master/multihash.go func (unixfsOpts) Hash(mhtype uint64) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.MhType = mhtype @@ -109,6 +114,8 @@ func (unixfsOpts) Hash(mhtype uint64) UnixfsAddOption { } } +// RawLeaves specifies whether to use raw blocks for leaves (data nodes with no +// links) instead of wrapping them with unixfs structures. func (unixfsOpts) RawLeaves(enable bool) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.RawLeaves = enable @@ -117,6 +124,11 @@ func (unixfsOpts) RawLeaves(enable bool) UnixfsAddOption { } } +// InlineLimit sets the amount of bytes below which blocks will be encoded +// directly into CID instead of being stored and addressed by it's hash +// +// Note that while there is no hard limit on the number of bytes here, it should +// be kept at something reasonably low like 32b (default for 'ipfs add') func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.InlineLimit = limit @@ -124,6 +136,11 @@ func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption { } } +// Chunker specifies settings for the chunking algorithm to use. +// +// Default: size-262144, formats: +// size-[bytes] - Simple chunker splitting data into blocks of n bytes +// rabin-[min]-[avg]-[max] - Rabin chunker func (unixfsOpts) Chunker(chunker string) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.Chunker = chunker @@ -131,6 +148,10 @@ func (unixfsOpts) Chunker(chunker string) UnixfsAddOption { } } +// Layout tells the adder how to balance data between leaves. +// options.BalancedLayout is the default, it's optimized for static seekable +// files. +// options.TrickleLayout is optimized for streaming data, func (unixfsOpts) Layout(layout Layout) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.Layout = layout @@ -138,6 +159,7 @@ func (unixfsOpts) Layout(layout Layout) UnixfsAddOption { } } +// Pin tells the adder to pin the file root recursively after adding func (unixfsOpts) Pin(pin bool) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.Pin = pin @@ -145,6 +167,8 @@ func (unixfsOpts) Pin(pin bool) UnixfsAddOption { } } +// HashOnly will make the adder calculate data hash without storing it in the +// blockstore or announcing it to the network func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.OnlyHash = hashOnly @@ -152,6 +176,9 @@ func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption { } } +// Local will add the data to blockstore without announcing it to the network +// +// Note that this doesn't prevent other nodes from getting this data func (unixfsOpts) Local(local bool) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.Local = local From 33bb77072255f75e8a5a777069b9425a9f81e315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 2 Oct 2018 09:42:50 +0200 Subject: [PATCH 110/286] coreapi unixfs: separate option to enable inlining MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@88ca0a07599ddd51c3db3864b99c1da87bf87eee This commit was moved from ipfs/boxo@80a937abb79a84f303465f05d86b206e1e90ff75 --- core/coreiface/options/unixfs.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 9b003e1aff9..df6f4fc7112 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -20,6 +20,7 @@ type UnixfsAddSettings struct { CidVersion int MhType uint64 + Inline bool InlineLimit int RawLeaves bool RawLeavesSet bool @@ -39,7 +40,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, CidVersion: -1, MhType: mh.SHA2_256, - InlineLimit: 0, + Inline: false, + InlineLimit: 32, RawLeaves: false, RawLeavesSet: false, @@ -124,11 +126,26 @@ func (unixfsOpts) RawLeaves(enable bool) UnixfsAddOption { } } +// Inline tells the adder to inline small blocks into CIDs +func (unixfsOpts) Inline(enable bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Inline = enable + return nil + } +} + // InlineLimit sets the amount of bytes below which blocks will be encoded -// directly into CID instead of being stored and addressed by it's hash +// directly into CID instead of being stored and addressed by it's hash. +// Specifying this option won't enable block inlining. For that use `Inline` +// option. Default: 32 bytes +// +// Note that while there is no hard limit on the number of bytes, it should +// be kept at a reasonably low value, like 64 bytes if you intend to display +// these hashes. Larger values like 256 bytes will work fine, but may affect +// de-duplication of smaller blocks. // -// Note that while there is no hard limit on the number of bytes here, it should -// be kept at something reasonably low like 32b (default for 'ipfs add') +// Setting this value too high may cause various problems, such as render some +// blocks unfetchable func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.InlineLimit = limit From d3bbffb3878a9fff3317ec4d439cb636dac9a153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 3 Oct 2018 15:05:46 +0200 Subject: [PATCH 111/286] coreapi unixfs: multi file support in unixfs coreapi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@9a760d89b5db34fa0fb7be8c71876e2f18dd8fa2 This commit was moved from ipfs/boxo@e50aac4cc71c5272b5a53994e958198286a585bc --- core/coreiface/unixfs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index acc3b960ce3..92168503eca 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -2,10 +2,10 @@ package iface import ( "context" - "io" options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + files "gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit/files" ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) @@ -13,7 +13,7 @@ import ( // NOTE: This API is heavily WIP, things are guaranteed to break frequently type UnixfsAPI interface { // Add imports the data from the reader into merkledag file - Add(context.Context, io.ReadCloser, ...options.UnixfsAddOption) (ResolvedPath, error) + Add(context.Context, files.File, ...options.UnixfsAddOption) (ResolvedPath, error) // Cat returns a reader for the file Cat(context.Context, Path) (Reader, error) From a7b89529611d0071f0be88d45c64aac557f95668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 3 Oct 2018 17:21:07 +0200 Subject: [PATCH 112/286] coreapi unixfs: unixfs.Get MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@7b2fdc90ee0528d4c0a437d95b1cb0d10c3e8aa5 This commit was moved from ipfs/boxo@15a4331a185c812bab3e229758bcfc79d682ac5d --- core/coreiface/unixfs.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 92168503eca..69e73182261 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -13,8 +13,16 @@ import ( // NOTE: This API is heavily WIP, things are guaranteed to break frequently type UnixfsAPI interface { // Add imports the data from the reader into merkledag file + // + // TODO: a long useful comment on how to use this for many different scenarios Add(context.Context, files.File, ...options.UnixfsAddOption) (ResolvedPath, error) + // Get returns a read-only handle to a file tree referenced by a path + // + // Note that some implementations of this API may apply the specified context + // to operations performed on the returned file + Get(context.Context, Path) (files.File, error) + // Cat returns a reader for the file Cat(context.Context, Path) (Reader, error) From ee45dafe78299ac3356a3a49b4ff63cac4c3530d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 3 Oct 2018 22:30:45 +0200 Subject: [PATCH 113/286] coreapi unixfs: wrap option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@b977abfc696b22775fa68736c144760113b27af4 This commit was moved from ipfs/boxo@59fd418b398d9011c79167b82af869751acf2640 --- core/coreiface/options/unixfs.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index df6f4fc7112..abbea968193 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -31,6 +31,8 @@ type UnixfsAddSettings struct { Pin bool OnlyHash bool Local bool + + Wrap bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -51,6 +53,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, Pin: false, OnlyHash: false, Local: false, + + Wrap: false, } for _, opt := range opts { @@ -202,3 +206,12 @@ func (unixfsOpts) Local(local bool) UnixfsAddOption { return nil } } + +// Wrap tells the adder to wrap the added file structure with an additional +// directory. +func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Wrap = wrap + return nil + } +} From f10ca5c904954029737728199d48ba9346e614e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 3 Oct 2018 22:49:42 +0200 Subject: [PATCH 114/286] coreapi unixfs: hidden opiton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@cb84af4b44e4660029e87a1c82a3d2ab35acb2cd This commit was moved from ipfs/boxo@1019fcea4b88f3a45cf81429f81066db1918771f --- core/coreiface/options/unixfs.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index abbea968193..7d7af5b818e 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -32,7 +32,8 @@ type UnixfsAddSettings struct { OnlyHash bool Local bool - Wrap bool + Wrap bool + Hidden bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -54,7 +55,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, OnlyHash: false, Local: false, - Wrap: false, + Wrap: false, + Hidden: false, } for _, opt := range opts { @@ -215,3 +217,11 @@ func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption { return nil } } + +// Hidden enables adding of hidden files (files prefixed with '.') +func (unixfsOpts) Hidden(hidden bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Hidden = hidden + return nil + } +} From 48761861ca82c2744d0c33d7bd41ef8f94abdb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 3 Oct 2018 23:17:18 +0200 Subject: [PATCH 115/286] coreapi unixfs: stdin-name option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@aa7a877686c76f0767fa6fb618972b25f1545bb6 This commit was moved from ipfs/boxo@907d2f239738971d246b9ff9ce5add004adad2c7 --- core/coreiface/options/unixfs.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 7d7af5b818e..90ad53e9ea3 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -32,8 +32,9 @@ type UnixfsAddSettings struct { OnlyHash bool Local bool - Wrap bool - Hidden bool + Wrap bool + Hidden bool + StdinName string } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -55,8 +56,9 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, OnlyHash: false, Local: false, - Wrap: false, - Hidden: false, + Wrap: false, + Hidden: false, + StdinName: "", } for _, opt := range opts { @@ -225,3 +227,12 @@ func (unixfsOpts) Hidden(hidden bool) UnixfsAddOption { return nil } } + +// StdinName is the name set for files which don specify FilePath as +// os.Stdin.Name() +func (unixfsOpts) StdinName(name string) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.StdinName = name + return nil + } +} From be5cccd21ac577b26638e777d189a9f27df79058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Oct 2018 01:00:26 +0200 Subject: [PATCH 116/286] coreapi unixfs: progress events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@df1797113e1dc062a9e53af11b8ea4268c855ef9 This commit was moved from ipfs/boxo@56ef5340a321a06604f4f98efcba4da03b6a4358 --- core/coreiface/options/unixfs.go | 35 ++++++++++++++++++++++++++++++++ core/coreiface/unixfs.go | 9 ++++++++ 2 files changed, 44 insertions(+) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 90ad53e9ea3..da99b42f662 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -35,6 +35,10 @@ type UnixfsAddSettings struct { Wrap bool Hidden bool StdinName string + + Events chan<- interface{} + Silent bool + Progress bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -59,6 +63,10 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, Wrap: false, Hidden: false, StdinName: "", + + Events: nil, + Silent: false, + Progress: false, } for _, opt := range opts { @@ -236,3 +244,30 @@ func (unixfsOpts) StdinName(name string) UnixfsAddOption { return nil } } + +// Events specifies channel which will be used to report events about ongoing +// Add operation. +// +// Note that if this channel blocks it may slowdown the adder +func (unixfsOpts) Events(sink chan<- interface{}) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Events = sink + return nil + } +} + +// Silent reduces event output +func (unixfsOpts) Silent(silent bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Silent = silent + return nil + } +} + +// Progress tells the adder whether to enable progress events +func (unixfsOpts) Progress(enable bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.Progress = enable + return nil + } +} diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 69e73182261..c622e210e58 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -9,6 +9,14 @@ import ( ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) +// TODO: ideas on making this more coreapi-ish without breaking the http API? +type AddEvent struct { + Name string + Hash string `json:",omitempty"` + Bytes int64 `json:",omitempty"` + Size string `json:",omitempty"` +} + // UnixfsAPI is the basic interface to immutable files in IPFS // NOTE: This API is heavily WIP, things are guaranteed to break frequently type UnixfsAPI interface { @@ -24,6 +32,7 @@ type UnixfsAPI interface { Get(context.Context, Path) (files.File, error) // Cat returns a reader for the file + // TODO: Remove in favour of Get (if we use Get on a file we still have reader directly, so..) Cat(context.Context, Path) (Reader, error) // Ls returns the list of links in a directory From dfb14f3974d44b6dd1670233c57d24552b9fbd83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Oct 2018 01:24:57 +0200 Subject: [PATCH 117/286] coreapi unixfs: filestore opts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@97fb3e4d819ee3ee511a719da6d1bef4695a2dad This commit was moved from ipfs/boxo@90e8604702cde52200882080a6a8b5b3e0818d13 --- core/coreiface/options/unixfs.go | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index da99b42f662..810e3c6e841 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -31,6 +31,8 @@ type UnixfsAddSettings struct { Pin bool OnlyHash bool Local bool + FsCache bool + NoCopy bool Wrap bool Hidden bool @@ -59,6 +61,8 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, Pin: false, OnlyHash: false, Local: false, + FsCache: false, + NoCopy: false, Wrap: false, Hidden: false, @@ -76,6 +80,17 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, } } + // nocopy -> rawblocks + if options.NoCopy && !options.RawLeaves { + // fixed? + if options.RawLeavesSet { + return nil, cid.Prefix{}, fmt.Errorf("nocopy option requires '--raw-leaves' to be enabled as well") + } + + // No, satisfy mandatory constraint. + options.RawLeaves = true + } + // (hash != "sha2-256") -> CIDv1 if options.MhType != mh.SHA2_256 { switch options.CidVersion { @@ -271,3 +286,23 @@ func (unixfsOpts) Progress(enable bool) UnixfsAddOption { return nil } } + +// FsCache tells the adder to check the filestore for pre-existing blocks +// +// Experimental +func (unixfsOpts) FsCache(enable bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.FsCache = enable + return nil + } +} + +// NoCopy tells the adder to add the files using filestore. Implies RawLeaves. +// +// Experimental +func (unixfsOpts) Nocopy(enable bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.NoCopy = enable + return nil + } +} From e59b75ae4394525d2902dfb8bffc89214ef5e759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Oct 2018 20:39:43 +0200 Subject: [PATCH 118/286] coreapi unixfs: fix inline doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@641542e1596817f70eeac14f87b3c49ef2d5e80a This commit was moved from ipfs/boxo@f46082072957d0f4634a70baec4f0ef573c89408 --- core/coreiface/options/unixfs.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 810e3c6e841..9249af89539 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -170,13 +170,10 @@ func (unixfsOpts) Inline(enable bool) UnixfsAddOption { // Specifying this option won't enable block inlining. For that use `Inline` // option. Default: 32 bytes // -// Note that while there is no hard limit on the number of bytes, it should -// be kept at a reasonably low value, like 64 bytes if you intend to display -// these hashes. Larger values like 256 bytes will work fine, but may affect -// de-duplication of smaller blocks. -// -// Setting this value too high may cause various problems, such as render some -// blocks unfetchable +// Note that while there is no hard limit on the number of bytes, it should be +// kept at a reasonably low value, such as 64 and no more than 1k. Setting this +// value too high may cause various problems, such as render some +// blocks unfetchable. func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.InlineLimit = limit From 4c5803a3f45eb4c1ae769b0ffe0b4fc2f4300404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Oct 2018 22:11:17 +0200 Subject: [PATCH 119/286] coreapi name: add some missing options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@0ad4722d65f9b8a3021320835291d2161091fd63 This commit was moved from ipfs/boxo@34497dfcf9b4083f51925ee9e7b9ccd14c8f69ce --- core/coreiface/options/name.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index ba3691b03cd..c614db3abc3 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -13,6 +13,10 @@ const ( type NamePublishSettings struct { ValidTime time.Duration Key string + + TTL *time.Duration + + AllowOffline bool } type NameResolveSettings struct { @@ -29,6 +33,8 @@ func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) options := &NamePublishSettings{ ValidTime: DefaultNameValidTime, Key: "self", + + AllowOffline: false, } for _, opt := range opts { @@ -82,6 +88,24 @@ func (nameOpts) Key(key string) NamePublishOption { } } +// AllowOffline is an option for Name.Publish which specifies whether to allow +// publishing when the node is offline. Default value is false +func (nameOpts) AllowOffline(allow bool) NamePublishOption { + return func(settings *NamePublishSettings) error { + settings.AllowOffline = allow + return nil + } +} + +// TTL is an option for Name.Publish which specifies the time duration the +// published record should be cached for (caution: experimental). +func (nameOpts) TTL(ttl time.Duration) NamePublishOption { + return func(settings *NamePublishSettings) error { + settings.TTL = &ttl + return nil + } +} + // Local is an option for Name.Resolve which specifies if the lookup should be // offline. Default value is false func (nameOpts) Local(local bool) NameResolveOption { From db11d51180922f44d45cf15f274e7617d17cec12 Mon Sep 17 00:00:00 2001 From: Lars Gierth Date: Wed, 3 Oct 2018 07:35:57 +0200 Subject: [PATCH 120/286] gx: update go-datastore, go-libp2p-swarm License: MIT Signed-off-by: Lars Gierth This commit was moved from ipfs/interface-go-ipfs-core@b9309ab1a51ec1b68e8c5561b0f02a610fd93f97 This commit was moved from ipfs/boxo@b00a9c91219246fb5cb954b1a50578eeb009dcae --- core/coreiface/dht.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/swarm.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 2309ceb905b..4a76f4d3927 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + pstore "gx/ipfs/QmSJ36wcYQyEViJUWUEhJU81tw1KdakTKqLLHbvYbA9zDv/go-libp2p-peerstore" peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" - pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 0beab066395..0f06e8cc23e 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmcjwUb36Z16NJkvDX6ccXPqsFswo6AsRXynyXcLLCphV2/go-path" + ipfspath "gx/ipfs/QmbE9gr6c2FomTgc2pRZRTooHpchJ1uaZKremypyWJMV4t/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 8b464e5c1f0..58caf6759fe 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,11 +5,11 @@ import ( "errors" "time" + net "gx/ipfs/QmQdLcvoy3JuSqhV6iwQ9T6Cv7hWLAdzob4jUZRPqFL67Z/go-libp2p-net" + pstore "gx/ipfs/QmSJ36wcYQyEViJUWUEhJU81tw1KdakTKqLLHbvYbA9zDv/go-libp2p-peerstore" ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" - pstore "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore" - net "gx/ipfs/QmfDPh144WGBqRxZb1TGDHerbMnZATrHZggAPw7putNnBq/go-libp2p-net" ) var ( From cd6d30548a305d5a32118c7dae7286c521fbbfa0 Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Thu, 4 Oct 2018 19:11:27 -0400 Subject: [PATCH 121/286] gx update go-libp2p-peerstore License: MIT Signed-off-by: Kevin Atkinson This commit was moved from ipfs/interface-go-ipfs-core@c8a6219cf25b4dfc1208523ec0bb2ee2efc2d85d This commit was moved from ipfs/boxo@0ef081eae1b8bdaf52870fe9f483ba05c7ca69ef --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 0f06e8cc23e..5748bf4653a 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmbE9gr6c2FomTgc2pRZRTooHpchJ1uaZKremypyWJMV4t/go-path" + ipfspath "gx/ipfs/QmYh33CFYYEgQNSZ9PEP7ZN57dhErRZ7NfLS1BUA9GBBRk/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 59de96e6341ed97ed94bcebe098df14182fd289e Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Thu, 4 Oct 2018 19:32:33 -0400 Subject: [PATCH 122/286] gx update libp2p/go-buffer-pool License: MIT Signed-off-by: Kevin Atkinson This commit was moved from ipfs/interface-go-ipfs-core@349cbd1463198c9a811b6cc3c09c44608cdd486d This commit was moved from ipfs/boxo@3f8596df8b398139db13cb06f2c55c6738fc6528 --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 5748bf4653a..63b15fb501d 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmYh33CFYYEgQNSZ9PEP7ZN57dhErRZ7NfLS1BUA9GBBRk/go-path" + ipfspath "gx/ipfs/QmV4QxScV9Y7LbaWhHazFfRd8uyeUd4pAH8a7fFFbi5odJ/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 1aa388cb87a449376a0d003ca44fbdced70af394 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 4 Oct 2018 21:12:53 -0700 Subject: [PATCH 123/286] update unixfs inline option comment to give us room to change things (addressing CR) License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@7d577641499b51b4d98ae7e10fed2fd5bf9d516a This commit was moved from ipfs/boxo@b06611e7da0ebaef24e0b3db614716c940882793 --- core/coreiface/options/unixfs.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 9249af89539..d486981c3a6 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -171,9 +171,8 @@ func (unixfsOpts) Inline(enable bool) UnixfsAddOption { // option. Default: 32 bytes // // Note that while there is no hard limit on the number of bytes, it should be -// kept at a reasonably low value, such as 64 and no more than 1k. Setting this -// value too high may cause various problems, such as render some -// blocks unfetchable. +// kept at a reasonably low value, such as 64; implementations may choose to +// reject anything larger. func (unixfsOpts) InlineLimit(limit int) UnixfsAddOption { return func(settings *UnixfsAddSettings) error { settings.InlineLimit = limit From f9a93470069c116015b79f33f105275896f9917a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 19:23:38 +0100 Subject: [PATCH 124/286] coreapi: pubsub interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@ccaec46f3deaf46e20f9c265d5920f68251e4da4 This commit was moved from ipfs/boxo@f06c01e06b04ec7a27b0738f984e0f30b005c711 --- core/coreiface/options/pubsub.go | 56 ++++++++++++++++++++++++++++++++ core/coreiface/pubsub.go | 51 +++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 core/coreiface/options/pubsub.go create mode 100644 core/coreiface/pubsub.go diff --git a/core/coreiface/options/pubsub.go b/core/coreiface/options/pubsub.go new file mode 100644 index 00000000000..e276d7e4a19 --- /dev/null +++ b/core/coreiface/options/pubsub.go @@ -0,0 +1,56 @@ +package options + +type PubSubPeersSettings struct { + Topic string +} + +type PubSubSubscribeSettings struct { + Discover bool +} + +type PubSubPeersOption func(*PubSubPeersSettings) error +type PubSubSubscribeOption func(*PubSubSubscribeSettings) error + +func PubSubPeersOptions(opts ...PubSubPeersOption) (*PubSubPeersSettings, error) { + options := &PubSubPeersSettings{ + Topic: "", + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +func PubSubSubscribeOptions(opts ...PubSubSubscribeOption) (*PubSubSubscribeSettings, error) { + options := &PubSubSubscribeSettings{ + Discover: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +type PubSubOptions struct{} + +func (api *PubSubOptions) WithTopic(topic string) PubSubPeersOption { + return func(settings *PubSubPeersSettings) error { + settings.Topic = topic + return nil + } +} + +func (api *PubSubOptions) WithDiscover(discover bool) PubSubSubscribeOption { + return func(settings *PubSubSubscribeSettings) error { + settings.Discover = discover + return nil + } +} diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go new file mode 100644 index 00000000000..f78734a090e --- /dev/null +++ b/core/coreiface/pubsub.go @@ -0,0 +1,51 @@ +package iface + +import ( + "context" + "io" + + options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + + peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" +) + +// PubSubSubscription is an active PubSub subscription +type PubSubSubscription interface { + io.Closer + + // Chan return incoming message channel + Chan(context.Context) <-chan PubSubMessage +} + +// PubSubMessage is a single PubSub message +type PubSubMessage interface { + // From returns id of a peer from which the message has arrived + From() peer.ID + + // Data returns the message body + Data() []byte +} + +// PubSubAPI specifies the interface to PubSub +type PubSubAPI interface { + // Ls lists subscribed topics by name + Ls(context.Context) ([]string, error) + + // Peers list peers we are currently pubsubbing with + // TODO: WithTopic + Peers(context.Context, ...options.PubSubPeersOption) ([]peer.ID, error) + + // WithTopic is an option for peers which specifies a topic filter for the + // function + WithTopic(topic string) options.PubSubPeersOption + + // Publish a message to a given pubsub topic + Publish(context.Context, string, []byte) error + + // Subscribe to messages on a given topic + Subscribe(context.Context, string) (PubSubSubscription, error) + + // WithDiscover is an option for Subscribe which specifies whether to try to + // discover other peers subscribed to the same topic + WithDiscover(discover bool) options.PubSubSubscribeOption +} From 729bb03d1b244e9ec7e27a28fa347ec79c15ae0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 10 Mar 2018 19:28:22 +0100 Subject: [PATCH 125/286] coreapi: implement pubsub api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@0d0069ff23a4dd26fa62fd91e5875b2526742da5 This commit was moved from ipfs/boxo@1b8732304c12b825e9a8fd69b51494c9c67f39d0 --- core/coreiface/coreapi.go | 3 +++ core/coreiface/errors.go | 2 +- core/coreiface/options/pubsub.go | 8 +++++--- core/coreiface/pubsub.go | 16 ++++------------ 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 0b153b6f9a1..bc889237b3e 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -37,6 +37,9 @@ type CoreAPI interface { // Swarm returns an implementation of Swarm API Swarm() SwarmAPI + // PubSub returns an implementation of PubSub API + PubSub() PubSubAPI + // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, Path) (ResolvedPath, error) diff --git a/core/coreiface/errors.go b/core/coreiface/errors.go index 81f978971d7..072275409e0 100644 --- a/core/coreiface/errors.go +++ b/core/coreiface/errors.go @@ -4,5 +4,5 @@ import "errors" var ( ErrIsDir = errors.New("object is a directory") - ErrOffline = errors.New("can't resolve, ipfs node is offline") + ErrOffline = errors.New("this action must be run in online mode, try running 'ipfs daemon' first") ) diff --git a/core/coreiface/options/pubsub.go b/core/coreiface/options/pubsub.go index e276d7e4a19..f0a614d5802 100644 --- a/core/coreiface/options/pubsub.go +++ b/core/coreiface/options/pubsub.go @@ -39,16 +39,18 @@ func PubSubSubscribeOptions(opts ...PubSubSubscribeOption) (*PubSubSubscribeSett return options, nil } -type PubSubOptions struct{} +type pubsubOpts struct{} -func (api *PubSubOptions) WithTopic(topic string) PubSubPeersOption { +var PubBub nameOpts + +func (pubsubOpts) Topic(topic string) PubSubPeersOption { return func(settings *PubSubPeersSettings) error { settings.Topic = topic return nil } } -func (api *PubSubOptions) WithDiscover(discover bool) PubSubSubscribeOption { +func (pubsubOpts) Discover(discover bool) PubSubSubscribeOption { return func(settings *PubSubSubscribeSettings) error { settings.Discover = discover return nil diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index f78734a090e..4b52ed6d644 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -6,15 +6,15 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" + peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" ) // PubSubSubscription is an active PubSub subscription type PubSubSubscription interface { io.Closer - // Chan return incoming message channel - Chan(context.Context) <-chan PubSubMessage + // Next return the next incoming message + Next(context.Context) (PubSubMessage, error) } // PubSubMessage is a single PubSub message @@ -35,17 +35,9 @@ type PubSubAPI interface { // TODO: WithTopic Peers(context.Context, ...options.PubSubPeersOption) ([]peer.ID, error) - // WithTopic is an option for peers which specifies a topic filter for the - // function - WithTopic(topic string) options.PubSubPeersOption - // Publish a message to a given pubsub topic Publish(context.Context, string, []byte) error // Subscribe to messages on a given topic - Subscribe(context.Context, string) (PubSubSubscription, error) - - // WithDiscover is an option for Subscribe which specifies whether to try to - // discover other peers subscribed to the same topic - WithDiscover(discover bool) options.PubSubSubscribeOption + Subscribe(context.Context, string, ...options.PubSubSubscribeOption) (PubSubSubscription, error) } From 3f6b34dd1a4845caa7c781d07328d58e9beabbe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 11 Sep 2018 05:43:54 +0200 Subject: [PATCH 126/286] coreapi pubsub: add tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@3f9a6ce3446d2d5746c6d9976c9325f1673c8e99 This commit was moved from ipfs/boxo@d23f749f57daa3b22c91036530b9430bfebec610 --- core/coreiface/options/pubsub.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/options/pubsub.go b/core/coreiface/options/pubsub.go index f0a614d5802..c387d613db4 100644 --- a/core/coreiface/options/pubsub.go +++ b/core/coreiface/options/pubsub.go @@ -41,7 +41,7 @@ func PubSubSubscribeOptions(opts ...PubSubSubscribeOption) (*PubSubSubscribeSett type pubsubOpts struct{} -var PubBub nameOpts +var PubSub pubsubOpts func (pubsubOpts) Topic(topic string) PubSubPeersOption { return func(settings *PubSubPeersSettings) error { From d5d6e5c13bd0db3b26c5c06a050eda92dc6c1437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 11 Sep 2018 12:52:40 +0200 Subject: [PATCH 127/286] pubsub cmd: switch to coreapi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@706e552037bd75687b5ff0cedb9802bc7f2d4617 This commit was moved from ipfs/boxo@add2ae0705df01044239e9ed5691974847332408 --- core/coreiface/pubsub.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index 4b52ed6d644..4c9a1d73e5b 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - peer "gx/ipfs/QmQsErDt8Qgw1XrsXf2BpEzDgGWtB1YLsTAARBup5b6B9W/go-libp2p-peer" + peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" ) // PubSubSubscription is an active PubSub subscription @@ -24,6 +24,12 @@ type PubSubMessage interface { // Data returns the message body Data() []byte + + // Seq returns message identifier + Seq() []byte + + // Topics returns list of topics this message was set to + Topics() []string } // PubSubAPI specifies the interface to PubSub From 57fdb89f375e9a589d52e765d658b385ac28508b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 26 Sep 2018 18:24:35 +0200 Subject: [PATCH 128/286] coreapi pubsub: fix review nits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@162e182a2c2f67c227b7dd4b3d661d3b15ca1d7b This commit was moved from ipfs/boxo@0373c3c9aee429624a99c6a1c080027923ec6e6f --- core/coreiface/pubsub.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index 4c9a1d73e5b..d7a21e02f1a 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -38,7 +38,6 @@ type PubSubAPI interface { Ls(context.Context) ([]string, error) // Peers list peers we are currently pubsubbing with - // TODO: WithTopic Peers(context.Context, ...options.PubSubPeersOption) ([]peer.ID, error) // Publish a message to a given pubsub topic From fae14756dcdbd3b313f0dd3e861db5cbb676bdab Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 5 Oct 2018 14:11:56 -0700 Subject: [PATCH 129/286] gx: update stuff * go-datastore and friends: GetSize * badger: new release, fewer allocations * go-mplex: send fewer packets * go-bitswap: pack multiple blocks in a single message, fewer allocations * go-buffer-pool: replace the buffer pool from go-msgio * yamux: fixed data race and uses go-buffer-pool for stream read-buffers to reduce memory and allocations. * go-libp2p-secio: get rid of a hot-spot allocation * go-libp2p-peerstore: reduced allocations (at the cost of some memory) More? License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@144aa5240ff7e379b34dd0e1adf9f8c1e991b3cc This commit was moved from ipfs/boxo@b77e7021ee4b2093d2e2a98f5274ace254a537e1 --- core/coreiface/dht.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/swarm.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 4a76f4d3927..3096c8fb7e0 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - pstore "gx/ipfs/QmSJ36wcYQyEViJUWUEhJU81tw1KdakTKqLLHbvYbA9zDv/go-libp2p-peerstore" + pstore "gx/ipfs/QmXEyLwySuDMXejWBu8XwdkX2WuGKk8x9jFwz8js7j72UX/go-libp2p-peerstore" peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" ) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 6a54b2d399d..b4661b793f4 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -6,7 +6,7 @@ import ( cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmTGpm48qm4fUZ9E5hMXy4ZngJUYCMKu15rTMVR3BSEnPm/go-merkledag" + dag "gx/ipfs/QmXTw4By9FMZAt7qJm4JoJuNBrBgqMMzkS4AjKc4zqTUVd/go-merkledag" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 63b15fb501d..9bb46b4b47d 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmV4QxScV9Y7LbaWhHazFfRd8uyeUd4pAH8a7fFFbi5odJ/go-path" + ipfspath "gx/ipfs/QmQmMu1vsgsjxyB8tzrA6ZTCTCLDLVaXMb4Q57r2v886Sx/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 58caf6759fe..d8bca395c3e 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,8 +5,8 @@ import ( "errors" "time" - net "gx/ipfs/QmQdLcvoy3JuSqhV6iwQ9T6Cv7hWLAdzob4jUZRPqFL67Z/go-libp2p-net" - pstore "gx/ipfs/QmSJ36wcYQyEViJUWUEhJU81tw1KdakTKqLLHbvYbA9zDv/go-libp2p-peerstore" + net "gx/ipfs/QmWUPYHpNv4YahaBYXovuEJttgfqcNcN9Gg4arhQYcRoqa/go-libp2p-net" + pstore "gx/ipfs/QmXEyLwySuDMXejWBu8XwdkX2WuGKk8x9jFwz8js7j72UX/go-libp2p-peerstore" ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" From d54cf20f798baecd7ece7707ce5c14c0f54b2196 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 10 Oct 2018 14:06:57 +0100 Subject: [PATCH 130/286] gx: update go-buffer-pool Turns out that `pool.Put(buf)` had to *allocate* because we needed to turn `[]byte` into `interface{}`. Apparently, we've never done this correctly we just never noticed because we never really used buffer pools extensively. However, since migrating yamux to a buffer-pool backed buffer, this started showing up in allocation profiles. License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@54fd5775db59e6c0113851fb7556dd09adac4215 This commit was moved from ipfs/boxo@2bda31a93a5070433a41cff4799c0012f4d69460 --- core/coreiface/dht.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/swarm.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 3096c8fb7e0..cb3362bb969 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - pstore "gx/ipfs/QmXEyLwySuDMXejWBu8XwdkX2WuGKk8x9jFwz8js7j72UX/go-libp2p-peerstore" + pstore "gx/ipfs/QmWtCpWB39Rzc2xTB75MKorsxNpo3TyecTEN24CJ3KVohE/go-libp2p-peerstore" peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" ) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index b4661b793f4..aaed6024edf 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -6,7 +6,7 @@ import ( cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmXTw4By9FMZAt7qJm4JoJuNBrBgqMMzkS4AjKc4zqTUVd/go-merkledag" + dag "gx/ipfs/QmTpyXP1bsqJvyW5VcNmALPCb47VPJFy2T8icGASNy4ML1/go-merkledag" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 9bb46b4b47d..a11a4632462 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmQmMu1vsgsjxyB8tzrA6ZTCTCLDLVaXMb4Q57r2v886Sx/go-path" + ipfspath "gx/ipfs/QmTy6VoHV2E5baEFDXbp1xmHhxSVff5qTSrTsoXxD1eB2P/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index d8bca395c3e..ba1a556981a 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,8 +5,8 @@ import ( "errors" "time" - net "gx/ipfs/QmWUPYHpNv4YahaBYXovuEJttgfqcNcN9Gg4arhQYcRoqa/go-libp2p-net" - pstore "gx/ipfs/QmXEyLwySuDMXejWBu8XwdkX2WuGKk8x9jFwz8js7j72UX/go-libp2p-peerstore" + net "gx/ipfs/QmSTaEYUgDe1r581hxyd2u9582Hgp3KX4wGwYbRqz2u9Qh/go-libp2p-net" + pstore "gx/ipfs/QmWtCpWB39Rzc2xTB75MKorsxNpo3TyecTEN24CJ3KVohE/go-libp2p-peerstore" ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" From b3ad18600c88c12fb6fc247ec8aa7acb20e1e0bf Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 12 Oct 2018 16:15:40 +0100 Subject: [PATCH 131/286] gx: update yamux and refmt * yamux: fix memory leak. * refmt: obey the "empty" tag. License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@cb4d2fb72ce804cc5c277ac8d6b1b10a63943072 This commit was moved from ipfs/boxo@f3066c9cd309e9af638a8c03d9967776254d5d65 --- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index aaed6024edf..307d618deaa 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -6,7 +6,7 @@ import ( cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmTpyXP1bsqJvyW5VcNmALPCb47VPJFy2T8icGASNy4ML1/go-merkledag" + dag "gx/ipfs/QmVvNkTCx8V9Zei8xuTYTBdUXmbnDRS4iNuw1SztYyhQwQ/go-merkledag" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index a11a4632462..d90f04aa124 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmTy6VoHV2E5baEFDXbp1xmHhxSVff5qTSrTsoXxD1eB2P/go-path" + ipfspath "gx/ipfs/QmdrpbDgeYH3VxkCciQCJY5LkDYdXtig6unDzQmMxFtWEw/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 45b9ac582df7c77466cb7cb0464dede2554c1e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 16 Oct 2018 11:41:00 +0200 Subject: [PATCH 132/286] namesys: review fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@f660979841b69c6f91ff258b2eb90695dae98e75 This commit was moved from ipfs/boxo@6aaeb7276d4aa93de22390a6abf730231d75bbf3 --- core/coreiface/name.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/coreiface/name.go b/core/coreiface/name.go index 14127ac27b3..782f6835150 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -2,7 +2,6 @@ package iface import ( "context" - "errors" options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" From cfb18be463a1be895ec794d1a0f57c8e256a2884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 16 Oct 2018 16:35:31 +0200 Subject: [PATCH 133/286] namesys: drop prefix args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@1308d71ad0a2b782fd9b7f481ffe7789b30b8a29 This commit was moved from ipfs/boxo@183798effb213f1913b8c3702a89b5a026077e7a --- core/coreiface/name.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/name.go b/core/coreiface/name.go index 782f6835150..a02bc078748 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -40,7 +40,7 @@ type NameAPI interface { // Search is a version of Resolve which outputs paths as they are discovered, // reducing the time to first entry // - // Note that by default only the last path returned before the channel closes - // can be considered 'safe'. + // Note: by default, all paths read from the channel are considered unsafe, + // except the latest (last path in channel read buffer). Search(ctx context.Context, name string, opts ...options.NameResolveOption) (<-chan IpnsResult, error) } From 9a680c8fe31e4ad43e7812f82bd257f5dc538c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 18 Oct 2018 10:16:31 +0200 Subject: [PATCH 134/286] gx: update to use extracted go-ipfs-files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@a945dc346666180846b543c15cf1a7cb3d25d7bd This commit was moved from ipfs/boxo@7af2ed03ee8171a3a4bf3d943fc50953f5390acd --- core/coreiface/unixfs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index c622e210e58..078d648bcae 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - files "gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit/files" + files "gx/ipfs/QmZMWMvWMVKCbHetJ4RgndbuEF1io2UpUxwQwtNjtYPzSC/go-ipfs-files" ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) From 278701f8d1c35e7b6541e739a98e639060e4a29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 9 Oct 2018 18:57:25 +0200 Subject: [PATCH 135/286] coreapi unixfs: remove Cat, use sessions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@26985dbeb71dc2999d2640c301cc88b2e1e56b72 This commit was moved from ipfs/boxo@83af9fbde0491d60155e511ad14d2e20068fd753 --- core/coreiface/unixfs.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 078d648bcae..4a6c956a0e5 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -31,10 +31,6 @@ type UnixfsAPI interface { // to operations performed on the returned file Get(context.Context, Path) (files.File, error) - // Cat returns a reader for the file - // TODO: Remove in favour of Get (if we use Get on a file we still have reader directly, so..) - Cat(context.Context, Path) (Reader, error) - // Ls returns the list of links in a directory Ls(context.Context, Path) ([]*ipld.Link, error) } From 7301aaa1201e6ecdff3d9ef82d66d957cc917d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 15 Oct 2018 12:45:49 +0200 Subject: [PATCH 136/286] coreapi unixfs: Return seeker from get MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@7fad9653969f1e71a85778e3e4e225c97d71558b This commit was moved from ipfs/boxo@8d4196176a99ab51bfd521afbd061bfcf456354f --- core/coreiface/unixfs.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 4a6c956a0e5..dd7e5a3926d 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -2,6 +2,7 @@ package iface import ( "context" + "io" options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" @@ -17,6 +18,11 @@ type AddEvent struct { Size string `json:",omitempty"` } +type UnixfsFile interface { + files.SizeFile + io.Seeker +} + // UnixfsAPI is the basic interface to immutable files in IPFS // NOTE: This API is heavily WIP, things are guaranteed to break frequently type UnixfsAPI interface { @@ -29,7 +35,7 @@ type UnixfsAPI interface { // // Note that some implementations of this API may apply the specified context // to operations performed on the returned file - Get(context.Context, Path) (files.File, error) + Get(context.Context, Path) (UnixfsFile, error) // Ls returns the list of links in a directory Ls(context.Context, Path) ([]*ipld.Link, error) From e6dbe550bc31a8f23aba03c561d6f847dee9ad31 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 24 Oct 2018 09:59:18 -0700 Subject: [PATCH 137/286] gx update License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@c9eb6014a863a96f762fd87274a63ff906da0c65 This commit was moved from ipfs/boxo@10afc1c6e7946a55faeacc943f1aa6802530796b --- core/coreiface/dht.go | 4 ++-- core/coreiface/key.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/pubsub.go | 2 +- core/coreiface/swarm.go | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index cb3362bb969..38a0f734881 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - pstore "gx/ipfs/QmWtCpWB39Rzc2xTB75MKorsxNpo3TyecTEN24CJ3KVohE/go-libp2p-peerstore" - peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" + peer "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer" + pstore "gx/ipfs/QmTTJcDL3gsnGDALjh2fDGg1onGRUdVgNL2hU2WEZcVrMX/go-libp2p-peerstore" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/key.go b/core/coreiface/key.go index cc6dc890044..9e7bfee2814 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" + "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 307d618deaa..8fe172fea0e 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -6,7 +6,7 @@ import ( cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmVvNkTCx8V9Zei8xuTYTBdUXmbnDRS4iNuw1SztYyhQwQ/go-merkledag" + dag "gx/ipfs/QmY5xpETYHq3PPvaJnafyLWKqk5y7cZnUeBqLRtLUpEV3s/go-merkledag" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index d90f04aa124..53938c3de10 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmdrpbDgeYH3VxkCciQCJY5LkDYdXtig6unDzQmMxFtWEw/go-path" + ipfspath "gx/ipfs/QmayGyPXjTt3cGzjCR3wb5HsHQX7LaJcWUbZemGDn6rKWq/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index d7a21e02f1a..b3f3f6b7628 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - peer "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" + peer "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer" ) // PubSubSubscription is an active PubSub subscription diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index ba1a556981a..d4b92c017d7 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,11 +5,11 @@ import ( "errors" "time" - net "gx/ipfs/QmSTaEYUgDe1r581hxyd2u9582Hgp3KX4wGwYbRqz2u9Qh/go-libp2p-net" - pstore "gx/ipfs/QmWtCpWB39Rzc2xTB75MKorsxNpo3TyecTEN24CJ3KVohE/go-libp2p-peerstore" - ma "gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr" + ma "gx/ipfs/QmT4U94DnD8FRfqr21obWY32HLM5VExccPKMjQHofeYqr9/go-multiaddr" + "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer" + pstore "gx/ipfs/QmTTJcDL3gsnGDALjh2fDGg1onGRUdVgNL2hU2WEZcVrMX/go-libp2p-peerstore" + net "gx/ipfs/QmXuRkCR7BNQa9uqfpTiFWsTQLzmTWYg91Ja1w95gnqb6u/go-libp2p-net" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" - "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer" ) var ( From 07161dee3ee30e4cbb13caa39737787662188eaa Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 24 Oct 2018 12:49:25 -0700 Subject: [PATCH 138/286] gx update go-libp2p License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@da1f68d4e43463145f44894cbb8cf5d5a992f8d3 This commit was moved from ipfs/boxo@8cdb97d783313ce8276610860ec005d66e395cb5 --- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 8fe172fea0e..4d179f9ffc1 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -6,7 +6,7 @@ import ( cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmY5xpETYHq3PPvaJnafyLWKqk5y7cZnUeBqLRtLUpEV3s/go-merkledag" + dag "gx/ipfs/QmcescwzzD86xrxoXNJ6VwSw46wLC91QzFDnozYRVf4KnX/go-merkledag" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 53938c3de10..44d53f23c4b 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmayGyPXjTt3cGzjCR3wb5HsHQX7LaJcWUbZemGDn6rKWq/go-path" + ipfspath "gx/ipfs/QmQ4sKWqHhSYekzST5RwT4VHdQB4df6JWLHNy7tuWTo8uY/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 213fdce4feca11e9d02d837e94e695010f5d770d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 24 Oct 2018 15:01:31 -0700 Subject: [PATCH 139/286] gx: update yamux (fixes a panic due to a race) License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@edab11e8dd939a1f41567c663c20e79a334c38f3 This commit was moved from ipfs/boxo@7e7e70c7ef59b3024e7030f93d9b24f7697a4b51 --- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 4d179f9ffc1..f564d24275f 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -6,7 +6,7 @@ import ( cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmcescwzzD86xrxoXNJ6VwSw46wLC91QzFDnozYRVf4KnX/go-merkledag" + dag "gx/ipfs/QmY8BMUSpCwNiTmFhACmC9Bt1qT63cHP35AoQAus4x14qH/go-merkledag" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 44d53f23c4b..eb976ebd8cf 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmQ4sKWqHhSYekzST5RwT4VHdQB4df6JWLHNy7tuWTo8uY/go-path" + ipfspath "gx/ipfs/QmRKuTyCzg7HFBcV1YUhzStroGtJSb8iWgyxfsDCwFhWTS/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 1cd4f200e9f6753e25efbf21f787b14859f2e52c Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Sat, 27 Oct 2018 03:30:18 +0200 Subject: [PATCH 140/286] Bubble deps License: MIT Signed-off-by: Hector Sanjuan This commit was moved from ipfs/interface-go-ipfs-core@c21b863fa15557b64d4bdcc99a7134b28ac3ca05 This commit was moved from ipfs/boxo@95c39b6f72f1d32c0e68731b2a02e031ac941e02 --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/object.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/unixfs.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index bc889237b3e..b744a207a5e 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" + ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 06bb91dce89..6cca5b9e68f 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -6,7 +6,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" + ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" ) // DagOps groups operations that can be batched together diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 6b355a302a8..229f69869e7 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -7,7 +7,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" - ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" + ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index f564d24275f..8a913788754 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -6,7 +6,7 @@ import ( cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmY8BMUSpCwNiTmFhACmC9Bt1qT63cHP35AoQAus4x14qH/go-merkledag" + dag "gx/ipfs/QmSei8kFMfqdJq7Q68d2LMnHbTWKKg2daA29ezUYFAUNgc/go-merkledag" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index eb976ebd8cf..5a3d1128b18 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmRKuTyCzg7HFBcV1YUhzStroGtJSb8iWgyxfsDCwFhWTS/go-path" + ipfspath "gx/ipfs/QmZbQUht8hzKmQxLHnzY14WSuoQqYkR5mn4cunchyWPmhn/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index dd7e5a3926d..6fd33ad2c56 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" files "gx/ipfs/QmZMWMvWMVKCbHetJ4RgndbuEF1io2UpUxwQwtNjtYPzSC/go-ipfs-files" - ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format" ) // TODO: ideas on making this more coreapi-ish without breaking the http API? From 7c9bf201dbfa5c1d9e5271e4f7c8a800539f4ac5 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 30 Oct 2018 08:48:49 -0700 Subject: [PATCH 141/286] coreapi: fix errisdir JavaScript expects this to be "this dag node is a directory". I'm almost of a mind to say "don't parse errors" but, well, we don't give any better alternatives. License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@dc979581ae4496d6e2c57a019cb133d780585df7 This commit was moved from ipfs/boxo@abd0d4dddf5f23500d65ce04ab82a0dd8b7baa74 --- core/coreiface/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/errors.go b/core/coreiface/errors.go index 072275409e0..4ee3026ffc7 100644 --- a/core/coreiface/errors.go +++ b/core/coreiface/errors.go @@ -3,6 +3,6 @@ package iface import "errors" var ( - ErrIsDir = errors.New("object is a directory") + ErrIsDir = errors.New("this dag node is a directory") ErrOffline = errors.New("this action must be run in online mode, try running 'ipfs daemon' first") ) From a81292a58214577d336645132c21a57048ab443a Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 30 Oct 2018 09:27:41 -0700 Subject: [PATCH 142/286] gx: update go-path fixes the changed path cat error causing the js-ipfs-api tests to fail License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@6fcff53bc29de056f4b948bb0bfaa468546d1c66 This commit was moved from ipfs/boxo@41c1c071623c7781041fb09e69c641db9642bc1d --- core/coreiface/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 5a3d1128b18..79dac201d1e 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmZbQUht8hzKmQxLHnzY14WSuoQqYkR5mn4cunchyWPmhn/go-path" + ipfspath "gx/ipfs/QmT3rzed1ppXefourpmoZ7tyVQfsGPQZ1pHDngLmCvXxd3/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 1eb12c92ea12cd542f132203e9ddc46d21781da4 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 2 Nov 2018 13:16:34 -0700 Subject: [PATCH 143/286] gx: update go-ipld-cbor (might as well do this at the same time) License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@bca0017a7a95666fff03c83e4a8e38b51d6158f3 This commit was moved from ipfs/boxo@9054f4c4c977dda2774bcf8493b2087fbf097d4d --- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 8a913788754..d541adac789 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -6,7 +6,7 @@ import ( cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmSei8kFMfqdJq7Q68d2LMnHbTWKKg2daA29ezUYFAUNgc/go-merkledag" + dag "gx/ipfs/QmXyuFW7at4r9dxRAbrPU9JpHW5aqngAFyxvyhvYjzxRKS/go-merkledag" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 79dac201d1e..034bfffc34a 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmT3rzed1ppXefourpmoZ7tyVQfsGPQZ1pHDngLmCvXxd3/go-path" + ipfspath "gx/ipfs/QmUB3RFRDctDp1k73mDJydzWiKdiuNHfyuoRPQeU52rWWT/go-path" cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" ) From 3e33625fe336ffcc052f002259e8744d9fea78e4 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 2 Nov 2018 17:15:21 -0700 Subject: [PATCH 144/286] gx: update go-log and sha256 fixes #5709 License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@1c6351bc2b6ca351b0aaf8f3a6eca43714af21e1 This commit was moved from ipfs/boxo@93332aaa1821369c585b86e957acd42a09d3f1dd --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/dht.go | 4 ++-- core/coreiface/key.go | 2 +- core/coreiface/object.go | 4 ++-- core/coreiface/options/block.go | 4 ++-- core/coreiface/options/dag.go | 2 +- core/coreiface/options/unixfs.go | 6 +++--- core/coreiface/path.go | 4 ++-- core/coreiface/pubsub.go | 2 +- core/coreiface/swarm.go | 8 ++++---- core/coreiface/unixfs.go | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index b744a207a5e..bab4fc13b39 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" + ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 6cca5b9e68f..eb9e2da4a0d 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -6,7 +6,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" + ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" ) // DagOps groups operations that can be batched together diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 38a0f734881..c4eef937927 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - peer "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer" - pstore "gx/ipfs/QmTTJcDL3gsnGDALjh2fDGg1onGRUdVgNL2hU2WEZcVrMX/go-libp2p-peerstore" + pstore "gx/ipfs/QmUymf8fJtideyv3z727BcZUifGBjMZMpCJqu3Gxk5aRUk/go-libp2p-peerstore" + peer "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 9e7bfee2814..36a74688b1c 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer" + "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 229f69869e7..ba6f5a95d63 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" - ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" + cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" + ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 6603136f301..ea4ae26bb61 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -2,8 +2,8 @@ package options import ( "fmt" - cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" - mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" + cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" + mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) type BlockPutSettings struct { diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go index 4fdff0489c7..9cccba58548 100644 --- a/core/coreiface/options/dag.go +++ b/core/coreiface/options/dag.go @@ -3,7 +3,7 @@ package options import ( "math" - cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" + cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" ) type DagPutSettings struct { diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index d541adac789..9b0683a1175 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -4,9 +4,9 @@ import ( "errors" "fmt" - cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" - mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash" - dag "gx/ipfs/QmXyuFW7at4r9dxRAbrPU9JpHW5aqngAFyxvyhvYjzxRKS/go-merkledag" + cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" + dag "gx/ipfs/QmaDBne4KeY3UepeqSVKYpSmQGa3q9zP6x3LfVF2UjF3Hc/go-merkledag" + mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 034bfffc34a..f5e7aeb4c17 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,9 +1,9 @@ package iface import ( - ipfspath "gx/ipfs/QmUB3RFRDctDp1k73mDJydzWiKdiuNHfyuoRPQeU52rWWT/go-path" + ipfspath "gx/ipfs/QmRG3XuGwT7GYuAqgWDJBKTzdaHMwAnc1x7J2KHEXNHxzG/go-path" - cid "gx/ipfs/QmPSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7/go-cid" + cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" ) //TODO: merge with ipfspath so we don't depend on it diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index b3f3f6b7628..93e4295746f 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - peer "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer" + peer "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" ) // PubSubSubscription is an active PubSub subscription diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index d4b92c017d7..b830a081742 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,11 +5,11 @@ import ( "errors" "time" - ma "gx/ipfs/QmT4U94DnD8FRfqr21obWY32HLM5VExccPKMjQHofeYqr9/go-multiaddr" - "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer" - pstore "gx/ipfs/QmTTJcDL3gsnGDALjh2fDGg1onGRUdVgNL2hU2WEZcVrMX/go-libp2p-peerstore" - net "gx/ipfs/QmXuRkCR7BNQa9uqfpTiFWsTQLzmTWYg91Ja1w95gnqb6u/go-libp2p-net" + ma "gx/ipfs/QmRKLtwMw131aK7ugC3G7ybpumMz78YrJe5dzneyindvG1/go-multiaddr" + net "gx/ipfs/QmRKbEchaYADxSCyyjhDh4cTrUby8ftXUb8MRLBTHQYupw/go-libp2p-net" + pstore "gx/ipfs/QmUymf8fJtideyv3z727BcZUifGBjMZMpCJqu3Gxk5aRUk/go-libp2p-peerstore" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" + "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" ) var ( diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 6fd33ad2c56..002635d9936 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmR7TcHkR9nxkUorfi8XMTAMLUK7GiP64TWWBzY3aacc1o/go-ipld-format" files "gx/ipfs/QmZMWMvWMVKCbHetJ4RgndbuEF1io2UpUxwQwtNjtYPzSC/go-ipfs-files" + ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" ) // TODO: ideas on making this more coreapi-ish without breaking the http API? From 187f6a306b6fa567dc3bd0abd94e31dd4d57af9a Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Sat, 10 Nov 2018 18:37:06 -0800 Subject: [PATCH 145/286] Update go-ipfs-delay and assoc deps License: MIT Signed-off-by: hannahhoward This commit was moved from ipfs/interface-go-ipfs-core@20ca7387bd766e8a03ba3d7675d4d611a3a3fdab This commit was moved from ipfs/boxo@cd374fff52aec080e9faa17753d6fc104c1bd4ae --- core/coreiface/dht.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/swarm.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index c4eef937927..243f1292c95 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - pstore "gx/ipfs/QmUymf8fJtideyv3z727BcZUifGBjMZMpCJqu3Gxk5aRUk/go-libp2p-peerstore" + pstore "gx/ipfs/QmQAGG1zxfePqj2t7bLxyN8AFccZ889DDR9Gn8kVLDrGZo/go-libp2p-peerstore" peer "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" ) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 9b0683a1175..742aa6f9e69 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -5,7 +5,7 @@ import ( "fmt" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - dag "gx/ipfs/QmaDBne4KeY3UepeqSVKYpSmQGa3q9zP6x3LfVF2UjF3Hc/go-merkledag" + dag "gx/ipfs/QmcGt25mrjuB2kKW2zhPbXVZNHc4yoTDQ65NA8m6auP2f1/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index f5e7aeb4c17..0545c30d76e 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmRG3XuGwT7GYuAqgWDJBKTzdaHMwAnc1x7J2KHEXNHxzG/go-path" + ipfspath "gx/ipfs/QmVi2uUygezqaMTqs3Yzt5FcZFHJoYD4B7jQ2BELjj7ZuY/go-path" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" ) diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index b830a081742..1ecb0bb5ef6 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,11 +5,11 @@ import ( "errors" "time" + pstore "gx/ipfs/QmQAGG1zxfePqj2t7bLxyN8AFccZ889DDR9Gn8kVLDrGZo/go-libp2p-peerstore" ma "gx/ipfs/QmRKLtwMw131aK7ugC3G7ybpumMz78YrJe5dzneyindvG1/go-multiaddr" - net "gx/ipfs/QmRKbEchaYADxSCyyjhDh4cTrUby8ftXUb8MRLBTHQYupw/go-libp2p-net" - pstore "gx/ipfs/QmUymf8fJtideyv3z727BcZUifGBjMZMpCJqu3Gxk5aRUk/go-libp2p-peerstore" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" + net "gx/ipfs/QmenvQQy4bFGSiHJUGupVmCRHfetg5rH3vTp9Z2f6v2KXR/go-libp2p-net" ) var ( From dda742853e04e8750589ad29a1bf3353aadbe730 Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Wed, 28 Nov 2018 17:21:36 -0500 Subject: [PATCH 146/286] Gx update go-merkledag and related deps. License: MIT Signed-off-by: Kevin Atkinson This commit was moved from ipfs/interface-go-ipfs-core@1f51fd41ce7d6160fa741a5c7699a3b5bb305540 This commit was moved from ipfs/boxo@33840cd7fb98e69e4a3795ad744faf3135dc9a9b --- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 742aa6f9e69..4d7b61a936c 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -5,7 +5,7 @@ import ( "fmt" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - dag "gx/ipfs/QmcGt25mrjuB2kKW2zhPbXVZNHc4yoTDQ65NA8m6auP2f1/go-merkledag" + dag "gx/ipfs/QmdURv6Sbob8TVW2tFFve9vcEWrSUgwPqeqnXyvYhLrkyd/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 0545c30d76e..aa3b2d0c6d9 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmVi2uUygezqaMTqs3Yzt5FcZFHJoYD4B7jQ2BELjj7ZuY/go-path" + ipfspath "gx/ipfs/QmQtg7N4XjAk2ZYpBjjv8B6gQprsRekabHBCnF6i46JYKJ/go-path" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" ) From f31d59e53839b6b5480309a1720725cb718399b4 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 7 Dec 2018 15:37:23 -0800 Subject: [PATCH 147/286] gx: update go-libp2p-peer Reverts the changes that allowed small keys (ed25519 keys) to be inlined. License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@2d2e05fe7cc9680e2a06a5f752e76666a17b5944 This commit was moved from ipfs/boxo@21152b6074f3bf08068a4f980775194769ba63e5 --- core/coreiface/dht.go | 4 ++-- core/coreiface/key.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/pubsub.go | 2 +- core/coreiface/swarm.go | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 243f1292c95..e39be92c582 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - pstore "gx/ipfs/QmQAGG1zxfePqj2t7bLxyN8AFccZ889DDR9Gn8kVLDrGZo/go-libp2p-peerstore" - peer "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" + peer "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" + pstore "gx/ipfs/QmZ9zH2FnLcxv1xyzFeUpDUeo55xEhZQHgveZijcxr7TLj/go-libp2p-peerstore" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 36a74688b1c..f310c3cc2ef 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" + "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 4d7b61a936c..b771896bccf 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -5,7 +5,7 @@ import ( "fmt" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - dag "gx/ipfs/QmdURv6Sbob8TVW2tFFve9vcEWrSUgwPqeqnXyvYhLrkyd/go-merkledag" + dag "gx/ipfs/QmdV35UHnL1FM52baPkeUo6u7Fxm2CRUkPTLRPxeF8a4Ap/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index aa3b2d0c6d9..57ef4c21bd3 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,7 @@ package iface import ( - ipfspath "gx/ipfs/QmQtg7N4XjAk2ZYpBjjv8B6gQprsRekabHBCnF6i46JYKJ/go-path" + ipfspath "gx/ipfs/QmZErC2Ay6WuGi96CPg316PwitdwgLo6RxZRqVjJjRj2MR/go-path" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" ) diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index 93e4295746f..867c8adc444 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - peer "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" + peer "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" ) // PubSubSubscription is an active PubSub subscription diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 1ecb0bb5ef6..63d20f03513 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,11 +5,11 @@ import ( "errors" "time" - pstore "gx/ipfs/QmQAGG1zxfePqj2t7bLxyN8AFccZ889DDR9Gn8kVLDrGZo/go-libp2p-peerstore" + net "gx/ipfs/QmPtFaR7BWHLAjSwLh9kXcyrgTzDpuhcWLkx8ioa9RMYnx/go-libp2p-net" ma "gx/ipfs/QmRKLtwMw131aK7ugC3G7ybpumMz78YrJe5dzneyindvG1/go-multiaddr" + "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" + pstore "gx/ipfs/QmZ9zH2FnLcxv1xyzFeUpDUeo55xEhZQHgveZijcxr7TLj/go-libp2p-peerstore" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" - "gx/ipfs/QmcqU6QUDSXprb1518vYDGczrTJTyGwLG9eUa5iNX4xUtS/go-libp2p-peer" - net "gx/ipfs/QmenvQQy4bFGSiHJUGupVmCRHfetg5rH3vTp9Z2f6v2KXR/go-libp2p-net" ) var ( From 7505d2c4871eaa34dbf910902d3f43b1dfdbe0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 26 Oct 2018 14:14:49 +0200 Subject: [PATCH 148/286] gx: update go-ipfs-files to 2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@1dc26f7a3fc0c1992e3c005177cecddb3fa8e14a This commit was moved from ipfs/boxo@5a85a431f81b0ba3feb64c8adc814b09b7ebe4da --- core/coreiface/unixfs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 002635d9936..3a214085c2a 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - files "gx/ipfs/QmZMWMvWMVKCbHetJ4RgndbuEF1io2UpUxwQwtNjtYPzSC/go-ipfs-files" + files "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" ) From 20631f73bfece2e3c953e07c4a2473456ac9cd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 26 Oct 2018 15:56:30 +0200 Subject: [PATCH 149/286] files2.0: fix build errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@072259200527f4b78299675bb5efbbaa715ca821 This commit was moved from ipfs/boxo@d4352730fe649983c5c9099d4ba2fba2170451f6 --- core/coreiface/unixfs.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 3a214085c2a..773b36dc039 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -2,9 +2,8 @@ package iface import ( "context" - "io" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/go-ipfs/core/coreapi/interface/options" files "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" @@ -18,11 +17,6 @@ type AddEvent struct { Size string `json:",omitempty"` } -type UnixfsFile interface { - files.SizeFile - io.Seeker -} - // UnixfsAPI is the basic interface to immutable files in IPFS // NOTE: This API is heavily WIP, things are guaranteed to break frequently type UnixfsAPI interface { @@ -35,7 +29,7 @@ type UnixfsAPI interface { // // Note that some implementations of this API may apply the specified context // to operations performed on the returned file - Get(context.Context, Path) (UnixfsFile, error) + Get(context.Context, Path) (files.File, error) // Ls returns the list of links in a directory Ls(context.Context, Path) ([]*ipld.Link, error) From 257add12aba544fb7bea36b972ffd8c9d8b709dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 19 Nov 2018 03:24:42 +0100 Subject: [PATCH 150/286] files2.0: updates for file type split MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@65f7599676af200b0b87cee47292e6a48b1c14eb This commit was moved from ipfs/boxo@2904a69ad87f9a72ce9598c08536212a6d19609d --- core/coreiface/unixfs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 773b36dc039..589083c6b83 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -23,13 +23,13 @@ type UnixfsAPI interface { // Add imports the data from the reader into merkledag file // // TODO: a long useful comment on how to use this for many different scenarios - Add(context.Context, files.File, ...options.UnixfsAddOption) (ResolvedPath, error) + Add(context.Context, files.Node, ...options.UnixfsAddOption) (ResolvedPath, error) // Get returns a read-only handle to a file tree referenced by a path // // Note that some implementations of this API may apply the specified context // to operations performed on the returned file - Get(context.Context, Path) (files.File, error) + Get(context.Context, Path) (files.Node, error) // Ls returns the list of links in a directory Ls(context.Context, Path) ([]*ipld.Link, error) From bee62f1823b1eb2c2cac33e60a449c3dd8ad69e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 18 Dec 2018 02:09:43 +0100 Subject: [PATCH 151/286] files2.0: address review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@d68c62b157814c099608799f543888595fdb8fd5 This commit was moved from ipfs/boxo@0e2ab3797e3ea5f3d78d72f7f8b646e22772e2dd --- core/coreiface/errors.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/coreiface/errors.go b/core/coreiface/errors.go index 4ee3026ffc7..234abe5667e 100644 --- a/core/coreiface/errors.go +++ b/core/coreiface/errors.go @@ -4,5 +4,6 @@ import "errors" var ( ErrIsDir = errors.New("this dag node is a directory") + ErrNotFile = errors.New("this dag node is not a regular file") ErrOffline = errors.New("this action must be run in online mode, try running 'ipfs daemon' first") ) From f24ab99f72cfd21bd1db9c781da52ea0e9ca0945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 6 Dec 2018 10:47:51 +0100 Subject: [PATCH 152/286] coreapi: Global options for api constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@84509e38781da3257c7a82d09483b4c7d9188a10 This commit was moved from ipfs/boxo@3d132ddab18ee64dc731918e08fd4548d1b335dc --- core/coreiface/options/global.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 core/coreiface/options/global.go diff --git a/core/coreiface/options/global.go b/core/coreiface/options/global.go new file mode 100644 index 00000000000..f4396522949 --- /dev/null +++ b/core/coreiface/options/global.go @@ -0,0 +1,32 @@ +package options + +type ApiSettings struct { + Offline bool +} + +type ApiOption func(*ApiSettings) error + +func ApiOptions(opts ...ApiOption) (*ApiSettings, error) { + options := &ApiSettings{ + Offline: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + return options, nil +} + +type apiOpts struct{} + +var Api dagOpts + +func (dagOpts) Offline(offline bool) ApiOption { + return func(settings *ApiSettings) error { + settings.Offline = offline + return nil + } +} From 5da159b33c400648d67d20e25d17b23043fb590c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 10 Dec 2018 14:21:19 +0100 Subject: [PATCH 153/286] coreapi.WithOptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@7b478b88d1f788045344cede17f73e2f9b21d680 This commit was moved from ipfs/boxo@6d52ba5bb4ccdda79fb3a55fbc1d024bee208c6e --- core/coreiface/coreapi.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index bab4fc13b39..226399967ce 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,6 +5,8 @@ package iface import ( "context" + "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" ) @@ -46,4 +48,8 @@ type CoreAPI interface { // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node ResolveNode(context.Context, Path) (ipld.Node, error) + + // WithOptions creates new instance of CoreAPI based on this instance with + // a set of options applied + WithOptions(...options.ApiOption) (CoreAPI, error) } From 322654a45ffaaada90c2237e33212ca83898e6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 10 Dec 2018 14:31:19 +0100 Subject: [PATCH 154/286] coreapi: drop nameopt.Local in favour of api.Offline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@42d3b2edfa9d76d00e9fb2b86f6ab35ee15a0c0d This commit was moved from ipfs/boxo@57bf11c1602f87c424c2b0309d89642ef6d7d0d0 --- core/coreiface/options/name.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index c614db3abc3..e2a0fc16498 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -20,7 +20,6 @@ type NamePublishSettings struct { } type NameResolveSettings struct { - Local bool Cache bool ResolveOpts []ropts.ResolveOpt @@ -49,7 +48,6 @@ func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) func NameResolveOptions(opts ...NameResolveOption) (*NameResolveSettings, error) { options := &NameResolveSettings{ - Local: false, Cache: true, } @@ -106,15 +104,6 @@ func (nameOpts) TTL(ttl time.Duration) NamePublishOption { } } -// Local is an option for Name.Resolve which specifies if the lookup should be -// offline. Default value is false -func (nameOpts) Local(local bool) NameResolveOption { - return func(settings *NameResolveSettings) error { - settings.Local = local - return nil - } -} - // Cache is an option for Name.Resolve which specifies if cache should be used. // Default value is true func (nameOpts) Cache(cache bool) NameResolveOption { From 2230c18f333eb14d63641f437559da445366e42e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 10 Dec 2018 15:26:27 +0100 Subject: [PATCH 155/286] coreapi: implement --local with Offline option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@286ea29c95a4d398c9a4b08fc5d24494e0c5d7c1 This commit was moved from ipfs/boxo@3b8f8c7c8238d5fbd913ab0fb13f466ec3313e97 --- core/coreiface/options/unixfs.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index b771896bccf..fd748bb4ad8 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -30,7 +30,6 @@ type UnixfsAddSettings struct { Pin bool OnlyHash bool - Local bool FsCache bool NoCopy bool @@ -60,7 +59,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, Pin: false, OnlyHash: false, - Local: false, FsCache: false, NoCopy: false, @@ -220,16 +218,6 @@ func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption { } } -// Local will add the data to blockstore without announcing it to the network -// -// Note that this doesn't prevent other nodes from getting this data -func (unixfsOpts) Local(local bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Local = local - return nil - } -} - // Wrap tells the adder to wrap the added file structure with an additional // directory. func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption { From cd14497b17c5d772f183e4922552420e4999e304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 11 Dec 2018 22:24:40 +0100 Subject: [PATCH 156/286] coreapi WithOptions: apply on top of parent options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@3956a72f07973de428f73776571af0518872e87c This commit was moved from ipfs/boxo@e84f354e2490ba03d16798213311feb0ef47b59c --- core/coreiface/options/global.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/global.go b/core/coreiface/options/global.go index f4396522949..93d635e41b6 100644 --- a/core/coreiface/options/global.go +++ b/core/coreiface/options/global.go @@ -11,6 +11,10 @@ func ApiOptions(opts ...ApiOption) (*ApiSettings, error) { Offline: false, } + return ApiOptionsTo(options, opts...) +} + +func ApiOptionsTo(options *ApiSettings, opts ...ApiOption) (*ApiSettings, error) { for _, opt := range opts { err := opt(options) if err != nil { @@ -22,9 +26,9 @@ func ApiOptions(opts ...ApiOption) (*ApiSettings, error) { type apiOpts struct{} -var Api dagOpts +var Api apiOpts -func (dagOpts) Offline(offline bool) ApiOption { +func (apiOpts) Offline(offline bool) ApiOption { return func(settings *ApiSettings) error { settings.Offline = offline return nil From 1208d736c479be0d54acb55028d07cdcd541e2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 18 Dec 2018 14:23:55 +0100 Subject: [PATCH 157/286] coreapi/unixfs: Use path instead of raw hash in AddEvent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@a1cf89b78a61aef35a4893f916e14e39cd5c9157 This commit was moved from ipfs/boxo@b5e06d34876da3759fa39fb18f557085e27f76d0 --- core/coreiface/path.go | 1 + core/coreiface/unixfs.go | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 57ef4c21bd3..01dda97d5a8 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -46,6 +46,7 @@ type ResolvedPath interface { // cidRoot := {"A": {"/": cidA }} // // And resolve paths: + // // * "/ipfs/${cidRoot}" // * Calling Cid() will return `cidRoot` // * Calling Root() will return `cidRoot` diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 589083c6b83..b42b454cc2a 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -9,12 +9,11 @@ import ( ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" ) -// TODO: ideas on making this more coreapi-ish without breaking the http API? type AddEvent struct { Name string - Hash string `json:",omitempty"` - Bytes int64 `json:",omitempty"` - Size string `json:",omitempty"` + Path ResolvedPath `json:",omitempty"` + Bytes int64 `json:",omitempty"` + Size string `json:",omitempty"` } // UnixfsAPI is the basic interface to immutable files in IPFS From e60f2ba563c6a5708ba08c8140ac517b206dfda6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Dec 2018 19:45:58 +0100 Subject: [PATCH 158/286] coreapi: move tests to interface subpackage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@a479105a40eddefc84ca1de9aaaf12cbe2e13e56 This commit was moved from ipfs/boxo@3301b037c33fd42e0deb10965447a7e26e1e86fa --- core/coreiface/tests/block_test.go | 183 ++++++ core/coreiface/tests/dag_test.go | 151 +++++ core/coreiface/tests/dht_test.go | 126 ++++ core/coreiface/tests/key_test.go | 475 ++++++++++++++ core/coreiface/tests/name_test.go | 262 ++++++++ core/coreiface/tests/object_test.go | 427 ++++++++++++ core/coreiface/tests/path_test.go | 154 +++++ core/coreiface/tests/pin_test.go | 214 +++++++ core/coreiface/tests/pubsub_test.go | 106 +++ core/coreiface/tests/unixfs_test.go | 963 ++++++++++++++++++++++++++++ 10 files changed, 3061 insertions(+) create mode 100644 core/coreiface/tests/block_test.go create mode 100644 core/coreiface/tests/dag_test.go create mode 100644 core/coreiface/tests/dht_test.go create mode 100644 core/coreiface/tests/key_test.go create mode 100644 core/coreiface/tests/name_test.go create mode 100644 core/coreiface/tests/object_test.go create mode 100644 core/coreiface/tests/path_test.go create mode 100644 core/coreiface/tests/pin_test.go create mode 100644 core/coreiface/tests/pubsub_test.go create mode 100644 core/coreiface/tests/unixfs_test.go diff --git a/core/coreiface/tests/block_test.go b/core/coreiface/tests/block_test.go new file mode 100644 index 00000000000..81360b150ee --- /dev/null +++ b/core/coreiface/tests/block_test.go @@ -0,0 +1,183 @@ +package tests_test + +import ( + "context" + "io/ioutil" + "strings" + "testing" + + coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" + opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + + mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" +) + +func TestBlockPut(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) + if err != nil { + t.Error(err) + } + + if res.Path().Cid().String() != "QmPyo15ynbVrSTVdJL9th7JysHaAbXt9dM9tXk1bMHbRtk" { + t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + } +} + +func TestBlockPutFormat(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Format("cbor")) + if err != nil { + t.Error(err) + } + + if res.Path().Cid().String() != "zdpuAn4amuLWo8Widi5v6VQpuo2dnpnwbVE3oB6qqs7mDSeoa" { + t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + } +} + +func TestBlockPutHash(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Hash(mh.KECCAK_512, -1)) + if err != nil { + t.Fatal(err) + } + + if res.Path().Cid().String() != "zBurKB9YZkcDf6xa53WBE8CFX4ydVqAyf9KPXBFZt5stJzEstaS8Hukkhu4gwpMtc1xHNDbzP7sPtQKyWsP3C8fbhkmrZ" { + t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + } +} + +func TestBlockGet(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Hash(mh.KECCAK_512, -1)) + if err != nil { + t.Error(err) + } + + r, err := api.Block().Get(ctx, res.Path()) + if err != nil { + t.Error(err) + } + + d, err := ioutil.ReadAll(r) + if err != nil { + t.Error(err) + } + + if string(d) != "Hello" { + t.Error("didn't get correct data back") + } + + p, err := coreiface.ParsePath("/ipfs/" + res.Path().Cid().String()) + if err != nil { + t.Error(err) + } + + rp, err := api.ResolvePath(ctx, p) + if err != nil { + t.Fatal(err) + } + if rp.Cid().String() != res.Path().Cid().String() { + t.Error("paths didn't match") + } +} + +func TestBlockRm(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) + if err != nil { + t.Error(err) + } + + r, err := api.Block().Get(ctx, res.Path()) + if err != nil { + t.Error(err) + } + + d, err := ioutil.ReadAll(r) + if err != nil { + t.Error(err) + } + + if string(d) != "Hello" { + t.Error("didn't get correct data back") + } + + err = api.Block().Rm(ctx, res.Path()) + if err != nil { + t.Error(err) + } + + _, err = api.Block().Get(ctx, res.Path()) + if err == nil { + t.Error("expected err to exist") + } + if err.Error() != "blockservice: key not found" { + t.Errorf("unexpected error; %s", err.Error()) + } + + err = api.Block().Rm(ctx, res.Path()) + if err == nil { + t.Error("expected err to exist") + } + if err.Error() != "blockstore: block not found" { + t.Errorf("unexpected error; %s", err.Error()) + } + + err = api.Block().Rm(ctx, res.Path(), opt.Block.Force(true)) + if err != nil { + t.Error(err) + } +} + +func TestBlockStat(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) + if err != nil { + t.Error(err) + } + + stat, err := api.Block().Stat(ctx, res.Path()) + if err != nil { + t.Error(err) + } + + if stat.Path().String() != res.Path().String() { + t.Error("paths don't match") + } + + if stat.Size() != len("Hello") { + t.Error("length doesn't match") + } +} diff --git a/core/coreiface/tests/dag_test.go b/core/coreiface/tests/dag_test.go new file mode 100644 index 00000000000..17059192be5 --- /dev/null +++ b/core/coreiface/tests/dag_test.go @@ -0,0 +1,151 @@ +package tests_test + +import ( + "context" + "path" + "strings" + "testing" + + coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" + opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + + mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" +) + +var ( + treeExpected = map[string]struct{}{ + "a": {}, + "b": {}, + "c": {}, + "c/d": {}, + "c/e": {}, + } +) + +func TestPut(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + res, err := api.Dag().Put(ctx, strings.NewReader(`"Hello"`)) + if err != nil { + t.Error(err) + } + + if res.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { + t.Errorf("got wrong cid: %s", res.Cid().String()) + } +} + +func TestPutWithHash(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + res, err := api.Dag().Put(ctx, strings.NewReader(`"Hello"`), opt.Dag.Hash(mh.ID, -1)) + if err != nil { + t.Error(err) + } + + if res.Cid().String() != "z5hRLNd2sv4z1c" { + t.Errorf("got wrong cid: %s", res.Cid().String()) + } +} + +func TestPath(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + sub, err := api.Dag().Put(ctx, strings.NewReader(`"foo"`)) + if err != nil { + t.Error(err) + } + + res, err := api.Dag().Put(ctx, strings.NewReader(`{"lnk": {"/": "`+sub.Cid().String()+`"}}`)) + if err != nil { + t.Error(err) + } + + p, err := coreiface.ParsePath(path.Join(res.Cid().String(), "lnk")) + if err != nil { + t.Error(err) + } + + nd, err := api.Dag().Get(ctx, p) + if err != nil { + t.Error(err) + } + + if nd.Cid().String() != sub.Cid().String() { + t.Errorf("got unexpected cid %s, expected %s", nd.Cid().String(), sub.Cid().String()) + } +} + +func TestTree(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + c, err := api.Dag().Put(ctx, strings.NewReader(`{"a": 123, "b": "foo", "c": {"d": 321, "e": 111}}`)) + if err != nil { + t.Error(err) + } + + res, err := api.Dag().Get(ctx, c) + if err != nil { + t.Error(err) + } + + lst := res.Tree("", -1) + if len(lst) != len(treeExpected) { + t.Errorf("tree length of %d doesn't match expected %d", len(lst), len(treeExpected)) + } + + for _, ent := range lst { + if _, ok := treeExpected[ent]; !ok { + t.Errorf("unexpected tree entry %s", ent) + } + } +} + +func TestBatch(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + batch := api.Dag().Batch(ctx) + + c, err := batch.Put(ctx, strings.NewReader(`"Hello"`)) + if err != nil { + t.Error(err) + } + + if c.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { + t.Errorf("got wrong cid: %s", c.Cid().String()) + } + + _, err = api.Dag().Get(ctx, c) + if err == nil || err.Error() != "merkledag: not found" { + t.Error(err) + } + + if err := batch.Commit(ctx); err != nil { + t.Error(err) + } + + _, err = api.Dag().Get(ctx, c) + if err != nil { + t.Error(err) + } +} diff --git a/core/coreiface/tests/dht_test.go b/core/coreiface/tests/dht_test.go new file mode 100644 index 00000000000..be16bb08395 --- /dev/null +++ b/core/coreiface/tests/dht_test.go @@ -0,0 +1,126 @@ +package tests_test + +import ( + "context" + "io" + "testing" + + "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +func TestDhtFindPeer(t *testing.T) { + ctx := context.Background() + apis, err := makeAPISwarm(ctx, true, 5) + if err != nil { + t.Fatal(err) + } + + self0, err := apis[0].Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + pi, err := apis[2].Dht().FindPeer(ctx, self0.ID()) + if err != nil { + t.Fatal(err) + } + + if pi.Addrs[0].String() != "/ip4/127.0.0.1/tcp/4001" { + t.Errorf("got unexpected address from FindPeer: %s", pi.Addrs[0].String()) + } + + self2, err := apis[2].Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + pi, err = apis[1].Dht().FindPeer(ctx, self2.ID()) + if err != nil { + t.Fatal(err) + } + + if pi.Addrs[0].String() != "/ip4/127.0.2.1/tcp/4001" { + t.Errorf("got unexpected address from FindPeer: %s", pi.Addrs[0].String()) + } +} + +func TestDhtFindProviders(t *testing.T) { + ctx := context.Background() + apis, err := makeAPISwarm(ctx, true, 5) + if err != nil { + t.Fatal(err) + } + + p, err := addTestObject(ctx, apis[0]) + if err != nil { + t.Fatal(err) + } + + out, err := apis[2].Dht().FindProviders(ctx, p, options.Dht.NumProviders(1)) + if err != nil { + t.Fatal(err) + } + + provider := <-out + + self0, err := apis[0].Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if provider.ID.String() != self0.ID().String() { + t.Errorf("got wrong provider: %s != %s", provider.ID.String(), self0.ID().String()) + } +} + +func TestDhtProvide(t *testing.T) { + ctx := context.Background() + apis, err := makeAPISwarm(ctx, true, 5) + if err != nil { + t.Fatal(err) + } + + off0, err := apis[0].WithOptions(options.Api.Offline(true)) + if err != nil { + t.Fatal(err) + } + + s, err := off0.Block().Put(ctx, &io.LimitedReader{R: rnd, N: 4092}) + if err != nil { + t.Fatal(err) + } + + p := s.Path() + + out, err := apis[2].Dht().FindProviders(ctx, p, options.Dht.NumProviders(1)) + if err != nil { + t.Fatal(err) + } + + provider := <-out + + self0, err := apis[0].Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if provider.ID.String() != "" { + t.Errorf("got wrong provider: %s != %s", provider.ID.String(), self0.ID().String()) + } + + err = apis[0].Dht().Provide(ctx, p) + if err != nil { + t.Fatal(err) + } + + out, err = apis[2].Dht().FindProviders(ctx, p, options.Dht.NumProviders(1)) + if err != nil { + t.Fatal(err) + } + + provider = <-out + + if provider.ID.String() != self0.ID().String() { + t.Errorf("got wrong provider: %s != %s", provider.ID.String(), self0.ID().String()) + } +} diff --git a/core/coreiface/tests/key_test.go b/core/coreiface/tests/key_test.go new file mode 100644 index 00000000000..21884e448de --- /dev/null +++ b/core/coreiface/tests/key_test.go @@ -0,0 +1,475 @@ +package tests_test + +import ( + "context" + "strings" + "testing" + + opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +func TestListSelf(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + return + } + + keys, err := api.Key().List(ctx) + if err != nil { + t.Fatalf("failed to list keys: %s", err) + return + } + + if len(keys) != 1 { + t.Fatalf("there should be 1 key (self), got %d", len(keys)) + return + } + + if keys[0].Name() != "self" { + t.Errorf("expected the key to be called 'self', got '%s'", keys[0].Name()) + } + + if keys[0].Path().String() != "/ipns/"+testPeerID { + t.Errorf("expected the key to have path '/ipns/%s', got '%s'", testPeerID, keys[0].Path().String()) + } +} + +func TestRenameSelf(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + return + } + + _, _, err = api.Key().Rename(ctx, "self", "foo") + if err == nil { + t.Error("expected error to not be nil") + } else { + if err.Error() != "cannot rename key with name 'self'" { + t.Fatalf("expected error 'cannot rename key with name 'self'', got '%s'", err.Error()) + } + } + + _, _, err = api.Key().Rename(ctx, "self", "foo", opt.Key.Force(true)) + if err == nil { + t.Error("expected error to not be nil") + } else { + if err.Error() != "cannot rename key with name 'self'" { + t.Fatalf("expected error 'cannot rename key with name 'self'', got '%s'", err.Error()) + } + } +} + +func TestRemoveSelf(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + return + } + + _, err = api.Key().Remove(ctx, "self") + if err == nil { + t.Error("expected error to not be nil") + } else { + if err.Error() != "cannot remove key with name 'self'" { + t.Fatalf("expected error 'cannot remove key with name 'self'', got '%s'", err.Error()) + } + } +} + +func TestGenerate(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + k, err := api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + if k.Name() != "foo" { + t.Errorf("expected the key to be called 'foo', got '%s'", k.Name()) + } + + if !strings.HasPrefix(k.Path().String(), "/ipns/Qm") { + t.Errorf("expected the key to be prefixed with '/ipns/Qm', got '%s'", k.Path().String()) + } +} + +func TestGenerateSize(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + k, err := api.Key().Generate(ctx, "foo", opt.Key.Size(1024)) + if err != nil { + t.Fatal(err) + return + } + + if k.Name() != "foo" { + t.Errorf("expected the key to be called 'foo', got '%s'", k.Name()) + } + + if !strings.HasPrefix(k.Path().String(), "/ipns/Qm") { + t.Errorf("expected the key to be prefixed with '/ipns/Qm', got '%s'", k.Path().String()) + } +} + +func TestGenerateType(t *testing.T) { + ctx := context.Background() + t.Skip("disabled until libp2p/specs#111 is fixed") + + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + k, err := api.Key().Generate(ctx, "bar", opt.Key.Type(opt.Ed25519Key)) + if err != nil { + t.Fatal(err) + return + } + + if k.Name() != "bar" { + t.Errorf("expected the key to be called 'foo', got '%s'", k.Name()) + } + + // Expected to be an inlined identity hash. + if !strings.HasPrefix(k.Path().String(), "/ipns/12") { + t.Errorf("expected the key to be prefixed with '/ipns/12', got '%s'", k.Path().String()) + } +} + +func TestGenerateExisting(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + _, err = api.Key().Generate(ctx, "foo") + if err == nil { + t.Error("expected error to not be nil") + } else { + if err.Error() != "key with name 'foo' already exists" { + t.Fatalf("expected error 'key with name 'foo' already exists', got '%s'", err.Error()) + } + } + + _, err = api.Key().Generate(ctx, "self") + if err == nil { + t.Error("expected error to not be nil") + } else { + if err.Error() != "cannot create key with name 'self'" { + t.Fatalf("expected error 'cannot create key with name 'self'', got '%s'", err.Error()) + } + } +} + +func TestList(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + l, err := api.Key().List(ctx) + if err != nil { + t.Fatal(err) + return + } + + if len(l) != 2 { + t.Fatalf("expected to get 2 keys, got %d", len(l)) + return + } + + if l[0].Name() != "self" { + t.Fatalf("expected key 0 to be called 'self', got '%s'", l[0].Name()) + return + } + + if l[1].Name() != "foo" { + t.Fatalf("expected key 1 to be called 'foo', got '%s'", l[1].Name()) + return + } + + if !strings.HasPrefix(l[0].Path().String(), "/ipns/Qm") { + t.Fatalf("expected key 0 to be prefixed with '/ipns/Qm', got '%s'", l[0].Name()) + return + } + + if !strings.HasPrefix(l[1].Path().String(), "/ipns/Qm") { + t.Fatalf("expected key 1 to be prefixed with '/ipns/Qm', got '%s'", l[1].Name()) + return + } +} + +func TestRename(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + k, overwrote, err := api.Key().Rename(ctx, "foo", "bar") + if err != nil { + t.Fatal(err) + return + } + + if overwrote { + t.Error("overwrote should be false") + } + + if k.Name() != "bar" { + t.Errorf("returned key should be called 'bar', got '%s'", k.Name()) + } +} + +func TestRenameToSelf(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + _, _, err = api.Key().Rename(ctx, "foo", "self") + if err == nil { + t.Error("expected error to not be nil") + } else { + if err.Error() != "cannot overwrite key with name 'self'" { + t.Fatalf("expected error 'cannot overwrite key with name 'self'', got '%s'", err.Error()) + } + } +} + +func TestRenameToSelfForce(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + _, _, err = api.Key().Rename(ctx, "foo", "self", opt.Key.Force(true)) + if err == nil { + t.Error("expected error to not be nil") + } else { + if err.Error() != "cannot overwrite key with name 'self'" { + t.Fatalf("expected error 'cannot overwrite key with name 'self'', got '%s'", err.Error()) + } + } +} + +func TestRenameOverwriteNoForce(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + _, err = api.Key().Generate(ctx, "bar") + if err != nil { + t.Fatal(err) + return + } + + _, _, err = api.Key().Rename(ctx, "foo", "bar") + if err == nil { + t.Error("expected error to not be nil") + } else { + if err.Error() != "key by that name already exists, refusing to overwrite" { + t.Fatalf("expected error 'key by that name already exists, refusing to overwrite', got '%s'", err.Error()) + } + } +} + +func TestRenameOverwrite(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + kfoo, err := api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + _, err = api.Key().Generate(ctx, "bar") + if err != nil { + t.Fatal(err) + return + } + + k, overwrote, err := api.Key().Rename(ctx, "foo", "bar", opt.Key.Force(true)) + if err != nil { + t.Fatal(err) + return + } + + if !overwrote { + t.Error("overwrote should be true") + } + + if k.Name() != "bar" { + t.Errorf("returned key should be called 'bar', got '%s'", k.Name()) + } + + if k.Path().String() != kfoo.Path().String() { + t.Errorf("k and kfoo should have equal paths, '%s'!='%s'", k.Path().String(), kfoo.Path().String()) + } +} + +func TestRenameSameNameNoForce(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + k, overwrote, err := api.Key().Rename(ctx, "foo", "foo") + if err != nil { + t.Fatal(err) + return + } + + if overwrote { + t.Error("overwrote should be false") + } + + if k.Name() != "foo" { + t.Errorf("returned key should be called 'foo', got '%s'", k.Name()) + } +} + +func TestRenameSameName(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + k, overwrote, err := api.Key().Rename(ctx, "foo", "foo", opt.Key.Force(true)) + if err != nil { + t.Fatal(err) + return + } + + if overwrote { + t.Error("overwrote should be false") + } + + if k.Name() != "foo" { + t.Errorf("returned key should be called 'foo', got '%s'", k.Name()) + } +} + +func TestRemove(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + k, err := api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + l, err := api.Key().List(ctx) + if err != nil { + t.Fatal(err) + return + } + + if len(l) != 2 { + t.Fatalf("expected to get 2 keys, got %d", len(l)) + return + } + + p, err := api.Key().Remove(ctx, "foo") + if err != nil { + t.Fatal(err) + return + } + + if k.Path().String() != p.Path().String() { + t.Errorf("k and p should have equal paths, '%s'!='%s'", k.Path().String(), p.Path().String()) + } + + l, err = api.Key().List(ctx) + if err != nil { + t.Fatal(err) + return + } + + if len(l) != 1 { + t.Fatalf("expected to get 1 key, got %d", len(l)) + return + } + + if l[0].Name() != "self" { + t.Errorf("expected the key to be called 'self', got '%s'", l[0].Name()) + } +} diff --git a/core/coreiface/tests/name_test.go b/core/coreiface/tests/name_test.go new file mode 100644 index 00000000000..a3514e05134 --- /dev/null +++ b/core/coreiface/tests/name_test.go @@ -0,0 +1,262 @@ +package tests_test + +import ( + "context" + "io" + "math/rand" + "path" + "testing" + "time" + + "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" + ipath "gx/ipfs/QmZErC2Ay6WuGi96CPg316PwitdwgLo6RxZRqVjJjRj2MR/go-path" + + coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" + opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +var rnd = rand.New(rand.NewSource(0x62796532303137)) + +func addTestObject(ctx context.Context, api coreiface.CoreAPI) (coreiface.Path, error) { + return api.Unixfs().Add(ctx, files.NewReaderFile(&io.LimitedReader{R: rnd, N: 4092})) +} + +func appendPath(p coreiface.Path, sub string) coreiface.Path { + p, err := coreiface.ParsePath(path.Join(p.String(), sub)) + if err != nil { + panic(err) + } + return p +} + +func TestPublishResolve(t *testing.T) { + ctx := context.Background() + init := func() (coreiface.CoreAPI, coreiface.Path) { + apis, err := makeAPISwarm(ctx, true, 5) + if err != nil { + t.Fatal(err) + return nil, nil + } + api := apis[0] + + p, err := addTestObject(ctx, api) + if err != nil { + t.Fatal(err) + return nil, nil + } + return api, p + } + + run := func(t *testing.T, ropts []opt.NameResolveOption) { + t.Run("basic", func(t *testing.T) { + api, p := init() + e, err := api.Name().Publish(ctx, p) + if err != nil { + t.Fatal(err) + } + + self, err := api.Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if e.Name() != self.ID().Pretty() { + t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + } + + if e.Value().String() != p.String() { + t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) + } + + resPath, err := api.Name().Resolve(ctx, e.Name(), ropts...) + if err != nil { + t.Fatal(err) + } + + if resPath.String() != p.String() { + t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()) + } + }) + + t.Run("publishPath", func(t *testing.T) { + api, p := init() + e, err := api.Name().Publish(ctx, appendPath(p, "/test")) + if err != nil { + t.Fatal(err) + } + + self, err := api.Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if e.Name() != self.ID().Pretty() { + t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + } + + if e.Value().String() != p.String()+"/test" { + t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) + } + + resPath, err := api.Name().Resolve(ctx, e.Name(), ropts...) + if err != nil { + t.Fatal(err) + } + + if resPath.String() != p.String()+"/test" { + t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()+"/test") + } + }) + + t.Run("revolvePath", func(t *testing.T) { + api, p := init() + e, err := api.Name().Publish(ctx, p) + if err != nil { + t.Fatal(err) + } + + self, err := api.Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if e.Name() != self.ID().Pretty() { + t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + } + + if e.Value().String() != p.String() { + t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) + } + + resPath, err := api.Name().Resolve(ctx, e.Name()+"/test", ropts...) + if err != nil { + t.Fatal(err) + } + + if resPath.String() != p.String()+"/test" { + t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()+"/test") + } + }) + + t.Run("publishRevolvePath", func(t *testing.T) { + api, p := init() + e, err := api.Name().Publish(ctx, appendPath(p, "/a")) + if err != nil { + t.Fatal(err) + } + + self, err := api.Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if e.Name() != self.ID().Pretty() { + t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + } + + if e.Value().String() != p.String()+"/a" { + t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) + } + + resPath, err := api.Name().Resolve(ctx, e.Name()+"/b", ropts...) + if err != nil { + t.Fatal(err) + } + + if resPath.String() != p.String()+"/a/b" { + t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()+"/a/b") + } + }) + } + + t.Run("default", func(t *testing.T) { + run(t, []opt.NameResolveOption{}) + }) + + t.Run("nocache", func(t *testing.T) { + run(t, []opt.NameResolveOption{opt.Name.Cache(false)}) + }) +} + +func TestBasicPublishResolveKey(t *testing.T) { + ctx := context.Background() + apis, err := makeAPISwarm(ctx, true, 5) + if err != nil { + t.Fatal(err) + } + api := apis[0] + + k, err := api.Key().Generate(ctx, "foo") + if err != nil { + t.Fatal(err) + } + + p, err := addTestObject(ctx, api) + if err != nil { + t.Fatal(err) + } + + e, err := api.Name().Publish(ctx, p, opt.Name.Key(k.Name())) + if err != nil { + t.Fatal(err) + } + + if ipath.Join([]string{"/ipns", e.Name()}) != k.Path().String() { + t.Errorf("expected e.Name to equal '%s', got '%s'", e.Name(), k.Path().String()) + } + + if e.Value().String() != p.String() { + t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) + } + + resPath, err := api.Name().Resolve(ctx, e.Name()) + if err != nil { + t.Fatal(err) + } + + if resPath.String() != p.String() { + t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()) + } +} + +func TestBasicPublishResolveTimeout(t *testing.T) { + t.Skip("ValidTime doesn't appear to work at this time resolution") + + ctx := context.Background() + apis, err := makeAPISwarm(ctx, true, 5) + if err != nil { + t.Fatal(err) + } + api := apis[0] + p, err := addTestObject(ctx, api) + if err != nil { + t.Fatal(err) + } + + e, err := api.Name().Publish(ctx, p, opt.Name.ValidTime(time.Millisecond*100)) + if err != nil { + t.Fatal(err) + } + + self, err := api.Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if e.Name() != self.ID().Pretty() { + t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + } + + if e.Value().String() != p.String() { + t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) + } + + time.Sleep(time.Second) + + _, err = api.Name().Resolve(ctx, e.Name()) + if err == nil { + t.Fatal("Expected an error") + } +} + +//TODO: When swarm api is created, add multinode tests diff --git a/core/coreiface/tests/object_test.go b/core/coreiface/tests/object_test.go new file mode 100644 index 00000000000..ac9e1d5f37c --- /dev/null +++ b/core/coreiface/tests/object_test.go @@ -0,0 +1,427 @@ +package tests_test + +import ( + "bytes" + "context" + "encoding/hex" + "io/ioutil" + "strings" + "testing" + + "github.com/ipfs/go-ipfs/core/coreapi/interface" + opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +func TestNew(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + emptyNode, err := api.Object().New(ctx) + if err != nil { + t.Fatal(err) + } + + dirNode, err := api.Object().New(ctx, opt.Object.Type("unixfs-dir")) + if err != nil { + t.Fatal(err) + } + + if emptyNode.String() != "QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n" { + t.Errorf("Unexpected emptyNode path: %s", emptyNode.String()) + } + + if dirNode.String() != "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn" { + t.Errorf("Unexpected dirNode path: %s", dirNode.String()) + } +} + +func TestObjectPut(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"YmFy"}`), opt.Object.DataType("base64")) //bar + if err != nil { + t.Fatal(err) + } + + pbBytes, err := hex.DecodeString("0a0362617a") + if err != nil { + t.Fatal(err) + } + + p3, err := api.Object().Put(ctx, bytes.NewReader(pbBytes), opt.Object.InputEnc("protobuf")) + if err != nil { + t.Fatal(err) + } + + if p1.String() != "/ipfs/QmQeGyS87nyijii7kFt1zbe4n2PsXTFimzsdxyE9qh9TST" { + t.Errorf("unexpected path: %s", p1.String()) + } + + if p2.String() != "/ipfs/QmNeYRbCibmaMMK6Du6ChfServcLqFvLJF76PzzF76SPrZ" { + t.Errorf("unexpected path: %s", p2.String()) + } + + if p3.String() != "/ipfs/QmZreR7M2t7bFXAdb1V5FtQhjk4t36GnrvueLJowJbQM9m" { + t.Errorf("unexpected path: %s", p3.String()) + } +} + +func TestObjectGet(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + nd, err := api.Object().Get(ctx, p1) + if err != nil { + t.Fatal(err) + } + + if string(nd.RawData()[len(nd.RawData())-3:]) != "foo" { + t.Fatal("got non-matching data") + } +} + +func TestObjectData(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + r, err := api.Object().Data(ctx, p1) + if err != nil { + t.Fatal(err) + } + + data, err := ioutil.ReadAll(r) + if err != nil { + t.Fatal(err) + } + + if string(data) != "foo" { + t.Fatal("got non-matching data") + } +} + +func TestObjectLinks(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`"}]}`)) + if err != nil { + t.Fatal(err) + } + + links, err := api.Object().Links(ctx, p2) + if err != nil { + t.Fatal(err) + } + + if len(links) != 1 { + t.Errorf("unexpected number of links: %d", len(links)) + } + + if links[0].Cid.String() != p1.Cid().String() { + t.Fatal("cids didn't batch") + } + + if links[0].Name != "bar" { + t.Fatal("unexpected link name") + } +} + +func TestObjectStat(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`", "Size":3}]}`)) + if err != nil { + t.Fatal(err) + } + + stat, err := api.Object().Stat(ctx, p2) + if err != nil { + t.Fatal(err) + } + + if stat.Cid.String() != p2.Cid().String() { + t.Error("unexpected stat.Cid") + } + + if stat.NumLinks != 1 { + t.Errorf("unexpected stat.NumLinks") + } + + if stat.BlockSize != 51 { + t.Error("unexpected stat.BlockSize") + } + + if stat.LinksSize != 47 { + t.Errorf("unexpected stat.LinksSize: %d", stat.LinksSize) + } + + if stat.DataSize != 4 { + t.Error("unexpected stat.DataSize") + } + + if stat.CumulativeSize != 54 { + t.Error("unexpected stat.DataSize") + } +} + +func TestObjectAddLink(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`", "Size":3}]}`)) + if err != nil { + t.Fatal(err) + } + + p3, err := api.Object().AddLink(ctx, p2, "abc", p2) + if err != nil { + t.Fatal(err) + } + + links, err := api.Object().Links(ctx, p3) + if err != nil { + t.Fatal(err) + } + + if len(links) != 2 { + t.Errorf("unexpected number of links: %d", len(links)) + } + + if links[0].Name != "abc" { + t.Errorf("unexpected link 0 name: %s", links[0].Name) + } + + if links[1].Name != "bar" { + t.Errorf("unexpected link 1 name: %s", links[1].Name) + } +} + +func TestObjectAddLinkCreate(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`", "Size":3}]}`)) + if err != nil { + t.Fatal(err) + } + + p3, err := api.Object().AddLink(ctx, p2, "abc/d", p2) + if err == nil { + t.Fatal("expected an error") + } + if err.Error() != "no link by that name" { + t.Fatalf("unexpected error: %s", err.Error()) + } + + p3, err = api.Object().AddLink(ctx, p2, "abc/d", p2, opt.Object.Create(true)) + if err != nil { + t.Fatal(err) + } + + links, err := api.Object().Links(ctx, p3) + if err != nil { + t.Fatal(err) + } + + if len(links) != 2 { + t.Errorf("unexpected number of links: %d", len(links)) + } + + if links[0].Name != "abc" { + t.Errorf("unexpected link 0 name: %s", links[0].Name) + } + + if links[1].Name != "bar" { + t.Errorf("unexpected link 1 name: %s", links[1].Name) + } +} + +func TestObjectRmLink(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`", "Size":3}]}`)) + if err != nil { + t.Fatal(err) + } + + p3, err := api.Object().RmLink(ctx, p2, "bar") + if err != nil { + t.Fatal(err) + } + + links, err := api.Object().Links(ctx, p3) + if err != nil { + t.Fatal(err) + } + + if len(links) != 0 { + t.Errorf("unexpected number of links: %d", len(links)) + } +} + +func TestObjectAddData(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().AppendData(ctx, p1, strings.NewReader("bar")) + if err != nil { + t.Fatal(err) + } + + r, err := api.Object().Data(ctx, p2) + if err != nil { + t.Fatal(err) + } + + data, err := ioutil.ReadAll(r) + + if string(data) != "foobar" { + t.Error("unexpected data") + } +} + +func TestObjectSetData(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().SetData(ctx, p1, strings.NewReader("bar")) + if err != nil { + t.Fatal(err) + } + + r, err := api.Object().Data(ctx, p2) + if err != nil { + t.Fatal(err) + } + + data, err := ioutil.ReadAll(r) + + if string(data) != "bar" { + t.Error("unexpected data") + } +} + +func TestDiffTest(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + p1, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"foo"}`)) + if err != nil { + t.Fatal(err) + } + + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bar"}`)) + if err != nil { + t.Fatal(err) + } + + changes, err := api.Object().Diff(ctx, p1, p2) + if err != nil { + t.Fatal(err) + } + + if len(changes) != 1 { + t.Fatal("unexpected changes len") + } + + if changes[0].Type != iface.DiffMod { + t.Fatal("unexpected change type") + } + + if changes[0].Before.String() != p1.String() { + t.Fatal("unexpected before path") + } + + if changes[0].After.String() != p2.String() { + t.Fatal("unexpected before path") + } +} diff --git a/core/coreiface/tests/path_test.go b/core/coreiface/tests/path_test.go new file mode 100644 index 00000000000..e054280733f --- /dev/null +++ b/core/coreiface/tests/path_test.go @@ -0,0 +1,154 @@ +package tests_test + +import ( + "context" + "strings" + "testing" + + coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" + "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +func TestMutablePath(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + // get self /ipns path + keys, err := api.Key().List(ctx) + if err != nil { + t.Fatal(err) + } + + if !keys[0].Path().Mutable() { + t.Error("expected self /ipns path to be mutable") + } + + blk, err := api.Block().Put(ctx, strings.NewReader(`foo`)) + if err != nil { + t.Error(err) + } + + if blk.Path().Mutable() { + t.Error("expected /ipld path to be immutable") + } +} + +func TestPathRemainder(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) + if err != nil { + t.Fatal(err) + } + + p1, err := coreiface.ParsePath(obj.String() + "/foo/bar") + if err != nil { + t.Error(err) + } + + rp1, err := api.ResolvePath(ctx, p1) + if err != nil { + t.Fatal(err) + } + + if rp1.Remainder() != "foo/bar" { + t.Error("expected to get path remainder") + } +} + +func TestEmptyPathRemainder(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) + if err != nil { + t.Fatal(err) + } + + if obj.Remainder() != "" { + t.Error("expected the resolved path to not have a remainder") + } + + p1, err := coreiface.ParsePath(obj.String()) + if err != nil { + t.Error(err) + } + + rp1, err := api.ResolvePath(ctx, p1) + if err != nil { + t.Fatal(err) + } + + if rp1.Remainder() != "" { + t.Error("expected the resolved path to not have a remainder") + } +} + +func TestInvalidPathRemainder(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) + if err != nil { + t.Fatal(err) + } + + p1, err := coreiface.ParsePath(obj.String() + "/bar/baz") + if err != nil { + t.Error(err) + } + + _, err = api.ResolvePath(ctx, p1) + if err == nil || err.Error() != "no such link found" { + t.Fatalf("unexpected error: %s", err) + } +} + +func TestPathRoot(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + blk, err := api.Block().Put(ctx, strings.NewReader(`foo`), options.Block.Format("raw")) + if err != nil { + t.Error(err) + } + + obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"/": "`+blk.Path().Cid().String()+`"}}`)) + if err != nil { + t.Fatal(err) + } + + p1, err := coreiface.ParsePath(obj.String() + "/foo") + if err != nil { + t.Error(err) + } + + rp, err := api.ResolvePath(ctx, p1) + if err != nil { + t.Fatal(err) + } + + if rp.Root().String() != obj.Cid().String() { + t.Error("unexpected path root") + } + + if rp.Cid().String() != blk.Path().Cid().String() { + t.Error("unexpected path cid") + } +} diff --git a/core/coreiface/tests/pin_test.go b/core/coreiface/tests/pin_test.go new file mode 100644 index 00000000000..5c4b82bc257 --- /dev/null +++ b/core/coreiface/tests/pin_test.go @@ -0,0 +1,214 @@ +package tests_test + +import ( + "context" + "strings" + "testing" + + opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" +) + +func TestPinAdd(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + p, err := api.Unixfs().Add(ctx, strFile("foo")()) + if err != nil { + t.Error(err) + } + + err = api.Pin().Add(ctx, p) + if err != nil { + t.Error(err) + } +} + +func TestPinSimple(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + p, err := api.Unixfs().Add(ctx, strFile("foo")()) + if err != nil { + t.Error(err) + } + + err = api.Pin().Add(ctx, p) + if err != nil { + t.Error(err) + } + + list, err := api.Pin().Ls(ctx) + if err != nil { + t.Fatal(err) + } + + if len(list) != 1 { + t.Errorf("unexpected pin list len: %d", len(list)) + } + + if list[0].Path().Cid().String() != p.Cid().String() { + t.Error("paths don't match") + } + + if list[0].Type() != "recursive" { + t.Error("unexpected pin type") + } + + err = api.Pin().Rm(ctx, p) + if err != nil { + t.Fatal(err) + } + + list, err = api.Pin().Ls(ctx) + if err != nil { + t.Fatal(err) + } + + if len(list) != 0 { + t.Errorf("unexpected pin list len: %d", len(list)) + } +} + +func TestPinRecursive(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + p0, err := api.Unixfs().Add(ctx, strFile("foo")()) + if err != nil { + t.Error(err) + } + + p1, err := api.Unixfs().Add(ctx, strFile("bar")()) + if err != nil { + t.Error(err) + } + + p2, err := api.Dag().Put(ctx, strings.NewReader(`{"lnk": {"/": "`+p0.Cid().String()+`"}}`)) + if err != nil { + t.Error(err) + } + + p3, err := api.Dag().Put(ctx, strings.NewReader(`{"lnk": {"/": "`+p1.Cid().String()+`"}}`)) + if err != nil { + t.Error(err) + } + + err = api.Pin().Add(ctx, p2) + if err != nil { + t.Error(err) + } + + err = api.Pin().Add(ctx, p3, opt.Pin.Recursive(false)) + if err != nil { + t.Error(err) + } + + list, err := api.Pin().Ls(ctx) + if err != nil { + t.Fatal(err) + } + + if len(list) != 3 { + t.Errorf("unexpected pin list len: %d", len(list)) + } + + list, err = api.Pin().Ls(ctx, opt.Pin.Type.Direct()) + if err != nil { + t.Fatal(err) + } + + if len(list) != 1 { + t.Errorf("unexpected pin list len: %d", len(list)) + } + + if list[0].Path().String() != p3.String() { + t.Error("unexpected path") + } + + list, err = api.Pin().Ls(ctx, opt.Pin.Type.Recursive()) + if err != nil { + t.Fatal(err) + } + + if len(list) != 1 { + t.Errorf("unexpected pin list len: %d", len(list)) + } + + if list[0].Path().String() != p2.String() { + t.Error("unexpected path") + } + + list, err = api.Pin().Ls(ctx, opt.Pin.Type.Indirect()) + if err != nil { + t.Fatal(err) + } + + if len(list) != 1 { + t.Errorf("unexpected pin list len: %d", len(list)) + } + + if list[0].Path().Cid().String() != p0.Cid().String() { + t.Error("unexpected path") + } + + res, err := api.Pin().Verify(ctx) + if err != nil { + t.Fatal(err) + } + n := 0 + for r := range res { + if !r.Ok() { + t.Error("expected pin to be ok") + } + n++ + } + + if n != 1 { + t.Errorf("unexpected verify result count: %d", n) + } + + //TODO: figure out a way to test verify without touching IpfsNode + /* + err = api.Block().Rm(ctx, p0, opt.Block.Force(true)) + if err != nil { + t.Fatal(err) + } + + res, err = api.Pin().Verify(ctx) + if err != nil { + t.Fatal(err) + } + n = 0 + for r := range res { + if r.Ok() { + t.Error("expected pin to not be ok") + } + + if len(r.BadNodes()) != 1 { + t.Fatalf("unexpected badNodes len") + } + + if r.BadNodes()[0].Path().Cid().String() != p0.Cid().String() { + t.Error("unexpected badNode path") + } + + if r.BadNodes()[0].Err().Error() != "merkledag: not found" { + t.Errorf("unexpected badNode error: %s", r.BadNodes()[0].Err().Error()) + } + n++ + } + + if n != 1 { + t.Errorf("unexpected verify result count: %d", n) + } + */ +} diff --git a/core/coreiface/tests/pubsub_test.go b/core/coreiface/tests/pubsub_test.go new file mode 100644 index 00000000000..19a1eba5213 --- /dev/null +++ b/core/coreiface/tests/pubsub_test.go @@ -0,0 +1,106 @@ +package tests_test + +import ( + "context" + "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "testing" + "time" +) + +func TestBasicPubSub(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + apis, err := makeAPISwarm(ctx, true, 2) + if err != nil { + t.Fatal(err) + } + + sub, err := apis[0].PubSub().Subscribe(ctx, "testch") + if err != nil { + t.Fatal(err) + } + + go func() { + tick := time.Tick(100 * time.Millisecond) + + for { + err = apis[1].PubSub().Publish(ctx, "testch", []byte("hello world")) + if err != nil { + t.Fatal(err) + } + select { + case <-tick: + case <-ctx.Done(): + return + } + } + }() + + m, err := sub.Next(ctx) + if err != nil { + t.Fatal(err) + } + + if string(m.Data()) != "hello world" { + t.Errorf("got invalid data: %s", string(m.Data())) + } + + self1, err := apis[1].Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if m.From() != self1.ID() { + t.Errorf("m.From didn't match") + } + + peers, err := apis[1].PubSub().Peers(ctx, options.PubSub.Topic("testch")) + if err != nil { + t.Fatal(err) + } + + if len(peers) != 1 { + t.Fatalf("got incorrect number of peers: %d", len(peers)) + } + + self0, err := apis[0].Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + + if peers[0] != self0.ID() { + t.Errorf("peer didn't match") + } + + peers, err = apis[1].PubSub().Peers(ctx, options.PubSub.Topic("nottestch")) + if err != nil { + t.Fatal(err) + } + + if len(peers) != 0 { + t.Fatalf("got incorrect number of peers: %d", len(peers)) + } + + topics, err := apis[0].PubSub().Ls(ctx) + if err != nil { + t.Fatal(err) + } + + if len(topics) != 1 { + t.Fatalf("got incorrect number of topics: %d", len(peers)) + } + + if topics[0] != "testch" { + t.Errorf("topic didn't match") + } + + topics, err = apis[1].PubSub().Ls(ctx) + if err != nil { + t.Fatal(err) + } + + if len(topics) != 0 { + t.Fatalf("got incorrect number of topics: %d", len(peers)) + } +} diff --git a/core/coreiface/tests/unixfs_test.go b/core/coreiface/tests/unixfs_test.go new file mode 100644 index 00000000000..d7ddae96336 --- /dev/null +++ b/core/coreiface/tests/unixfs_test.go @@ -0,0 +1,963 @@ +package tests_test + +import ( + "bytes" + "context" + "encoding/base64" + "fmt" + "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" + "io" + "io/ioutil" + "math" + "os" + "strconv" + "strings" + "sync" + "testing" + + "github.com/ipfs/go-ipfs/core" + "github.com/ipfs/go-ipfs/core/coreapi" + coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" + "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + mock "github.com/ipfs/go-ipfs/core/mock" + "github.com/ipfs/go-ipfs/keystore" + "github.com/ipfs/go-ipfs/repo" + + ci "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto" + "gx/ipfs/QmRBaUEQEeFWywfrZJ64QgsmvcqgLSK3VbvGMR2NM2Edpf/go-libp2p/p2p/net/mock" + cbor "gx/ipfs/QmRoARq3nkUb13HSKZGepCZSWe5GrVPwx7xURJGZ7KWv9V/go-ipld-cbor" + "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" + "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" + pstore "gx/ipfs/QmZ9zH2FnLcxv1xyzFeUpDUeo55xEhZQHgveZijcxr7TLj/go-libp2p-peerstore" + "gx/ipfs/Qmbvw7kpSM2p6rbQ57WGRhhqNfCiNGW6EKH4xgHLw4bsnB/go-unixfs" + "gx/ipfs/QmcZfkbgwwwH5ZLTQRHkSQBDiDqd3skY2eU6MZRgWuXcse/go-ipfs-config" + mdag "gx/ipfs/QmdV35UHnL1FM52baPkeUo6u7Fxm2CRUkPTLRPxeF8a4Ap/go-merkledag" + mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" + "gx/ipfs/Qmf4xQhNomPNhrtZc67qSnfJSjxjXs9LWvknJtSXwimPrM/go-datastore" + syncds "gx/ipfs/Qmf4xQhNomPNhrtZc67qSnfJSjxjXs9LWvknJtSXwimPrM/go-datastore/sync" +) + +const testPeerID = "QmTFauExutTsy4XP6JbMFcw2Wa9645HJt2bTqL6qYDCKfe" + +// `echo -n 'hello, world!' | ipfs add` +var hello = "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" +var helloStr = "hello, world!" + +// `echo -n | ipfs add` +var emptyFile = "/ipfs/QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" + +func makeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { + mn := mocknet.New(ctx) + + nodes := make([]*core.IpfsNode, n) + apis := make([]coreiface.CoreAPI, n) + + for i := 0; i < n; i++ { + var ident config.Identity + if fullIdentity { + sk, pk, err := ci.GenerateKeyPair(ci.RSA, 512) + if err != nil { + return nil, err + } + + id, err := peer.IDFromPublicKey(pk) + if err != nil { + return nil, err + } + + kbytes, err := sk.Bytes() + if err != nil { + return nil, err + } + + ident = config.Identity{ + PeerID: id.Pretty(), + PrivKey: base64.StdEncoding.EncodeToString(kbytes), + } + } else { + ident = config.Identity{ + PeerID: testPeerID, + } + } + + c := config.Config{} + c.Addresses.Swarm = []string{fmt.Sprintf("/ip4/127.0.%d.1/tcp/4001", i)} + c.Identity = ident + + r := &repo.Mock{ + C: c, + D: syncds.MutexWrap(datastore.NewMapDatastore()), + K: keystore.NewMemKeystore(), + } + + node, err := core.NewNode(ctx, &core.BuildCfg{ + Repo: r, + Host: mock.MockHostOption(mn), + Online: fullIdentity, + ExtraOpts: map[string]bool{ + "pubsub": true, + }, + }) + if err != nil { + return nil, err + } + nodes[i] = node + apis[i], err = coreapi.NewCoreAPI(node) + if err != nil { + return nil, err + } + } + + err := mn.LinkAll() + if err != nil { + return nil, err + } + + bsinf := core.BootstrapConfigWithPeers( + []pstore.PeerInfo{ + nodes[0].Peerstore.PeerInfo(nodes[0].Identity), + }, + ) + + for _, n := range nodes[1:] { + if err := n.Bootstrap(bsinf); err != nil { + return nil, err + } + } + + return apis, nil +} + +func makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { + api, err := makeAPISwarm(ctx, false, 1) + if err != nil { + return nil, err + } + + return api[0], nil +} + +func strFile(data string) func() files.Node { + return func() files.Node { + return files.NewBytesFile([]byte(data)) + } +} + +func twoLevelDir() func() files.Node { + return func() files.Node { + return files.NewMapDirectory(map[string]files.Node{ + "abc": files.NewMapDirectory(map[string]files.Node{ + "def": files.NewBytesFile([]byte("world")), + }), + + "bar": files.NewBytesFile([]byte("hello2")), + "foo": files.NewBytesFile([]byte("hello1")), + }) + } +} + +func flatDir() files.Node { + return files.NewMapDirectory(map[string]files.Node{ + "bar": files.NewBytesFile([]byte("hello2")), + "foo": files.NewBytesFile([]byte("hello1")), + }) +} + +func wrapped(name string) func(f files.Node) files.Node { + return func(f files.Node) files.Node { + return files.NewMapDirectory(map[string]files.Node{ + name: f, + }) + } +} + +func TestAdd(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + p := func(h string) coreiface.ResolvedPath { + c, err := cid.Parse(h) + if err != nil { + t.Fatal(err) + } + return coreiface.IpfsPath(c) + } + + cases := []struct { + name string + data func() files.Node + expect func(files.Node) files.Node + + apiOpts []options.ApiOption + + path string + err string + + wrap string + + events []coreiface.AddEvent + + opts []options.UnixfsAddOption + }{ + // Simple cases + { + name: "simpleAdd", + data: strFile(helloStr), + path: hello, + opts: []options.UnixfsAddOption{}, + }, + { + name: "addEmpty", + data: strFile(""), + path: emptyFile, + }, + // CIDv1 version / rawLeaves + { + name: "addCidV1", + data: strFile(helloStr), + path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + opts: []options.UnixfsAddOption{options.Unixfs.CidVersion(1)}, + }, + { + name: "addCidV1NoLeaves", + data: strFile(helloStr), + path: "/ipfs/zdj7WY4GbN8NDbTW1dfCShAQNVovams2xhq9hVCx5vXcjvT8g", + opts: []options.UnixfsAddOption{options.Unixfs.CidVersion(1), options.Unixfs.RawLeaves(false)}, + }, + // Non sha256 hash vs CID + { + name: "addCidSha3", + data: strFile(helloStr), + path: "/ipfs/zb2wwnYtXBxpndNABjtYxWAPt3cwWNRnc11iT63fvkYV78iRb", + opts: []options.UnixfsAddOption{options.Unixfs.Hash(mh.SHA3_256)}, + }, + { + name: "addCidSha3Cid0", + data: strFile(helloStr), + err: "CIDv0 only supports sha2-256", + opts: []options.UnixfsAddOption{options.Unixfs.CidVersion(0), options.Unixfs.Hash(mh.SHA3_256)}, + }, + // Inline + { + name: "addInline", + data: strFile(helloStr), + path: "/ipfs/zaYomJdLndMku8P9LHngHB5w2CQ7NenLbv", + opts: []options.UnixfsAddOption{options.Unixfs.Inline(true)}, + }, + { + name: "addInlineLimit", + data: strFile(helloStr), + path: "/ipfs/zaYomJdLndMku8P9LHngHB5w2CQ7NenLbv", + opts: []options.UnixfsAddOption{options.Unixfs.InlineLimit(32), options.Unixfs.Inline(true)}, + }, + { + name: "addInlineZero", + data: strFile(""), + path: "/ipfs/z2yYDV", + opts: []options.UnixfsAddOption{options.Unixfs.InlineLimit(0), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true)}, + }, + { //TODO: after coreapi add is used in `ipfs add`, consider making this default for inline + name: "addInlineRaw", + data: strFile(helloStr), + path: "/ipfs/zj7Gr8AcBreqGEfrnR5kPFe", + opts: []options.UnixfsAddOption{options.Unixfs.InlineLimit(32), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true)}, + }, + // Chunker / Layout + { + name: "addChunks", + data: strFile(strings.Repeat("aoeuidhtns", 200)), + path: "/ipfs/QmRo11d4QJrST47aaiGVJYwPhoNA4ihRpJ5WaxBWjWDwbX", + opts: []options.UnixfsAddOption{options.Unixfs.Chunker("size-4")}, + }, + { + name: "addChunksTrickle", + data: strFile(strings.Repeat("aoeuidhtns", 200)), + path: "/ipfs/QmNNhDGttafX3M1wKWixGre6PrLFGjnoPEDXjBYpTv93HP", + opts: []options.UnixfsAddOption{options.Unixfs.Chunker("size-4"), options.Unixfs.Layout(options.TrickleLayout)}, + }, + // Local + { + name: "addLocal", // better cases in sharness + data: strFile(helloStr), + path: hello, + apiOpts: []options.ApiOption{options.Api.Offline(true)}, + }, + { + name: "hashOnly", // test (non)fetchability + data: strFile(helloStr), + path: hello, + opts: []options.UnixfsAddOption{options.Unixfs.HashOnly(true)}, + }, + // multi file + { + name: "simpleDir", + data: flatDir, + wrap: "t", + path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp", + }, + { + name: "twoLevelDir", + data: twoLevelDir(), + wrap: "t", + path: "/ipfs/QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr", + }, + // wrapped + { + name: "addWrapped", + path: "/ipfs/QmVE9rNpj5doj7XHzp5zMUxD7BJgXEqx4pe3xZ3JBReWHE", + data: func() files.Node { + return files.NewBytesFile([]byte(helloStr)) + }, + wrap: "foo", + expect: wrapped("foo"), + opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, + }, + { + name: "addNotWrappedDirFile", + path: hello, + data: func() files.Node { + return files.NewBytesFile([]byte(helloStr)) + }, + wrap: "foo", + }, + { + name: "stdinWrapped", + path: "/ipfs/QmU3r81oZycjHS9oaSHw37ootMFuFUw1DvMLKXPsezdtqU", + data: func() files.Node { + return files.NewBytesFile([]byte(helloStr)) + }, + expect: func(files.Node) files.Node { + return files.NewMapDirectory(map[string]files.Node{ + "QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk": files.NewBytesFile([]byte(helloStr)), + }) + }, + opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, + }, + { + name: "stdinNamed", + path: "/ipfs/QmQ6cGBmb3ZbdrQW1MRm1RJnYnaxCqfssz7CrTa9NEhQyS", + data: func() files.Node { + rf, err := files.NewReaderPathFile(os.Stdin.Name(), ioutil.NopCloser(strings.NewReader(helloStr)), nil) + if err != nil { + panic(err) + } + + return rf + }, + expect: func(files.Node) files.Node { + return files.NewMapDirectory(map[string]files.Node{ + "test": files.NewBytesFile([]byte(helloStr)), + }) + }, + opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true), options.Unixfs.StdinName("test")}, + }, + { + name: "twoLevelDirWrapped", + data: twoLevelDir(), + wrap: "t", + expect: wrapped("t"), + path: "/ipfs/QmPwsL3T5sWhDmmAWZHAzyjKtMVDS9a11aHNRqb3xoVnmg", + opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, + }, + { + name: "twoLevelInlineHash", + data: twoLevelDir(), + wrap: "t", + expect: wrapped("t"), + path: "/ipfs/zBunoruKoyCHKkALNSWxDvj4L7yuQnMgQ4hUa9j1Z64tVcDEcu6Zdetyu7eeFCxMPfxb7YJvHeFHoFoHMkBUQf6vfdhmi", + opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true), options.Unixfs.Hash(mh.SHA3)}, + }, + // hidden + { + name: "hiddenFiles", + data: func() files.Node { + return files.NewMapDirectory(map[string]files.Node{ + ".bar": files.NewBytesFile([]byte("hello2")), + "bar": files.NewBytesFile([]byte("hello2")), + "foo": files.NewBytesFile([]byte("hello1")), + }) + }, + wrap: "t", + path: "/ipfs/QmehGvpf2hY196MzDFmjL8Wy27S4jbgGDUAhBJyvXAwr3g", + opts: []options.UnixfsAddOption{options.Unixfs.Hidden(true)}, + }, + { + name: "hiddenFileAlwaysAdded", + data: func() files.Node { + return files.NewBytesFile([]byte(helloStr)) + }, + wrap: ".foo", + path: hello, + }, + { + name: "hiddenFilesNotAdded", + data: func() files.Node { + return files.NewMapDirectory(map[string]files.Node{ + ".bar": files.NewBytesFile([]byte("hello2")), + "bar": files.NewBytesFile([]byte("hello2")), + "foo": files.NewBytesFile([]byte("hello1")), + }) + }, + expect: func(files.Node) files.Node { + return flatDir() + }, + wrap: "t", + path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp", + opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)}, + }, + // Events / Progress + { + name: "simpleAddEvent", + data: strFile(helloStr), + path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + events: []coreiface.AddEvent{ + {Name: "zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", Path: p("zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd"), Size: strconv.Itoa(len(helloStr))}, + }, + opts: []options.UnixfsAddOption{options.Unixfs.RawLeaves(true)}, + }, + { + name: "silentAddEvent", + data: twoLevelDir(), + path: "/ipfs/QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr", + events: []coreiface.AddEvent{ + {Name: "t/abc", Path: p("QmU7nuGs2djqK99UNsNgEPGh6GV4662p6WtsgccBNGTDxt"), Size: "62"}, + {Name: "t", Path: p("QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr"), Size: "229"}, + }, + wrap: "t", + opts: []options.UnixfsAddOption{options.Unixfs.Silent(true)}, + }, + { + name: "dirAddEvents", + data: twoLevelDir(), + path: "/ipfs/QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr", + events: []coreiface.AddEvent{ + {Name: "t/abc/def", Path: p("QmNyJpQkU1cEkBwMDhDNFstr42q55mqG5GE5Mgwug4xyGk"), Size: "13"}, + {Name: "t/bar", Path: p("QmS21GuXiRMvJKHos4ZkEmQDmRBqRaF5tQS2CQCu2ne9sY"), Size: "14"}, + {Name: "t/foo", Path: p("QmfAjGiVpTN56TXi6SBQtstit5BEw3sijKj1Qkxn6EXKzJ"), Size: "14"}, + {Name: "t/abc", Path: p("QmU7nuGs2djqK99UNsNgEPGh6GV4662p6WtsgccBNGTDxt"), Size: "62"}, + {Name: "t", Path: p("QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr"), Size: "229"}, + }, + wrap: "t", + }, + { + name: "progress1M", + data: func() files.Node { + return files.NewReaderFile(bytes.NewReader(bytes.Repeat([]byte{0}, 1000000))) + }, + path: "/ipfs/QmXXNNbwe4zzpdMg62ZXvnX1oU7MwSrQ3vAEtuwFKCm1oD", + events: []coreiface.AddEvent{ + {Name: "", Bytes: 262144}, + {Name: "", Bytes: 524288}, + {Name: "", Bytes: 786432}, + {Name: "", Bytes: 1000000}, + {Name: "QmXXNNbwe4zzpdMg62ZXvnX1oU7MwSrQ3vAEtuwFKCm1oD", Path: p("QmXXNNbwe4zzpdMg62ZXvnX1oU7MwSrQ3vAEtuwFKCm1oD"), Size: "1000256"}, + }, + wrap: "", + opts: []options.UnixfsAddOption{options.Unixfs.Progress(true)}, + }, + } + + for _, testCase := range cases { + t.Run(testCase.name, func(t *testing.T) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + // recursive logic + + data := testCase.data() + if testCase.wrap != "" { + data = files.NewMapDirectory(map[string]files.Node{ + testCase.wrap: data, + }) + } + + // handle events if relevant to test case + + opts := testCase.opts + eventOut := make(chan interface{}) + var evtWg sync.WaitGroup + if len(testCase.events) > 0 { + opts = append(opts, options.Unixfs.Events(eventOut)) + evtWg.Add(1) + + go func() { + defer evtWg.Done() + expected := testCase.events + + for evt := range eventOut { + event, ok := evt.(*coreiface.AddEvent) + if !ok { + t.Fatal("unexpected event type") + } + + if len(expected) < 1 { + t.Fatal("got more events than expected") + } + + if expected[0].Size != event.Size { + t.Errorf("Event.Size didn't match, %s != %s", expected[0].Size, event.Size) + } + + if expected[0].Name != event.Name { + t.Errorf("Event.Name didn't match, %s != %s", expected[0].Name, event.Name) + } + + if expected[0].Path != nil && event.Path != nil { + if expected[0].Path.Cid().String() != event.Path.Cid().String() { + t.Errorf("Event.Hash didn't match, %s != %s", expected[0].Path, event.Path) + } + } else if event.Path != expected[0].Path { + t.Errorf("Event.Hash didn't match, %s != %s", expected[0].Path, event.Path) + } + if expected[0].Bytes != event.Bytes { + t.Errorf("Event.Bytes didn't match, %d != %d", expected[0].Bytes, event.Bytes) + } + + expected = expected[1:] + } + + if len(expected) > 0 { + t.Fatalf("%d event(s) didn't arrive", len(expected)) + } + }() + } + + tapi, err := api.WithOptions(testCase.apiOpts...) + if err != nil { + t.Fatal(err) + } + + // Add! + + p, err := tapi.Unixfs().Add(ctx, data, opts...) + close(eventOut) + evtWg.Wait() + if testCase.err != "" { + if err == nil { + t.Fatalf("expected an error: %s", testCase.err) + } + if err.Error() != testCase.err { + t.Fatalf("expected an error: '%s' != '%s'", err.Error(), testCase.err) + } + return + } + if err != nil { + t.Fatal(err) + } + + if p.String() != testCase.path { + t.Errorf("expected path %s, got: %s", testCase.path, p) + } + + // compare file structure with Unixfs().Get + + var cmpFile func(origName string, orig files.Node, gotName string, got files.Node) + cmpFile = func(origName string, orig files.Node, gotName string, got files.Node) { + _, origDir := orig.(files.Directory) + _, gotDir := got.(files.Directory) + + if origDir != gotDir { + t.Fatal("file type mismatch") + } + + if origName != gotName { + t.Errorf("file name mismatch, orig='%s', got='%s'", origName, gotName) + } + + if !gotDir { + defer orig.Close() + defer got.Close() + + do, err := ioutil.ReadAll(orig.(files.File)) + if err != nil { + t.Fatal(err) + } + + dg, err := ioutil.ReadAll(got.(files.File)) + if err != nil { + t.Fatal(err) + } + + if !bytes.Equal(do, dg) { + t.Fatal("data not equal") + } + + return + } + + origIt := orig.(files.Directory).Entries() + gotIt := got.(files.Directory).Entries() + + for { + if origIt.Next() { + if !gotIt.Next() { + t.Fatal("gotIt out of entries before origIt") + } + } else { + if gotIt.Next() { + t.Fatal("origIt out of entries before gotIt") + } + break + } + + cmpFile(origIt.Name(), origIt.Node(), gotIt.Name(), gotIt.Node()) + } + if origIt.Err() != nil { + t.Fatal(origIt.Err()) + } + if gotIt.Err() != nil { + t.Fatal(gotIt.Err()) + } + } + + f, err := tapi.Unixfs().Get(ctx, p) + if err != nil { + t.Fatal(err) + } + + orig := testCase.data() + if testCase.expect != nil { + orig = testCase.expect(orig) + } + + cmpFile("", orig, "", f) + }) + } +} + +func TestAddPinned(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Unixfs().Add(ctx, strFile(helloStr)(), options.Unixfs.Pin(true)) + if err != nil { + t.Error(err) + } + + pins, err := api.Pin().Ls(ctx) + if len(pins) != 1 { + t.Fatalf("expected 1 pin, got %d", len(pins)) + } + + if pins[0].Path().String() != "/ipld/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" { + t.Fatalf("got unexpected pin: %s", pins[0].Path().String()) + } +} + +func TestAddHashOnly(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + p, err := api.Unixfs().Add(ctx, strFile(helloStr)(), options.Unixfs.HashOnly(true)) + if err != nil { + t.Error(err) + } + + if p.String() != hello { + t.Errorf("unxepected path: %s", p.String()) + } + + _, err = api.Block().Get(ctx, p) + if err == nil { + t.Fatal("expected an error") + } + if err.Error() != "blockservice: key not found" { + t.Errorf("unxepected error: %s", err.Error()) + } +} + +func TestGetEmptyFile(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + _, err = api.Unixfs().Add(ctx, files.NewBytesFile([]byte{})) + if err != nil { + t.Fatal(err) + } + + emptyFilePath, err := coreiface.ParsePath(emptyFile) + if err != nil { + t.Fatal(err) + } + + r, err := api.Unixfs().Get(ctx, emptyFilePath) + if err != nil { + t.Fatal(err) + } + + buf := make([]byte, 1) // non-zero so that Read() actually tries to read + n, err := io.ReadFull(r.(files.File), buf) + if err != nil && err != io.EOF { + t.Error(err) + } + if !bytes.HasPrefix(buf, []byte{0x00}) { + t.Fatalf("expected empty data, got [%s] [read=%d]", buf, n) + } +} + +func TestGetDir(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + edir := unixfs.EmptyDirNode() + _, err = api.Dag().Put(ctx, bytes.NewReader(edir.RawData()), options.Dag.Codec(cid.DagProtobuf), options.Dag.InputEnc("raw")) + if err != nil { + t.Error(err) + } + p := coreiface.IpfsPath(edir.Cid()) + + emptyDir, err := api.Object().New(ctx, options.Object.Type("unixfs-dir")) + if err != nil { + t.Error(err) + } + + if p.String() != coreiface.IpfsPath(emptyDir.Cid()).String() { + t.Fatalf("expected path %s, got: %s", emptyDir.Cid(), p.String()) + } + + r, err := api.Unixfs().Get(ctx, coreiface.IpfsPath(emptyDir.Cid())) + if err != nil { + t.Error(err) + } + + if _, ok := r.(files.Directory); !ok { + t.Fatalf("expected a directory") + } +} + +func TestGetNonUnixfs(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + nd := new(mdag.ProtoNode) + _, err = api.Dag().Put(ctx, bytes.NewReader(nd.RawData()), options.Dag.Codec(nd.CidBuilder().GetCodec()), options.Dag.InputEnc("raw")) + if err != nil { + t.Error(err) + } + + _, err = api.Unixfs().Get(ctx, coreiface.IpfsPath(nd.Cid())) + if !strings.Contains(err.Error(), "proto: required field") { + t.Fatalf("expected protobuf error, got: %s", err) + } +} + +func TestLs(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + r := strings.NewReader("content-of-file") + p, err := api.Unixfs().Add(ctx, files.NewMapDirectory(map[string]files.Node{ + "0": files.NewMapDirectory(map[string]files.Node{ + "name-of-file": files.NewReaderFile(r), + }), + })) + if err != nil { + t.Error(err) + } + + links, err := api.Unixfs().Ls(ctx, p) + if err != nil { + t.Error(err) + } + + if len(links) != 1 { + t.Fatalf("expected 1 link, got %d", len(links)) + } + if links[0].Size != 23 { + t.Fatalf("expected size = 23, got %d", links[0].Size) + } + if links[0].Name != "name-of-file" { + t.Fatalf("expected name = name-of-file, got %s", links[0].Name) + } + if links[0].Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { + t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", links[0].Cid) + } +} + +func TestEntriesExpired(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + r := strings.NewReader("content-of-file") + p, err := api.Unixfs().Add(ctx, files.NewMapDirectory(map[string]files.Node{ + "0": files.NewMapDirectory(map[string]files.Node{ + "name-of-file": files.NewReaderFile(r), + }), + })) + if err != nil { + t.Error(err) + } + + ctx, cancel := context.WithCancel(ctx) + + nd, err := api.Unixfs().Get(ctx, p) + if err != nil { + t.Error(err) + } + cancel() + + it := files.ToDir(nd).Entries() + if it == nil { + t.Fatal("it was nil") + } + + if it.Next() { + t.Fatal("Next succeeded") + } + + if it.Err() != context.Canceled { + t.Fatalf("unexpected error %s", it.Err()) + } + + if it.Next() { + t.Fatal("Next succeeded") + } +} + +func TestLsEmptyDir(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Unixfs().Add(ctx, files.NewMapDirectory(map[string]files.Node{"0": files.NewSliceDirectory([]files.DirEntry{})})) + if err != nil { + t.Error(err) + } + + emptyDir, err := api.Object().New(ctx, options.Object.Type("unixfs-dir")) + if err != nil { + t.Error(err) + } + + links, err := api.Unixfs().Ls(ctx, coreiface.IpfsPath(emptyDir.Cid())) + if err != nil { + t.Error(err) + } + + if len(links) != 0 { + t.Fatalf("expected 0 links, got %d", len(links)) + } +} + +// TODO(lgierth) this should test properly, with len(links) > 0 +func TestLsNonUnixfs(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + nd, err := cbor.WrapObject(map[string]interface{}{"foo": "bar"}, math.MaxUint64, -1) + if err != nil { + t.Fatal(err) + } + + _, err = api.Dag().Put(ctx, bytes.NewReader(nd.RawData()), options.Dag.Codec(cid.DagCBOR), options.Dag.InputEnc("raw")) + if err != nil { + t.Error(err) + } + + links, err := api.Unixfs().Ls(ctx, coreiface.IpfsPath(nd.Cid())) + if err != nil { + t.Error(err) + } + + if len(links) != 0 { + t.Fatalf("expected 0 links, got %d", len(links)) + } +} + +type closeTestF struct { + files.File + closed bool + + t *testing.T +} + +type closeTestD struct { + files.Directory + closed bool + + t *testing.T +} + +func (f *closeTestD) Close() error { + if f.closed { + f.t.Fatal("already closed") + } + f.closed = true + return nil +} + +func (f *closeTestF) Close() error { + if f.closed { + f.t.Fatal("already closed") + } + f.closed = true + return nil +} + +func TestAddCloses(t *testing.T) { + ctx := context.Background() + api, err := makeAPI(ctx) + if err != nil { + t.Error(err) + } + + n4 := &closeTestF{files.NewBytesFile([]byte("foo")), false, t} + d3 := &closeTestD{files.NewMapDirectory(map[string]files.Node{ + "sub": n4, + }), false, t} + n2 := &closeTestF{files.NewBytesFile([]byte("bar")), false, t} + n1 := &closeTestF{files.NewBytesFile([]byte("baz")), false, t} + d0 := &closeTestD{files.NewMapDirectory(map[string]files.Node{ + "a": d3, + "b": n1, + "c": n2, + }), false, t} + + _, err = api.Unixfs().Add(ctx, d0) + if err != nil { + t.Error(err) + } + + d0.Close() // Adder doesn't close top-level file + + for i, n := range []*closeTestF{n1, n2, n4} { + if !n.closed { + t.Errorf("file %d not closed!", i) + } + } + + for i, n := range []*closeTestD{d0, d3} { + if !n.closed { + t.Errorf("dir %d not closed!", i) + } + } + +} From 373e313822941476f1b96535cab7e822254cad50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Dec 2018 20:11:37 +0100 Subject: [PATCH 159/286] coreapi: run tests from interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@88e58e6b286d55882958c68525d69c4a3dd213b8 This commit was moved from ipfs/boxo@6649a031fab719883b2f507b4191538d61d183bb --- core/coreiface/tests/api.go | 129 ++++++++++++++++++ .../tests/{block_test.go => block.go} | 11 +- core/coreiface/tests/{dag_test.go => dag.go} | 12 +- core/coreiface/tests/{dht_test.go => dht.go} | 8 +- core/coreiface/tests/{key_test.go => key.go} | 19 ++- .../coreiface/tests/{name_test.go => name.go} | 7 +- .../tests/{object_test.go => object.go} | 17 ++- .../coreiface/tests/{path_test.go => path.go} | 10 +- core/coreiface/tests/{pin_test.go => pin.go} | 8 +- .../tests/{pubsub_test.go => pubsub.go} | 6 +- .../tests/{unixfs_test.go => unixfs.go} | 123 +++-------------- 11 files changed, 233 insertions(+), 117 deletions(-) create mode 100644 core/coreiface/tests/api.go rename core/coreiface/tests/{block_test.go => block.go} (92%) rename core/coreiface/tests/{dag_test.go => dag.go} (92%) rename core/coreiface/tests/{dht_test.go => dht.go} (93%) rename core/coreiface/tests/{key_test.go => key.go} (93%) rename core/coreiface/tests/{name_test.go => name.go} (97%) rename core/coreiface/tests/{object_test.go => object.go} (93%) rename core/coreiface/tests/{path_test.go => path.go} (91%) rename core/coreiface/tests/{pin_test.go => pin.go} (95%) rename core/coreiface/tests/{pubsub_test.go => pubsub.go} (95%) rename core/coreiface/tests/{unixfs_test.go => unixfs.go} (89%) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go new file mode 100644 index 00000000000..8baa869dd99 --- /dev/null +++ b/core/coreiface/tests/api.go @@ -0,0 +1,129 @@ +package tests + +import ( + "context" + "encoding/base64" + "fmt" + "testing" + + "github.com/ipfs/go-ipfs/core" + "github.com/ipfs/go-ipfs/core/coreapi" + coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" + mock "github.com/ipfs/go-ipfs/core/mock" + "github.com/ipfs/go-ipfs/keystore" + "github.com/ipfs/go-ipfs/repo" + + ci "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto" + "gx/ipfs/QmRBaUEQEeFWywfrZJ64QgsmvcqgLSK3VbvGMR2NM2Edpf/go-libp2p/p2p/net/mock" + "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" + pstore "gx/ipfs/QmZ9zH2FnLcxv1xyzFeUpDUeo55xEhZQHgveZijcxr7TLj/go-libp2p-peerstore" + "gx/ipfs/QmcZfkbgwwwH5ZLTQRHkSQBDiDqd3skY2eU6MZRgWuXcse/go-ipfs-config" + "gx/ipfs/Qmf4xQhNomPNhrtZc67qSnfJSjxjXs9LWvknJtSXwimPrM/go-datastore" + syncds "gx/ipfs/Qmf4xQhNomPNhrtZc67qSnfJSjxjXs9LWvknJtSXwimPrM/go-datastore/sync" +) + + +func makeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { + mn := mocknet.New(ctx) + + nodes := make([]*core.IpfsNode, n) + apis := make([]coreiface.CoreAPI, n) + + for i := 0; i < n; i++ { + var ident config.Identity + if fullIdentity { + sk, pk, err := ci.GenerateKeyPair(ci.RSA, 512) + if err != nil { + return nil, err + } + + id, err := peer.IDFromPublicKey(pk) + if err != nil { + return nil, err + } + + kbytes, err := sk.Bytes() + if err != nil { + return nil, err + } + + ident = config.Identity{ + PeerID: id.Pretty(), + PrivKey: base64.StdEncoding.EncodeToString(kbytes), + } + } else { + ident = config.Identity{ + PeerID: testPeerID, + } + } + + c := config.Config{} + c.Addresses.Swarm = []string{fmt.Sprintf("/ip4/127.0.%d.1/tcp/4001", i)} + c.Identity = ident + + r := &repo.Mock{ + C: c, + D: syncds.MutexWrap(datastore.NewMapDatastore()), + K: keystore.NewMemKeystore(), + } + + node, err := core.NewNode(ctx, &core.BuildCfg{ + Repo: r, + Host: mock.MockHostOption(mn), + Online: fullIdentity, + ExtraOpts: map[string]bool{ + "pubsub": true, + }, + }) + if err != nil { + return nil, err + } + nodes[i] = node + apis[i], err = coreapi.NewCoreAPI(node) + if err != nil { + return nil, err + } + } + + err := mn.LinkAll() + if err != nil { + return nil, err + } + + bsinf := core.BootstrapConfigWithPeers( + []pstore.PeerInfo{ + nodes[0].Peerstore.PeerInfo(nodes[0].Identity), + }, + ) + + for _, n := range nodes[1:] { + if err := n.Bootstrap(bsinf); err != nil { + return nil, err + } + } + + return apis, nil +} + +func makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { + api, err := makeAPISwarm(ctx, false, 1) + if err != nil { + return nil, err + } + + return api[0], nil +} + + +func TestApi(t *testing.T) { + t.Run("Block", TestBlock) + t.Run("TestDag", TestDag) + t.Run("TestDht", TestDht) + t.Run("TestKey", TestKey) + t.Run("TestName", TestName) + t.Run("TestObject", TestObject) + t.Run("TestPath", TestPath) + t.Run("TestPin", TestPin) + t.Run("TestPubSub", TestPubSub) + t.Run("TestUnixfs", TestUnixfs) +} diff --git a/core/coreiface/tests/block_test.go b/core/coreiface/tests/block.go similarity index 92% rename from core/coreiface/tests/block_test.go rename to core/coreiface/tests/block.go index 81360b150ee..07679a92637 100644 --- a/core/coreiface/tests/block_test.go +++ b/core/coreiface/tests/block.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "context" @@ -12,6 +12,15 @@ import ( mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) +func TestBlock(t *testing.T) { + t.Run("TestBlockPut", TestBlockPut) + t.Run("TestBlockPutFormat", TestBlockPutFormat) + t.Run("TestBlockPutHash", TestBlockPutHash) + t.Run("TestBlockGet", TestBlockGet) + t.Run("TestBlockRm", TestBlockRm) + t.Run("TestBlockStat", TestBlockStat) +} + func TestBlockPut(t *testing.T) { ctx := context.Background() api, err := makeAPI(ctx) diff --git a/core/coreiface/tests/dag_test.go b/core/coreiface/tests/dag.go similarity index 92% rename from core/coreiface/tests/dag_test.go rename to core/coreiface/tests/dag.go index 17059192be5..a75438ab194 100644 --- a/core/coreiface/tests/dag_test.go +++ b/core/coreiface/tests/dag.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "context" @@ -12,6 +12,14 @@ import ( mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) +func TestDag(t *testing.T) { + t.Run("TestPut", TestPut) + t.Run("TestPutWithHash", TestPutWithHash) + t.Run("TestPath", TestDagPath) + t.Run("TestTree", TestTree) + t.Run("TestBatch", TestBatch) +} + var ( treeExpected = map[string]struct{}{ "a": {}, @@ -56,7 +64,7 @@ func TestPutWithHash(t *testing.T) { } } -func TestPath(t *testing.T) { +func TestDagPath(t *testing.T) { ctx := context.Background() api, err := makeAPI(ctx) if err != nil { diff --git a/core/coreiface/tests/dht_test.go b/core/coreiface/tests/dht.go similarity index 93% rename from core/coreiface/tests/dht_test.go rename to core/coreiface/tests/dht.go index be16bb08395..429197f7033 100644 --- a/core/coreiface/tests/dht_test.go +++ b/core/coreiface/tests/dht.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "context" @@ -8,6 +8,12 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) +func TestDht(t *testing.T) { + t.Run("TestDhtFindPeer", TestDhtFindPeer) + t.Run("TestDhtFindProviders", TestDhtFindProviders) + t.Run("TestDhtProvide", TestDhtProvide) +} + func TestDhtFindPeer(t *testing.T) { ctx := context.Background() apis, err := makeAPISwarm(ctx, true, 5) diff --git a/core/coreiface/tests/key_test.go b/core/coreiface/tests/key.go similarity index 93% rename from core/coreiface/tests/key_test.go rename to core/coreiface/tests/key.go index 21884e448de..b08f56a4fd4 100644 --- a/core/coreiface/tests/key_test.go +++ b/core/coreiface/tests/key.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "context" @@ -8,6 +8,23 @@ import ( opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) +func TestKey(t *testing.T) { + t.Run("TestListSelf", TestListSelf) + t.Run("TestRenameSelf", TestRenameSelf) + t.Run("TestRemoveSelf", TestRemoveSelf) + t.Run("TestGenerateSize", TestGenerateSize) + t.Run("TestGenerateExisting", TestGenerateExisting) + t.Run("TestList", TestList) + t.Run("TestRename", TestRename) + t.Run("TestRenameToSelf", TestRenameToSelf) + t.Run("TestRenameToSelfForce", TestRenameToSelfForce) + t.Run("TestRenameOverwriteNoForce", TestRenameOverwriteNoForce) + t.Run("TestRenameOverwrite", TestRenameOverwrite) + t.Run("TestRenameSameNameNoForce", TestRenameSameNameNoForce) + t.Run("TestRenameSameName", TestRenameSameName) + t.Run("TestRemove", TestRemove) +} + func TestListSelf(t *testing.T) { ctx := context.Background() api, err := makeAPI(ctx) diff --git a/core/coreiface/tests/name_test.go b/core/coreiface/tests/name.go similarity index 97% rename from core/coreiface/tests/name_test.go rename to core/coreiface/tests/name.go index a3514e05134..154c1d44480 100644 --- a/core/coreiface/tests/name_test.go +++ b/core/coreiface/tests/name.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "context" @@ -15,6 +15,11 @@ import ( opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) +func TestName(t *testing.T) { + t.Run("TestPublishResolve", TestPublishResolve) + t.Run("TestBasicPublishResolveKey", TestBasicPublishResolveKey) +} + var rnd = rand.New(rand.NewSource(0x62796532303137)) func addTestObject(ctx context.Context, api coreiface.CoreAPI) (coreiface.Path, error) { diff --git a/core/coreiface/tests/object_test.go b/core/coreiface/tests/object.go similarity index 93% rename from core/coreiface/tests/object_test.go rename to core/coreiface/tests/object.go index ac9e1d5f37c..7d4243bca77 100644 --- a/core/coreiface/tests/object_test.go +++ b/core/coreiface/tests/object.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "bytes" @@ -12,6 +12,21 @@ import ( opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) +func TestObject(t *testing.T) { + t.Run("TestNew", TestNew) + t.Run("TestObjectPut", TestObjectPut) + t.Run("TestObjectGet", TestObjectGet) + t.Run("TestObjectData", TestObjectData) + t.Run("TestObjectLinks", TestObjectLinks) + t.Run("TestObjectStat", TestObjectStat) + t.Run("TestObjectAddLink", TestObjectAddLink) + t.Run("TestObjectAddLinkCreate", TestObjectAddLinkCreate) + t.Run("TestObjectRmLink", TestObjectRmLink) + t.Run("TestObjectAddData", TestObjectAddData) + t.Run("TestObjectSetData", TestObjectSetData) + t.Run("TestDiffTest", TestDiffTest) +} + func TestNew(t *testing.T) { ctx := context.Background() api, err := makeAPI(ctx) diff --git a/core/coreiface/tests/path_test.go b/core/coreiface/tests/path.go similarity index 91% rename from core/coreiface/tests/path_test.go rename to core/coreiface/tests/path.go index e054280733f..efbacd29f0a 100644 --- a/core/coreiface/tests/path_test.go +++ b/core/coreiface/tests/path.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "context" @@ -9,6 +9,14 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) +func TestPath(t *testing.T) { + t.Run("TestMutablePath", TestMutablePath) + t.Run("TestPathRemainder", TestPathRemainder) + t.Run("TestEmptyPathRemainder", TestEmptyPathRemainder) + t.Run("TestInvalidPathRemainder", TestInvalidPathRemainder) + t.Run("TestPathRoot", TestPathRoot) +} + func TestMutablePath(t *testing.T) { ctx := context.Background() api, err := makeAPI(ctx) diff --git a/core/coreiface/tests/pin_test.go b/core/coreiface/tests/pin.go similarity index 95% rename from core/coreiface/tests/pin_test.go rename to core/coreiface/tests/pin.go index 5c4b82bc257..344cd0db73b 100644 --- a/core/coreiface/tests/pin_test.go +++ b/core/coreiface/tests/pin.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "context" @@ -8,6 +8,12 @@ import ( opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) +func TestPin(t *testing.T) { + t.Run("TestPinAdd", TestPinAdd) + t.Run("TestPinSimple", TestPinSimple) + t.Run("TestPinRecursive", TestPinRecursive) +} + func TestPinAdd(t *testing.T) { ctx := context.Background() api, err := makeAPI(ctx) diff --git a/core/coreiface/tests/pubsub_test.go b/core/coreiface/tests/pubsub.go similarity index 95% rename from core/coreiface/tests/pubsub_test.go rename to core/coreiface/tests/pubsub.go index 19a1eba5213..3ecd80274ce 100644 --- a/core/coreiface/tests/pubsub_test.go +++ b/core/coreiface/tests/pubsub.go @@ -1,4 +1,4 @@ -package tests_test +package tests import ( "context" @@ -7,6 +7,10 @@ import ( "time" ) +func TestPubSub(t *testing.T) { + t.Run("TestBasicPubSub", TestBasicPubSub) +} + func TestBasicPubSub(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/core/coreiface/tests/unixfs_test.go b/core/coreiface/tests/unixfs.go similarity index 89% rename from core/coreiface/tests/unixfs_test.go rename to core/coreiface/tests/unixfs.go index d7ddae96336..1ca0b282ac9 100644 --- a/core/coreiface/tests/unixfs_test.go +++ b/core/coreiface/tests/unixfs.go @@ -1,11 +1,8 @@ -package tests_test +package tests import ( "bytes" "context" - "encoding/base64" - "fmt" - "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" "io" "io/ioutil" "math" @@ -15,28 +12,31 @@ import ( "sync" "testing" - "github.com/ipfs/go-ipfs/core" - "github.com/ipfs/go-ipfs/core/coreapi" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - mock "github.com/ipfs/go-ipfs/core/mock" - "github.com/ipfs/go-ipfs/keystore" - "github.com/ipfs/go-ipfs/repo" - ci "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto" - "gx/ipfs/QmRBaUEQEeFWywfrZJ64QgsmvcqgLSK3VbvGMR2NM2Edpf/go-libp2p/p2p/net/mock" + "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" cbor "gx/ipfs/QmRoARq3nkUb13HSKZGepCZSWe5GrVPwx7xURJGZ7KWv9V/go-ipld-cbor" "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" - "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" - pstore "gx/ipfs/QmZ9zH2FnLcxv1xyzFeUpDUeo55xEhZQHgveZijcxr7TLj/go-libp2p-peerstore" "gx/ipfs/Qmbvw7kpSM2p6rbQ57WGRhhqNfCiNGW6EKH4xgHLw4bsnB/go-unixfs" - "gx/ipfs/QmcZfkbgwwwH5ZLTQRHkSQBDiDqd3skY2eU6MZRgWuXcse/go-ipfs-config" mdag "gx/ipfs/QmdV35UHnL1FM52baPkeUo6u7Fxm2CRUkPTLRPxeF8a4Ap/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" - "gx/ipfs/Qmf4xQhNomPNhrtZc67qSnfJSjxjXs9LWvknJtSXwimPrM/go-datastore" - syncds "gx/ipfs/Qmf4xQhNomPNhrtZc67qSnfJSjxjXs9LWvknJtSXwimPrM/go-datastore/sync" ) +func TestUnixfs(t *testing.T) { + t.Run("TestAdd", TestAdd) + t.Run("TestAddPinned", TestAddPinned) + t.Run("TestAddHashOnly", TestAddHashOnly) + t.Run("TestGetEmptyFile", TestGetEmptyFile) + t.Run("TestGetDir", TestGetDir) + t.Run("TestGetNonUnixfs", TestGetNonUnixfs) + t.Run("TestLs", TestLs) + t.Run("TestEntriesExpired", TestEntriesExpired) + t.Run("TestLsEmptyDir", TestLsEmptyDir) + t.Run("TestLsNonUnixfs", TestLsNonUnixfs) + t.Run("TestAddCloses", TestAddCloses) +} + const testPeerID = "QmTFauExutTsy4XP6JbMFcw2Wa9645HJt2bTqL6qYDCKfe" // `echo -n 'hello, world!' | ipfs add` @@ -46,97 +46,6 @@ var helloStr = "hello, world!" // `echo -n | ipfs add` var emptyFile = "/ipfs/QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" -func makeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { - mn := mocknet.New(ctx) - - nodes := make([]*core.IpfsNode, n) - apis := make([]coreiface.CoreAPI, n) - - for i := 0; i < n; i++ { - var ident config.Identity - if fullIdentity { - sk, pk, err := ci.GenerateKeyPair(ci.RSA, 512) - if err != nil { - return nil, err - } - - id, err := peer.IDFromPublicKey(pk) - if err != nil { - return nil, err - } - - kbytes, err := sk.Bytes() - if err != nil { - return nil, err - } - - ident = config.Identity{ - PeerID: id.Pretty(), - PrivKey: base64.StdEncoding.EncodeToString(kbytes), - } - } else { - ident = config.Identity{ - PeerID: testPeerID, - } - } - - c := config.Config{} - c.Addresses.Swarm = []string{fmt.Sprintf("/ip4/127.0.%d.1/tcp/4001", i)} - c.Identity = ident - - r := &repo.Mock{ - C: c, - D: syncds.MutexWrap(datastore.NewMapDatastore()), - K: keystore.NewMemKeystore(), - } - - node, err := core.NewNode(ctx, &core.BuildCfg{ - Repo: r, - Host: mock.MockHostOption(mn), - Online: fullIdentity, - ExtraOpts: map[string]bool{ - "pubsub": true, - }, - }) - if err != nil { - return nil, err - } - nodes[i] = node - apis[i], err = coreapi.NewCoreAPI(node) - if err != nil { - return nil, err - } - } - - err := mn.LinkAll() - if err != nil { - return nil, err - } - - bsinf := core.BootstrapConfigWithPeers( - []pstore.PeerInfo{ - nodes[0].Peerstore.PeerInfo(nodes[0].Identity), - }, - ) - - for _, n := range nodes[1:] { - if err := n.Bootstrap(bsinf); err != nil { - return nil, err - } - } - - return apis, nil -} - -func makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { - api, err := makeAPISwarm(ctx, false, 1) - if err != nil { - return nil, err - } - - return api[0], nil -} - func strFile(data string) func() files.Node { return func() files.Node { return files.NewBytesFile([]byte(data)) From cba8f3c2a51e6b4afeeabec713d6fe0c699bae57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Dec 2018 21:01:00 +0100 Subject: [PATCH 160/286] coreapi: Interface for external test providers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@1532d2602204f7c279b22db1ebcb960f82e67050 This commit was moved from ipfs/boxo@9e88033a986fbd3454d5b438e3590b871ae0987d --- core/coreiface/tests/api.go | 134 ++++++--------------------------- core/coreiface/tests/block.go | 38 +++++----- core/coreiface/tests/dag.go | 32 ++++---- core/coreiface/tests/dht.go | 20 ++--- core/coreiface/tests/key.go | 105 ++++++++++++++------------ core/coreiface/tests/name.go | 19 ++--- core/coreiface/tests/object.go | 74 +++++++++--------- core/coreiface/tests/path.go | 32 ++++---- core/coreiface/tests/pin.go | 20 ++--- core/coreiface/tests/pubsub.go | 8 +- core/coreiface/tests/unixfs.go | 70 +++++++++-------- 11 files changed, 236 insertions(+), 316 deletions(-) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index 8baa869dd99..a4b0312f637 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -2,128 +2,42 @@ package tests import ( "context" - "encoding/base64" - "fmt" "testing" - "github.com/ipfs/go-ipfs/core" - "github.com/ipfs/go-ipfs/core/coreapi" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" - mock "github.com/ipfs/go-ipfs/core/mock" - "github.com/ipfs/go-ipfs/keystore" - "github.com/ipfs/go-ipfs/repo" - - ci "gx/ipfs/QmNiJiXwWE3kRhZrC5ej3kSjWHm337pYfhjLGSCDNKJP2s/go-libp2p-crypto" - "gx/ipfs/QmRBaUEQEeFWywfrZJ64QgsmvcqgLSK3VbvGMR2NM2Edpf/go-libp2p/p2p/net/mock" - "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" - pstore "gx/ipfs/QmZ9zH2FnLcxv1xyzFeUpDUeo55xEhZQHgveZijcxr7TLj/go-libp2p-peerstore" - "gx/ipfs/QmcZfkbgwwwH5ZLTQRHkSQBDiDqd3skY2eU6MZRgWuXcse/go-ipfs-config" - "gx/ipfs/Qmf4xQhNomPNhrtZc67qSnfJSjxjXs9LWvknJtSXwimPrM/go-datastore" - syncds "gx/ipfs/Qmf4xQhNomPNhrtZc67qSnfJSjxjXs9LWvknJtSXwimPrM/go-datastore/sync" ) - -func makeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { - mn := mocknet.New(ctx) - - nodes := make([]*core.IpfsNode, n) - apis := make([]coreiface.CoreAPI, n) - - for i := 0; i < n; i++ { - var ident config.Identity - if fullIdentity { - sk, pk, err := ci.GenerateKeyPair(ci.RSA, 512) - if err != nil { - return nil, err - } - - id, err := peer.IDFromPublicKey(pk) - if err != nil { - return nil, err - } - - kbytes, err := sk.Bytes() - if err != nil { - return nil, err - } - - ident = config.Identity{ - PeerID: id.Pretty(), - PrivKey: base64.StdEncoding.EncodeToString(kbytes), - } - } else { - ident = config.Identity{ - PeerID: testPeerID, - } - } - - c := config.Config{} - c.Addresses.Swarm = []string{fmt.Sprintf("/ip4/127.0.%d.1/tcp/4001", i)} - c.Identity = ident - - r := &repo.Mock{ - C: c, - D: syncds.MutexWrap(datastore.NewMapDatastore()), - K: keystore.NewMemKeystore(), - } - - node, err := core.NewNode(ctx, &core.BuildCfg{ - Repo: r, - Host: mock.MockHostOption(mn), - Online: fullIdentity, - ExtraOpts: map[string]bool{ - "pubsub": true, - }, - }) - if err != nil { - return nil, err - } - nodes[i] = node - apis[i], err = coreapi.NewCoreAPI(node) - if err != nil { - return nil, err - } - } - - err := mn.LinkAll() +func (tp *provider) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { + api, err := tp.MakeAPISwarm(ctx, false, 1) if err != nil { return nil, err } - bsinf := core.BootstrapConfigWithPeers( - []pstore.PeerInfo{ - nodes[0].Peerstore.PeerInfo(nodes[0].Identity), - }, - ) - - for _, n := range nodes[1:] { - if err := n.Bootstrap(bsinf); err != nil { - return nil, err - } - } - - return apis, nil + return api[0], nil } -func makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { - api, err := makeAPISwarm(ctx, false, 1) - if err != nil { - return nil, err - } - - return api[0], nil +type Provider interface { + // Make creates n nodes. fullIdentity set to false can be ignored + MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) } +type provider struct { + Provider +} -func TestApi(t *testing.T) { - t.Run("Block", TestBlock) - t.Run("TestDag", TestDag) - t.Run("TestDht", TestDht) - t.Run("TestKey", TestKey) - t.Run("TestName", TestName) - t.Run("TestObject", TestObject) - t.Run("TestPath", TestPath) - t.Run("TestPin", TestPin) - t.Run("TestPubSub", TestPubSub) - t.Run("TestUnixfs", TestUnixfs) +func TestApi(p Provider) func(t *testing.T) { + tp := &provider{p} + + return func(t *testing.T) { + t.Run("Block", tp.TestBlock) + t.Run("Dag", tp.TestDag) + t.Run("Dht", tp.TestDht) + t.Run("Key", tp.TestKey) + t.Run("Name", tp.TestName) + t.Run("Object", tp.TestObject) + t.Run("Path", tp.TestPath) + t.Run("Pin", tp.TestPin) + t.Run("PubSub", tp.TestPubSub) + t.Run("Unixfs", tp.TestUnixfs) + } } diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 07679a92637..0ee96886088 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -12,18 +12,18 @@ import ( mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) -func TestBlock(t *testing.T) { - t.Run("TestBlockPut", TestBlockPut) - t.Run("TestBlockPutFormat", TestBlockPutFormat) - t.Run("TestBlockPutHash", TestBlockPutHash) - t.Run("TestBlockGet", TestBlockGet) - t.Run("TestBlockRm", TestBlockRm) - t.Run("TestBlockStat", TestBlockStat) +func (tp *provider) TestBlock(t *testing.T) { + t.Run("TestBlockPut", tp.TestBlockPut) + t.Run("TestBlockPutFormat", tp.TestBlockPutFormat) + t.Run("TestBlockPutHash", tp.TestBlockPutHash) + t.Run("TestBlockGet", tp.TestBlockGet) + t.Run("TestBlockRm", tp.TestBlockRm) + t.Run("TestBlockStat", tp.TestBlockStat) } -func TestBlockPut(t *testing.T) { +func (tp *provider) TestBlockPut(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -38,9 +38,9 @@ func TestBlockPut(t *testing.T) { } } -func TestBlockPutFormat(t *testing.T) { +func (tp *provider) TestBlockPutFormat(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -55,9 +55,9 @@ func TestBlockPutFormat(t *testing.T) { } } -func TestBlockPutHash(t *testing.T) { +func (tp *provider) TestBlockPutHash(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -72,9 +72,9 @@ func TestBlockPutHash(t *testing.T) { } } -func TestBlockGet(t *testing.T) { +func (tp *provider) TestBlockGet(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -112,9 +112,9 @@ func TestBlockGet(t *testing.T) { } } -func TestBlockRm(t *testing.T) { +func (tp *provider) TestBlockRm(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -165,9 +165,9 @@ func TestBlockRm(t *testing.T) { } } -func TestBlockStat(t *testing.T) { +func (tp *provider) TestBlockStat(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index a75438ab194..f192162219a 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -12,12 +12,12 @@ import ( mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) -func TestDag(t *testing.T) { - t.Run("TestPut", TestPut) - t.Run("TestPutWithHash", TestPutWithHash) - t.Run("TestPath", TestDagPath) - t.Run("TestTree", TestTree) - t.Run("TestBatch", TestBatch) +func (tp *provider) TestDag(t *testing.T) { + t.Run("TestPut", tp.TestPut) + t.Run("TestPutWithHash", tp.TestPutWithHash) + t.Run("TestPath", tp.TestDagPath) + t.Run("TestTree", tp.TestTree) + t.Run("TestBatch", tp.TestBatch) } var ( @@ -30,9 +30,9 @@ var ( } ) -func TestPut(t *testing.T) { +func (tp *provider) TestPut(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -47,9 +47,9 @@ func TestPut(t *testing.T) { } } -func TestPutWithHash(t *testing.T) { +func (tp *provider) TestPutWithHash(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -64,9 +64,9 @@ func TestPutWithHash(t *testing.T) { } } -func TestDagPath(t *testing.T) { +func (tp *provider) TestDagPath(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -96,9 +96,9 @@ func TestDagPath(t *testing.T) { } } -func TestTree(t *testing.T) { +func (tp *provider) TestTree(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -125,9 +125,9 @@ func TestTree(t *testing.T) { } } -func TestBatch(t *testing.T) { +func (tp *provider) TestBatch(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 429197f7033..9269bc4c509 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -8,15 +8,15 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) -func TestDht(t *testing.T) { - t.Run("TestDhtFindPeer", TestDhtFindPeer) - t.Run("TestDhtFindProviders", TestDhtFindProviders) - t.Run("TestDhtProvide", TestDhtProvide) +func (tp *provider) TestDht(t *testing.T) { + t.Run("TestDhtFindPeer", tp.TestDhtFindPeer) + t.Run("TestDhtFindProviders", tp.TestDhtFindProviders) + t.Run("TestDhtProvide", tp.TestDhtProvide) } -func TestDhtFindPeer(t *testing.T) { +func (tp *provider) TestDhtFindPeer(t *testing.T) { ctx := context.Background() - apis, err := makeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) } @@ -50,9 +50,9 @@ func TestDhtFindPeer(t *testing.T) { } } -func TestDhtFindProviders(t *testing.T) { +func (tp *provider) TestDhtFindProviders(t *testing.T) { ctx := context.Background() - apis, err := makeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) } @@ -79,9 +79,9 @@ func TestDhtFindProviders(t *testing.T) { } } -func TestDhtProvide(t *testing.T) { +func (tp *provider) TestDhtProvide(t *testing.T) { ctx := context.Background() - apis, err := makeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index b08f56a4fd4..c2b8925993d 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -8,31 +8,38 @@ import ( opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) -func TestKey(t *testing.T) { - t.Run("TestListSelf", TestListSelf) - t.Run("TestRenameSelf", TestRenameSelf) - t.Run("TestRemoveSelf", TestRemoveSelf) - t.Run("TestGenerateSize", TestGenerateSize) - t.Run("TestGenerateExisting", TestGenerateExisting) - t.Run("TestList", TestList) - t.Run("TestRename", TestRename) - t.Run("TestRenameToSelf", TestRenameToSelf) - t.Run("TestRenameToSelfForce", TestRenameToSelfForce) - t.Run("TestRenameOverwriteNoForce", TestRenameOverwriteNoForce) - t.Run("TestRenameOverwrite", TestRenameOverwrite) - t.Run("TestRenameSameNameNoForce", TestRenameSameNameNoForce) - t.Run("TestRenameSameName", TestRenameSameName) - t.Run("TestRemove", TestRemove) +func (tp *provider) TestKey(t *testing.T) { + t.Run("TestListSelf", tp.TestListSelf) + t.Run("TestRenameSelf", tp.TestRenameSelf) + t.Run("TestRemoveSelf", tp.TestRemoveSelf) + t.Run("TestGenerate", tp.TestGenerate) + t.Run("TestGenerateSize", tp.TestGenerateSize) + t.Run("TestGenerateType", tp.TestGenerateType) + t.Run("TestGenerateExisting", tp.TestGenerateExisting) + t.Run("TestList", tp.TestList) + t.Run("TestRename", tp.TestRename) + t.Run("TestRenameToSelf", tp.TestRenameToSelf) + t.Run("TestRenameToSelfForce", tp.TestRenameToSelfForce) + t.Run("TestRenameOverwriteNoForce", tp.TestRenameOverwriteNoForce) + t.Run("TestRenameOverwrite", tp.TestRenameOverwrite) + t.Run("TestRenameSameNameNoForce", tp.TestRenameSameNameNoForce) + t.Run("TestRenameSameName", tp.TestRenameSameName) + t.Run("TestRemove", tp.TestRemove) } -func TestListSelf(t *testing.T) { +func (tp *provider) TestListSelf(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) return } + self, err := api.Key().Self(ctx) + if err != nil { + t.Fatal(err) + } + keys, err := api.Key().List(ctx) if err != nil { t.Fatalf("failed to list keys: %s", err) @@ -48,14 +55,14 @@ func TestListSelf(t *testing.T) { t.Errorf("expected the key to be called 'self', got '%s'", keys[0].Name()) } - if keys[0].Path().String() != "/ipns/"+testPeerID { - t.Errorf("expected the key to have path '/ipns/%s', got '%s'", testPeerID, keys[0].Path().String()) + if keys[0].Path().String() != "/ipns/"+self.ID().Pretty() { + t.Errorf("expected the key to have path '/ipns/%s', got '%s'", self.ID().Pretty(), keys[0].Path().String()) } } -func TestRenameSelf(t *testing.T) { +func (tp *provider) TestRenameSelf(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) return @@ -80,9 +87,9 @@ func TestRenameSelf(t *testing.T) { } } -func TestRemoveSelf(t *testing.T) { +func (tp *provider) TestRemoveSelf(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) return @@ -98,9 +105,9 @@ func TestRemoveSelf(t *testing.T) { } } -func TestGenerate(t *testing.T) { +func (tp *provider) TestGenerate(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -120,9 +127,9 @@ func TestGenerate(t *testing.T) { } } -func TestGenerateSize(t *testing.T) { +func (tp *provider) TestGenerateSize(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -142,11 +149,11 @@ func TestGenerateSize(t *testing.T) { } } -func TestGenerateType(t *testing.T) { +func (tp *provider) TestGenerateType(t *testing.T) { ctx := context.Background() t.Skip("disabled until libp2p/specs#111 is fixed") - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -167,9 +174,9 @@ func TestGenerateType(t *testing.T) { } } -func TestGenerateExisting(t *testing.T) { +func (tp *provider) TestGenerateExisting(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -199,9 +206,9 @@ func TestGenerateExisting(t *testing.T) { } } -func TestList(t *testing.T) { +func (tp *provider) TestList(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -244,9 +251,9 @@ func TestList(t *testing.T) { } } -func TestRename(t *testing.T) { +func (tp *provider) TestRename(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -272,9 +279,9 @@ func TestRename(t *testing.T) { } } -func TestRenameToSelf(t *testing.T) { +func (tp *provider) TestRenameToSelf(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -295,9 +302,9 @@ func TestRenameToSelf(t *testing.T) { } } -func TestRenameToSelfForce(t *testing.T) { +func (tp *provider) TestRenameToSelfForce(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -318,9 +325,9 @@ func TestRenameToSelfForce(t *testing.T) { } } -func TestRenameOverwriteNoForce(t *testing.T) { +func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -347,9 +354,9 @@ func TestRenameOverwriteNoForce(t *testing.T) { } } -func TestRenameOverwrite(t *testing.T) { +func (tp *provider) TestRenameOverwrite(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -385,9 +392,9 @@ func TestRenameOverwrite(t *testing.T) { } } -func TestRenameSameNameNoForce(t *testing.T) { +func (tp *provider) TestRenameSameNameNoForce(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -413,9 +420,9 @@ func TestRenameSameNameNoForce(t *testing.T) { } } -func TestRenameSameName(t *testing.T) { +func (tp *provider) TestRenameSameName(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -441,9 +448,9 @@ func TestRenameSameName(t *testing.T) { } } -func TestRemove(t *testing.T) { +func (tp *provider) TestRemove(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 154c1d44480..ecb06ddde6c 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -15,9 +15,10 @@ import ( opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) -func TestName(t *testing.T) { - t.Run("TestPublishResolve", TestPublishResolve) - t.Run("TestBasicPublishResolveKey", TestBasicPublishResolveKey) +func (tp *provider) TestName(t *testing.T) { + t.Run("TestPublishResolve", tp.TestPublishResolve) + t.Run("TestBasicPublishResolveKey", tp.TestBasicPublishResolveKey) + t.Run("TestBasicPublishResolveTimeout", tp.TestBasicPublishResolveTimeout) } var rnd = rand.New(rand.NewSource(0x62796532303137)) @@ -34,10 +35,10 @@ func appendPath(p coreiface.Path, sub string) coreiface.Path { return p } -func TestPublishResolve(t *testing.T) { +func (tp *provider) TestPublishResolve(t *testing.T) { ctx := context.Background() init := func() (coreiface.CoreAPI, coreiface.Path) { - apis, err := makeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) return nil, nil @@ -183,9 +184,9 @@ func TestPublishResolve(t *testing.T) { }) } -func TestBasicPublishResolveKey(t *testing.T) { +func (tp *provider) TestBasicPublishResolveKey(t *testing.T) { ctx := context.Background() - apis, err := makeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) } @@ -224,11 +225,11 @@ func TestBasicPublishResolveKey(t *testing.T) { } } -func TestBasicPublishResolveTimeout(t *testing.T) { +func (tp *provider) TestBasicPublishResolveTimeout(t *testing.T) { t.Skip("ValidTime doesn't appear to work at this time resolution") ctx := context.Background() - apis, err := makeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 7d4243bca77..349b4a8f566 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -12,24 +12,24 @@ import ( opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) -func TestObject(t *testing.T) { - t.Run("TestNew", TestNew) - t.Run("TestObjectPut", TestObjectPut) - t.Run("TestObjectGet", TestObjectGet) - t.Run("TestObjectData", TestObjectData) - t.Run("TestObjectLinks", TestObjectLinks) - t.Run("TestObjectStat", TestObjectStat) - t.Run("TestObjectAddLink", TestObjectAddLink) - t.Run("TestObjectAddLinkCreate", TestObjectAddLinkCreate) - t.Run("TestObjectRmLink", TestObjectRmLink) - t.Run("TestObjectAddData", TestObjectAddData) - t.Run("TestObjectSetData", TestObjectSetData) - t.Run("TestDiffTest", TestDiffTest) +func (tp *provider) TestObject(t *testing.T) { + t.Run("TestNew", tp.TestNew) + t.Run("TestObjectPut", tp.TestObjectPut) + t.Run("TestObjectGet", tp.TestObjectGet) + t.Run("TestObjectData", tp.TestObjectData) + t.Run("TestObjectLinks", tp.TestObjectLinks) + t.Run("TestObjectStat", tp.TestObjectStat) + t.Run("TestObjectAddLink", tp.TestObjectAddLink) + t.Run("TestObjectAddLinkCreate", tp.TestObjectAddLinkCreate) + t.Run("TestObjectRmLink", tp.TestObjectRmLink) + t.Run("TestObjectAddData", tp.TestObjectAddData) + t.Run("TestObjectSetData", tp.TestObjectSetData) + t.Run("TestDiffTest", tp.TestDiffTest) } -func TestNew(t *testing.T) { +func (tp *provider) TestNew(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -53,9 +53,9 @@ func TestNew(t *testing.T) { } } -func TestObjectPut(t *testing.T) { +func (tp *provider) TestObjectPut(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -93,9 +93,9 @@ func TestObjectPut(t *testing.T) { } } -func TestObjectGet(t *testing.T) { +func (tp *provider) TestObjectGet(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -115,9 +115,9 @@ func TestObjectGet(t *testing.T) { } } -func TestObjectData(t *testing.T) { +func (tp *provider) TestObjectData(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -142,9 +142,9 @@ func TestObjectData(t *testing.T) { } } -func TestObjectLinks(t *testing.T) { +func (tp *provider) TestObjectLinks(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -177,9 +177,9 @@ func TestObjectLinks(t *testing.T) { } } -func TestObjectStat(t *testing.T) { +func (tp *provider) TestObjectStat(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -224,9 +224,9 @@ func TestObjectStat(t *testing.T) { } } -func TestObjectAddLink(t *testing.T) { +func (tp *provider) TestObjectAddLink(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -264,9 +264,9 @@ func TestObjectAddLink(t *testing.T) { } } -func TestObjectAddLinkCreate(t *testing.T) { +func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -312,9 +312,9 @@ func TestObjectAddLinkCreate(t *testing.T) { } } -func TestObjectRmLink(t *testing.T) { +func (tp *provider) TestObjectRmLink(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -344,9 +344,9 @@ func TestObjectRmLink(t *testing.T) { } } -func TestObjectAddData(t *testing.T) { +func (tp *provider) TestObjectAddData(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -373,9 +373,9 @@ func TestObjectAddData(t *testing.T) { } } -func TestObjectSetData(t *testing.T) { +func (tp *provider) TestObjectSetData(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -402,9 +402,9 @@ func TestObjectSetData(t *testing.T) { } } -func TestDiffTest(t *testing.T) { +func (tp *provider) TestDiffTest(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index efbacd29f0a..cb12463667c 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -9,17 +9,17 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) -func TestPath(t *testing.T) { - t.Run("TestMutablePath", TestMutablePath) - t.Run("TestPathRemainder", TestPathRemainder) - t.Run("TestEmptyPathRemainder", TestEmptyPathRemainder) - t.Run("TestInvalidPathRemainder", TestInvalidPathRemainder) - t.Run("TestPathRoot", TestPathRoot) +func (tp *provider) TestPath(t *testing.T) { + t.Run("TestMutablePath", tp.TestMutablePath) + t.Run("TestPathRemainder", tp.TestPathRemainder) + t.Run("TestEmptyPathRemainder", tp.TestEmptyPathRemainder) + t.Run("TestInvalidPathRemainder", tp.TestInvalidPathRemainder) + t.Run("TestPathRoot", tp.TestPathRoot) } -func TestMutablePath(t *testing.T) { +func (tp *provider) TestMutablePath(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -44,9 +44,9 @@ func TestMutablePath(t *testing.T) { } } -func TestPathRemainder(t *testing.T) { +func (tp *provider) TestPathRemainder(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -71,9 +71,9 @@ func TestPathRemainder(t *testing.T) { } } -func TestEmptyPathRemainder(t *testing.T) { +func (tp *provider) TestEmptyPathRemainder(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -102,9 +102,9 @@ func TestEmptyPathRemainder(t *testing.T) { } } -func TestInvalidPathRemainder(t *testing.T) { +func (tp *provider) TestInvalidPathRemainder(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -125,9 +125,9 @@ func TestInvalidPathRemainder(t *testing.T) { } } -func TestPathRoot(t *testing.T) { +func (tp *provider) TestPathRoot(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 344cd0db73b..8c659ba3584 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -8,15 +8,15 @@ import ( opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) -func TestPin(t *testing.T) { - t.Run("TestPinAdd", TestPinAdd) - t.Run("TestPinSimple", TestPinSimple) - t.Run("TestPinRecursive", TestPinRecursive) +func (tp *provider) TestPin(t *testing.T) { + t.Run("TestPinAdd", tp.TestPinAdd) + t.Run("TestPinSimple", tp.TestPinSimple) + t.Run("TestPinRecursive", tp.TestPinRecursive) } -func TestPinAdd(t *testing.T) { +func (tp *provider) TestPinAdd(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -32,9 +32,9 @@ func TestPinAdd(t *testing.T) { } } -func TestPinSimple(t *testing.T) { +func (tp *provider) TestPinSimple(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -81,9 +81,9 @@ func TestPinSimple(t *testing.T) { } } -func TestPinRecursive(t *testing.T) { +func (tp *provider) TestPinRecursive(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index 3ecd80274ce..3462b47551d 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -7,15 +7,15 @@ import ( "time" ) -func TestPubSub(t *testing.T) { - t.Run("TestBasicPubSub", TestBasicPubSub) +func (tp *provider) TestPubSub(t *testing.T) { + t.Run("TestBasicPubSub", tp.TestBasicPubSub) } -func TestBasicPubSub(t *testing.T) { +func (tp *provider) TestBasicPubSub(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := makeAPISwarm(ctx, true, 2) + apis, err := tp.MakeAPISwarm(ctx, true, 2) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 1ca0b282ac9..b31a55d4ce9 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -23,22 +23,20 @@ import ( mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) -func TestUnixfs(t *testing.T) { - t.Run("TestAdd", TestAdd) - t.Run("TestAddPinned", TestAddPinned) - t.Run("TestAddHashOnly", TestAddHashOnly) - t.Run("TestGetEmptyFile", TestGetEmptyFile) - t.Run("TestGetDir", TestGetDir) - t.Run("TestGetNonUnixfs", TestGetNonUnixfs) - t.Run("TestLs", TestLs) - t.Run("TestEntriesExpired", TestEntriesExpired) - t.Run("TestLsEmptyDir", TestLsEmptyDir) - t.Run("TestLsNonUnixfs", TestLsNonUnixfs) - t.Run("TestAddCloses", TestAddCloses) +func (tp *provider) TestUnixfs(t *testing.T) { + t.Run("TestAdd", tp.TestAdd) + t.Run("TestAddPinned", tp.TestAddPinned) + t.Run("TestAddHashOnly", tp.TestAddHashOnly) + t.Run("TestGetEmptyFile", tp.TestGetEmptyFile) + t.Run("TestGetDir", tp.TestGetDir) + t.Run("TestGetNonUnixfs", tp.TestGetNonUnixfs) + t.Run("TestLs", tp.TestLs) + t.Run("TestEntriesExpired", tp.TestEntriesExpired) + t.Run("TestLsEmptyDir", tp.TestLsEmptyDir) + t.Run("TestLsNonUnixfs", tp.TestLsNonUnixfs) + t.Run("TestAddCloses", tp.TestAddCloses) } -const testPeerID = "QmTFauExutTsy4XP6JbMFcw2Wa9645HJt2bTqL6qYDCKfe" - // `echo -n 'hello, world!' | ipfs add` var hello = "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" var helloStr = "hello, world!" @@ -80,9 +78,9 @@ func wrapped(name string) func(f files.Node) files.Node { } } -func TestAdd(t *testing.T) { +func (tp *provider) TestAdd(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -537,9 +535,9 @@ func TestAdd(t *testing.T) { } } -func TestAddPinned(t *testing.T) { +func (tp *provider) TestAddPinned(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -559,9 +557,9 @@ func TestAddPinned(t *testing.T) { } } -func TestAddHashOnly(t *testing.T) { +func (tp *provider) TestAddHashOnly(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -584,9 +582,9 @@ func TestAddHashOnly(t *testing.T) { } } -func TestGetEmptyFile(t *testing.T) { +func (tp *provider) TestGetEmptyFile(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) } @@ -616,9 +614,9 @@ func TestGetEmptyFile(t *testing.T) { } } -func TestGetDir(t *testing.T) { +func (tp *provider) TestGetDir(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -648,9 +646,9 @@ func TestGetDir(t *testing.T) { } } -func TestGetNonUnixfs(t *testing.T) { +func (tp *provider) TestGetNonUnixfs(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -667,9 +665,9 @@ func TestGetNonUnixfs(t *testing.T) { } } -func TestLs(t *testing.T) { +func (tp *provider) TestLs(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -703,9 +701,9 @@ func TestLs(t *testing.T) { } } -func TestEntriesExpired(t *testing.T) { +func (tp *provider) TestEntriesExpired(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -746,9 +744,9 @@ func TestEntriesExpired(t *testing.T) { } } -func TestLsEmptyDir(t *testing.T) { +func (tp *provider) TestLsEmptyDir(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -774,9 +772,9 @@ func TestLsEmptyDir(t *testing.T) { } // TODO(lgierth) this should test properly, with len(links) > 0 -func TestLsNonUnixfs(t *testing.T) { +func (tp *provider) TestLsNonUnixfs(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } @@ -831,9 +829,9 @@ func (f *closeTestF) Close() error { return nil } -func TestAddCloses(t *testing.T) { +func (tp *provider) TestAddCloses(t *testing.T) { ctx := context.Background() - api, err := makeAPI(ctx) + api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) } From e5a2d8e6f6ac387985f52ccb9eaf3172dc5b88ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 20 Dec 2018 22:27:59 +0100 Subject: [PATCH 161/286] coreapi: make sure to cancel context in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@aa64f771136226accbcae0213eb929ff79697046 This commit was moved from ipfs/boxo@23069a4c459b67e966fa5370e980aaab410e718b --- core/coreiface/tests/api.go | 37 +++++++++++++++++++++++++- core/coreiface/tests/block.go | 18 ++++++++----- core/coreiface/tests/dag.go | 15 +++++++---- core/coreiface/tests/dht.go | 9 ++++--- core/coreiface/tests/key.go | 48 ++++++++++++++++++++++------------ core/coreiface/tests/name.go | 9 ++++--- core/coreiface/tests/object.go | 36 ++++++++++++++++--------- core/coreiface/tests/path.go | 15 +++++++---- core/coreiface/tests/pin.go | 9 ++++--- core/coreiface/tests/unixfs.go | 35 ++++++++++++++++--------- 10 files changed, 165 insertions(+), 66 deletions(-) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index a4b0312f637..ab1feff5be4 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -3,6 +3,7 @@ package tests import ( "context" "testing" + "time" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" ) @@ -21,12 +22,37 @@ type Provider interface { MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) } +func (tp *provider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { + tp.apis <- 1 + go func() { + <-ctx.Done() + tp.apis <- -1 + }() + + return tp.Provider.MakeAPISwarm(ctx, fullIdentity, n) +} + type provider struct { Provider + + apis chan int } func TestApi(p Provider) func(t *testing.T) { - tp := &provider{p} + running := 1 + apis := make(chan int) + zeroRunning := make(chan struct{}) + go func() { + for i := range apis { + running += i + if running < 1 { + close(zeroRunning) + return + } + } + }() + + tp := &provider{Provider: p, apis: apis} return func(t *testing.T) { t.Run("Block", tp.TestBlock) @@ -39,5 +65,14 @@ func TestApi(p Provider) func(t *testing.T) { t.Run("Pin", tp.TestPin) t.Run("PubSub", tp.TestPubSub) t.Run("Unixfs", tp.TestUnixfs) + + apis <- -1 + t.Run("TestsCancelCtx", func(t *testing.T) { + select { + case <-zeroRunning: + case <-time.After(time.Second): + t.Errorf("%d node(s) not closed", running) + } + }) } } diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 0ee96886088..a3a5f93aa1c 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -22,7 +22,8 @@ func (tp *provider) TestBlock(t *testing.T) { } func (tp *provider) TestBlockPut(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -39,7 +40,8 @@ func (tp *provider) TestBlockPut(t *testing.T) { } func (tp *provider) TestBlockPutFormat(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -56,7 +58,8 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) { } func (tp *provider) TestBlockPutHash(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -73,7 +76,8 @@ func (tp *provider) TestBlockPutHash(t *testing.T) { } func (tp *provider) TestBlockGet(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -113,7 +117,8 @@ func (tp *provider) TestBlockGet(t *testing.T) { } func (tp *provider) TestBlockRm(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -166,7 +171,8 @@ func (tp *provider) TestBlockRm(t *testing.T) { } func (tp *provider) TestBlockStat(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index f192162219a..636c3869918 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -31,7 +31,8 @@ var ( ) func (tp *provider) TestPut(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -48,7 +49,8 @@ func (tp *provider) TestPut(t *testing.T) { } func (tp *provider) TestPutWithHash(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -65,7 +67,8 @@ func (tp *provider) TestPutWithHash(t *testing.T) { } func (tp *provider) TestDagPath(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -97,7 +100,8 @@ func (tp *provider) TestDagPath(t *testing.T) { } func (tp *provider) TestTree(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -126,7 +130,8 @@ func (tp *provider) TestTree(t *testing.T) { } func (tp *provider) TestBatch(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 9269bc4c509..9b77f16792c 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -15,7 +15,8 @@ func (tp *provider) TestDht(t *testing.T) { } func (tp *provider) TestDhtFindPeer(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) @@ -51,7 +52,8 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) { } func (tp *provider) TestDhtFindProviders(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) @@ -80,7 +82,8 @@ func (tp *provider) TestDhtFindProviders(t *testing.T) { } func (tp *provider) TestDhtProvide(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index c2b8925993d..99c30c30233 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -28,7 +28,8 @@ func (tp *provider) TestKey(t *testing.T) { } func (tp *provider) TestListSelf(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -61,7 +62,8 @@ func (tp *provider) TestListSelf(t *testing.T) { } func (tp *provider) TestRenameSelf(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -88,7 +90,8 @@ func (tp *provider) TestRenameSelf(t *testing.T) { } func (tp *provider) TestRemoveSelf(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -106,7 +109,8 @@ func (tp *provider) TestRemoveSelf(t *testing.T) { } func (tp *provider) TestGenerate(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -128,7 +132,8 @@ func (tp *provider) TestGenerate(t *testing.T) { } func (tp *provider) TestGenerateSize(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -150,7 +155,8 @@ func (tp *provider) TestGenerateSize(t *testing.T) { } func (tp *provider) TestGenerateType(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() t.Skip("disabled until libp2p/specs#111 is fixed") api, err := tp.makeAPI(ctx) @@ -175,7 +181,8 @@ func (tp *provider) TestGenerateType(t *testing.T) { } func (tp *provider) TestGenerateExisting(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -207,7 +214,8 @@ func (tp *provider) TestGenerateExisting(t *testing.T) { } func (tp *provider) TestList(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -252,7 +260,8 @@ func (tp *provider) TestList(t *testing.T) { } func (tp *provider) TestRename(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -280,7 +289,8 @@ func (tp *provider) TestRename(t *testing.T) { } func (tp *provider) TestRenameToSelf(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -303,7 +313,8 @@ func (tp *provider) TestRenameToSelf(t *testing.T) { } func (tp *provider) TestRenameToSelfForce(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -326,7 +337,8 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) { } func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -355,7 +367,8 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { } func (tp *provider) TestRenameOverwrite(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -393,7 +406,8 @@ func (tp *provider) TestRenameOverwrite(t *testing.T) { } func (tp *provider) TestRenameSameNameNoForce(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -421,7 +435,8 @@ func (tp *provider) TestRenameSameNameNoForce(t *testing.T) { } func (tp *provider) TestRenameSameName(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -449,7 +464,8 @@ func (tp *provider) TestRenameSameName(t *testing.T) { } func (tp *provider) TestRemove(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index ecb06ddde6c..e114b26dea5 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -36,7 +36,8 @@ func appendPath(p coreiface.Path, sub string) coreiface.Path { } func (tp *provider) TestPublishResolve(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() init := func() (coreiface.CoreAPI, coreiface.Path) { apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { @@ -185,7 +186,8 @@ func (tp *provider) TestPublishResolve(t *testing.T) { } func (tp *provider) TestBasicPublishResolveKey(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) @@ -228,7 +230,8 @@ func (tp *provider) TestBasicPublishResolveKey(t *testing.T) { func (tp *provider) TestBasicPublishResolveTimeout(t *testing.T) { t.Skip("ValidTime doesn't appear to work at this time resolution") - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 349b4a8f566..1cd24aac25c 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -28,7 +28,8 @@ func (tp *provider) TestObject(t *testing.T) { } func (tp *provider) TestNew(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -54,7 +55,8 @@ func (tp *provider) TestNew(t *testing.T) { } func (tp *provider) TestObjectPut(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -94,7 +96,8 @@ func (tp *provider) TestObjectPut(t *testing.T) { } func (tp *provider) TestObjectGet(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -116,7 +119,8 @@ func (tp *provider) TestObjectGet(t *testing.T) { } func (tp *provider) TestObjectData(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -143,7 +147,8 @@ func (tp *provider) TestObjectData(t *testing.T) { } func (tp *provider) TestObjectLinks(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -178,7 +183,8 @@ func (tp *provider) TestObjectLinks(t *testing.T) { } func (tp *provider) TestObjectStat(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -225,7 +231,8 @@ func (tp *provider) TestObjectStat(t *testing.T) { } func (tp *provider) TestObjectAddLink(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -265,7 +272,8 @@ func (tp *provider) TestObjectAddLink(t *testing.T) { } func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -313,7 +321,8 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { } func (tp *provider) TestObjectRmLink(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -345,7 +354,8 @@ func (tp *provider) TestObjectRmLink(t *testing.T) { } func (tp *provider) TestObjectAddData(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -374,7 +384,8 @@ func (tp *provider) TestObjectAddData(t *testing.T) { } func (tp *provider) TestObjectSetData(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -403,7 +414,8 @@ func (tp *provider) TestObjectSetData(t *testing.T) { } func (tp *provider) TestDiffTest(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index cb12463667c..e74053c0499 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -18,7 +18,8 @@ func (tp *provider) TestPath(t *testing.T) { } func (tp *provider) TestMutablePath(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -45,7 +46,8 @@ func (tp *provider) TestMutablePath(t *testing.T) { } func (tp *provider) TestPathRemainder(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -72,7 +74,8 @@ func (tp *provider) TestPathRemainder(t *testing.T) { } func (tp *provider) TestEmptyPathRemainder(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -103,7 +106,8 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { } func (tp *provider) TestInvalidPathRemainder(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -126,7 +130,8 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { } func (tp *provider) TestPathRoot(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 8c659ba3584..823281ab144 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -15,7 +15,8 @@ func (tp *provider) TestPin(t *testing.T) { } func (tp *provider) TestPinAdd(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -33,7 +34,8 @@ func (tp *provider) TestPinAdd(t *testing.T) { } func (tp *provider) TestPinSimple(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -82,7 +84,8 @@ func (tp *provider) TestPinSimple(t *testing.T) { } func (tp *provider) TestPinRecursive(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index b31a55d4ce9..f411ad24da5 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -79,7 +79,8 @@ func wrapped(name string) func(f files.Node) files.Node { } func (tp *provider) TestAdd(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -536,7 +537,8 @@ func (tp *provider) TestAdd(t *testing.T) { } func (tp *provider) TestAddPinned(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -558,7 +560,8 @@ func (tp *provider) TestAddPinned(t *testing.T) { } func (tp *provider) TestAddHashOnly(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -583,7 +586,8 @@ func (tp *provider) TestAddHashOnly(t *testing.T) { } func (tp *provider) TestGetEmptyFile(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Fatal(err) @@ -615,7 +619,8 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) { } func (tp *provider) TestGetDir(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -647,7 +652,8 @@ func (tp *provider) TestGetDir(t *testing.T) { } func (tp *provider) TestGetNonUnixfs(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -666,7 +672,8 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) { } func (tp *provider) TestLs(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -702,7 +709,8 @@ func (tp *provider) TestLs(t *testing.T) { } func (tp *provider) TestEntriesExpired(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -718,7 +726,7 @@ func (tp *provider) TestEntriesExpired(t *testing.T) { t.Error(err) } - ctx, cancel := context.WithCancel(ctx) + ctx, cancel = context.WithCancel(ctx) nd, err := api.Unixfs().Get(ctx, p) if err != nil { @@ -745,7 +753,8 @@ func (tp *provider) TestEntriesExpired(t *testing.T) { } func (tp *provider) TestLsEmptyDir(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -773,7 +782,8 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) { // TODO(lgierth) this should test properly, with len(links) > 0 func (tp *provider) TestLsNonUnixfs(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) @@ -830,7 +840,8 @@ func (f *closeTestF) Close() error { } func (tp *provider) TestAddCloses(t *testing.T) { - ctx := context.Background() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() api, err := tp.makeAPI(ctx) if err != nil { t.Error(err) From f012ef096aa03a5815189dc04f7bb502cfe3e097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 2 Jan 2019 17:41:12 +0100 Subject: [PATCH 162/286] coreapi: don't panic as much in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@89157f98eeb09c4653c098eb4e438741cbdbd21a This commit was moved from ipfs/boxo@27609c7a833ec02858ad16464eb40946f7ddeae3 --- core/coreiface/tests/api.go | 2 +- core/coreiface/tests/block.go | 12 ++++++------ core/coreiface/tests/dag.go | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index ab1feff5be4..23ec0612bcc 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -71,7 +71,7 @@ func TestApi(p Provider) func(t *testing.T) { select { case <-zeroRunning: case <-time.After(time.Second): - t.Errorf("%d node(s) not closed", running) + t.Errorf("%d test swarms(s) not closed", running) } }) } diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index a3a5f93aa1c..d1117cc50c2 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -26,12 +26,12 @@ func (tp *provider) TestBlockPut(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) if err != nil { - t.Error(err) + t.Fatal(err) } if res.Path().Cid().String() != "QmPyo15ynbVrSTVdJL9th7JysHaAbXt9dM9tXk1bMHbRtk" { @@ -49,7 +49,7 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) { res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Format("cbor")) if err != nil { - t.Error(err) + t.Fatal(err) } if res.Path().Cid().String() != "zdpuAn4amuLWo8Widi5v6VQpuo2dnpnwbVE3oB6qqs7mDSeoa" { @@ -85,7 +85,7 @@ func (tp *provider) TestBlockGet(t *testing.T) { res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Hash(mh.KECCAK_512, -1)) if err != nil { - t.Error(err) + t.Fatal(err) } r, err := api.Block().Get(ctx, res.Path()) @@ -126,7 +126,7 @@ func (tp *provider) TestBlockRm(t *testing.T) { res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) if err != nil { - t.Error(err) + t.Fatal(err) } r, err := api.Block().Get(ctx, res.Path()) @@ -180,7 +180,7 @@ func (tp *provider) TestBlockStat(t *testing.T) { res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) if err != nil { - t.Error(err) + t.Fatal(err) } stat, err := api.Block().Stat(ctx, res.Path()) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 636c3869918..d5026394347 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -40,7 +40,7 @@ func (tp *provider) TestPut(t *testing.T) { res, err := api.Dag().Put(ctx, strings.NewReader(`"Hello"`)) if err != nil { - t.Error(err) + t.Fatal(err) } if res.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { @@ -58,7 +58,7 @@ func (tp *provider) TestPutWithHash(t *testing.T) { res, err := api.Dag().Put(ctx, strings.NewReader(`"Hello"`), opt.Dag.Hash(mh.ID, -1)) if err != nil { - t.Error(err) + t.Fatal(err) } if res.Cid().String() != "z5hRLNd2sv4z1c" { @@ -76,12 +76,12 @@ func (tp *provider) TestDagPath(t *testing.T) { sub, err := api.Dag().Put(ctx, strings.NewReader(`"foo"`)) if err != nil { - t.Error(err) + t.Fatal(err) } res, err := api.Dag().Put(ctx, strings.NewReader(`{"lnk": {"/": "`+sub.Cid().String()+`"}}`)) if err != nil { - t.Error(err) + t.Fatal(err) } p, err := coreiface.ParsePath(path.Join(res.Cid().String(), "lnk")) @@ -109,7 +109,7 @@ func (tp *provider) TestTree(t *testing.T) { c, err := api.Dag().Put(ctx, strings.NewReader(`{"a": 123, "b": "foo", "c": {"d": 321, "e": 111}}`)) if err != nil { - t.Error(err) + t.Fatal(err) } res, err := api.Dag().Get(ctx, c) @@ -141,7 +141,7 @@ func (tp *provider) TestBatch(t *testing.T) { c, err := batch.Put(ctx, strings.NewReader(`"Hello"`)) if err != nil { - t.Error(err) + t.Fatal(err) } if c.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { From 80aace0fa25dcc9d89aff8f3b767852c2935685f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 4 Jan 2019 02:35:40 +0100 Subject: [PATCH 163/286] Fix offline gateway directory logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@360e8bbf0b798f4c52541d9116e3b2d240c71a9a This commit was moved from ipfs/boxo@aecc5aa1ac7d14502faf74530e73fb801aed4158 --- core/coreiface/path.go | 9 +++++++-- core/coreiface/tests/path.go | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 01dda97d5a8..96f30852d84 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,9 +1,8 @@ package iface import ( + "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" ipfspath "gx/ipfs/QmZErC2Ay6WuGi96CPg316PwitdwgLo6RxZRqVjJjRj2MR/go-path" - - cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" ) //TODO: merge with ipfspath so we don't depend on it @@ -106,6 +105,12 @@ type resolvedPath struct { remainder string } +// Join appends provided segments to the base path +func Join(base Path, a ...string) Path { + s := ipfspath.Join(append([]string{base.String()}, a...)) + return &path{path: ipfspath.FromString(s)} +} + // IpfsPath creates new /ipfs path from the provided CID func IpfsPath(c cid.Cid) ResolvedPath { return &resolvedPath{ diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index e74053c0499..7057d628640 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -15,6 +15,7 @@ func (tp *provider) TestPath(t *testing.T) { t.Run("TestEmptyPathRemainder", tp.TestEmptyPathRemainder) t.Run("TestInvalidPathRemainder", tp.TestInvalidPathRemainder) t.Run("TestPathRoot", tp.TestPathRoot) + t.Run("TestPathJoin", tp.TestPathJoin) } func (tp *provider) TestMutablePath(t *testing.T) { @@ -165,3 +166,14 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Error("unexpected path cid") } } + +func (tp *provider) TestPathJoin(t *testing.T) { + p1, err := coreiface.ParsePath("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") + if err != nil { + t.Error(err) + } + + if coreiface.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { + t.Error("unexpected path") + } +} From 3702f185fb7543de86260e52fb22b6a32add1bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 4 Jan 2019 15:40:15 +0100 Subject: [PATCH 164/286] coreapi: FetchBlocks option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@6800f56736680add20352d2348a59a1a41f7808e This commit was moved from ipfs/boxo@030083beef42fd48df466a4a97ea0f51fb1dfbc6 --- core/coreiface/options/global.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/global.go b/core/coreiface/options/global.go index 93d635e41b6..90e2586f10d 100644 --- a/core/coreiface/options/global.go +++ b/core/coreiface/options/global.go @@ -1,14 +1,16 @@ package options type ApiSettings struct { - Offline bool + Offline bool + FetchBlocks bool } type ApiOption func(*ApiSettings) error func ApiOptions(opts ...ApiOption) (*ApiSettings, error) { options := &ApiSettings{ - Offline: false, + Offline: false, + FetchBlocks: true, } return ApiOptionsTo(options, opts...) @@ -34,3 +36,12 @@ func (apiOpts) Offline(offline bool) ApiOption { return nil } } + +// FetchBlocks when set to false prevents api from fetching blocks from the +// network while allowing other services such as IPNS to still be online +func (apiOpts) FetchBlocks(fetch bool) ApiOption { + return func(settings *ApiSettings) error { + settings.FetchBlocks = fetch + return nil + } +} From dfd6253ba8498af122a35929870657e5a8b29744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 7 Jan 2019 16:19:55 +0100 Subject: [PATCH 165/286] CoreAPI: Don't panic when testing incomplete implementions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@d7a89ddb0258cbc54631924688e6f23bc02709d5 This commit was moved from ipfs/boxo@9845df2662de30cb8d0030bd280e2b58247a0ef0 --- core/coreiface/tests/api.go | 16 +++++++++++++ core/coreiface/tests/block.go | 7 ++++++ core/coreiface/tests/dag.go | 7 ++++++ core/coreiface/tests/dht.go | 8 +++++++ core/coreiface/tests/key.go | 8 +++++++ core/coreiface/tests/name.go | 7 ++++++ core/coreiface/tests/object.go | 7 ++++++ core/coreiface/tests/path.go | 42 ++++++++++++++++++++++++++-------- core/coreiface/tests/pin.go | 8 +++++++ core/coreiface/tests/pubsub.go | 8 +++++++ core/coreiface/tests/unixfs.go | 7 ++++++ 11 files changed, 116 insertions(+), 9 deletions(-) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index 23ec0612bcc..7a4bd738624 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -2,12 +2,15 @@ package tests import ( "context" + "errors" "testing" "time" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" ) +var apiNotImplemented = errors.New("api not implemented") + func (tp *provider) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { api, err := tp.MakeAPISwarm(ctx, false, 1) if err != nil { @@ -76,3 +79,16 @@ func TestApi(p Provider) func(t *testing.T) { }) } } + +func (tp *provider) hasApi(t *testing.T, tf func(coreiface.CoreAPI) error) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + if err := tf(api); err != nil { + t.Fatal(api) + } +} diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index d1117cc50c2..81a6fb0617b 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -13,6 +13,13 @@ import ( ) func (tp *provider) TestBlock(t *testing.T) { + tp.hasApi(t, func(api coreiface.CoreAPI) error { + if api.Block() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestBlockPut", tp.TestBlockPut) t.Run("TestBlockPutFormat", tp.TestBlockPutFormat) t.Run("TestBlockPutHash", tp.TestBlockPutHash) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index d5026394347..70a45aa204c 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -13,6 +13,13 @@ import ( ) func (tp *provider) TestDag(t *testing.T) { + tp.hasApi(t, func(api coreiface.CoreAPI) error { + if api.Dag() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestPut", tp.TestPut) t.Run("TestPutWithHash", tp.TestPutWithHash) t.Run("TestPath", tp.TestDagPath) diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 9b77f16792c..3ec77d33bf1 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -5,10 +5,18 @@ import ( "io" "testing" + "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) func (tp *provider) TestDht(t *testing.T) { + tp.hasApi(t, func(api iface.CoreAPI) error { + if api.Dht() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestDhtFindPeer", tp.TestDhtFindPeer) t.Run("TestDhtFindProviders", tp.TestDhtFindProviders) t.Run("TestDhtProvide", tp.TestDhtProvide) diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index 99c30c30233..8dd6af57f48 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -5,10 +5,18 @@ import ( "strings" "testing" + "github.com/ipfs/go-ipfs/core/coreapi/interface" opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ) func (tp *provider) TestKey(t *testing.T) { + tp.hasApi(t, func(api iface.CoreAPI) error { + if api.Key() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestListSelf", tp.TestListSelf) t.Run("TestRenameSelf", tp.TestRenameSelf) t.Run("TestRemoveSelf", tp.TestRemoveSelf) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index e114b26dea5..639e72c3d99 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -16,6 +16,13 @@ import ( ) func (tp *provider) TestName(t *testing.T) { + tp.hasApi(t, func(api coreiface.CoreAPI) error { + if api.Name() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestPublishResolve", tp.TestPublishResolve) t.Run("TestBasicPublishResolveKey", tp.TestBasicPublishResolveKey) t.Run("TestBasicPublishResolveTimeout", tp.TestBasicPublishResolveTimeout) diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 1cd24aac25c..81d5b4117ce 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -13,6 +13,13 @@ import ( ) func (tp *provider) TestObject(t *testing.T) { + tp.hasApi(t, func(api iface.CoreAPI) error { + if api.Object() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestNew", tp.TestNew) t.Run("TestObjectPut", tp.TestObjectPut) t.Run("TestObjectGet", tp.TestObjectGet) diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 7057d628640..50a1977d50b 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -26,23 +26,27 @@ func (tp *provider) TestMutablePath(t *testing.T) { t.Fatal(err) } - // get self /ipns path - keys, err := api.Key().List(ctx) + blk, err := api.Block().Put(ctx, strings.NewReader(`foo`)) if err != nil { t.Fatal(err) } - if !keys[0].Path().Mutable() { - t.Error("expected self /ipns path to be mutable") + if blk.Path().Mutable() { + t.Error("expected /ipld path to be immutable") } - blk, err := api.Block().Put(ctx, strings.NewReader(`foo`)) + // get self /ipns path + if api.Key() == nil { + t.Fatal(".Key not implemented") + } + + keys, err := api.Key().List(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } - if blk.Path().Mutable() { - t.Error("expected /ipld path to be immutable") + if !keys[0].Path().Mutable() { + t.Error("expected self /ipns path to be mutable") } } @@ -54,6 +58,10 @@ func (tp *provider) TestPathRemainder(t *testing.T) { t.Fatal(err) } + if api.Dag() == nil { + t.Fatal(".Dag not implemented") + } + obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) if err != nil { t.Fatal(err) @@ -82,6 +90,10 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { t.Fatal(err) } + if api.Dag() == nil { + t.Fatal(".Dag not implemented") + } + obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) if err != nil { t.Fatal(err) @@ -114,6 +126,10 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { t.Fatal(err) } + if api.Dag() == nil { + t.Fatal(".Dag not implemented") + } + obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) if err != nil { t.Fatal(err) @@ -138,9 +154,17 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Fatal(err) } + if api.Block() == nil { + t.Fatal(".Block not implemented") + } + blk, err := api.Block().Put(ctx, strings.NewReader(`foo`), options.Block.Format("raw")) if err != nil { - t.Error(err) + t.Fatal(err) + } + + if api.Dag() == nil { + t.Fatal(".Dag not implemented") } obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"/": "`+blk.Path().Cid().String()+`"}}`)) diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 823281ab144..87ad8a00489 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -2,6 +2,7 @@ package tests import ( "context" + "github.com/ipfs/go-ipfs/core/coreapi/interface" "strings" "testing" @@ -9,6 +10,13 @@ import ( ) func (tp *provider) TestPin(t *testing.T) { + tp.hasApi(t, func(api iface.CoreAPI) error { + if api.Pin() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestPinAdd", tp.TestPinAdd) t.Run("TestPinSimple", tp.TestPinSimple) t.Run("TestPinRecursive", tp.TestPinRecursive) diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index 3462b47551d..b993f51dc55 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -2,12 +2,20 @@ package tests import ( "context" + "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" "testing" "time" ) func (tp *provider) TestPubSub(t *testing.T) { + tp.hasApi(t, func(api iface.CoreAPI) error { + if api.PubSub() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestBasicPubSub", tp.TestBasicPubSub) } diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index f411ad24da5..ddb3145f7a0 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -24,6 +24,13 @@ import ( ) func (tp *provider) TestUnixfs(t *testing.T) { + tp.hasApi(t, func(api coreiface.CoreAPI) error { + if api.Unixfs() == nil { + return apiNotImplemented + } + return nil + }) + t.Run("TestAdd", tp.TestAdd) t.Run("TestAddPinned", tp.TestAddPinned) t.Run("TestAddHashOnly", tp.TestAddHashOnly) From 12b64d0d401e83617eae0e45590c7d8f96e89a48 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 8 Jan 2019 19:19:34 -0800 Subject: [PATCH 166/286] gx: update deps Importantly: * fixes a bunch of MFS bugs * pulls in some bitswap improvements License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@e51dd550f4404781592f8d911ba822512039f304 This commit was moved from ipfs/boxo@551b466a611343bda0eb37d646ef753153919d2a --- core/coreiface/dht.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/swarm.go | 6 +++--- core/coreiface/tests/name.go | 2 +- core/coreiface/tests/unixfs.go | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index e39be92c582..ec8bd92c34d 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + pstore "gx/ipfs/QmPiemjiKBC9VA7vZF82m4x1oygtg2c2YVqag8PX7dN1BD/go-libp2p-peerstore" peer "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" - pstore "gx/ipfs/QmZ9zH2FnLcxv1xyzFeUpDUeo55xEhZQHgveZijcxr7TLj/go-libp2p-peerstore" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index fd748bb4ad8..5f92f3eea41 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -5,7 +5,7 @@ import ( "fmt" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - dag "gx/ipfs/QmdV35UHnL1FM52baPkeUo6u7Fxm2CRUkPTLRPxeF8a4Ap/go-merkledag" + dag "gx/ipfs/QmTQdH4848iTVCJmKXYyRiK72HufWTLYQQ8iN3JaQ8K1Hq/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 96f30852d84..580703a7326 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,8 +1,8 @@ package iface import ( + ipfspath "gx/ipfs/QmNYPETsdAu2uQ1k9q9S1jYEGURaLHV6cbYRSVFVRftpF8/go-path" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - ipfspath "gx/ipfs/QmZErC2Ay6WuGi96CPg316PwitdwgLo6RxZRqVjJjRj2MR/go-path" ) //TODO: merge with ipfspath so we don't depend on it diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 63d20f03513..83e20728241 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,10 +5,10 @@ import ( "errors" "time" - net "gx/ipfs/QmPtFaR7BWHLAjSwLh9kXcyrgTzDpuhcWLkx8ioa9RMYnx/go-libp2p-net" - ma "gx/ipfs/QmRKLtwMw131aK7ugC3G7ybpumMz78YrJe5dzneyindvG1/go-multiaddr" + ma "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr" + net "gx/ipfs/QmNgLg1NTw37iWbYPKcyK85YJ9Whs1MkPtJwhfqbNYAyKg/go-libp2p-net" + pstore "gx/ipfs/QmPiemjiKBC9VA7vZF82m4x1oygtg2c2YVqag8PX7dN1BD/go-libp2p-peerstore" "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" - pstore "gx/ipfs/QmZ9zH2FnLcxv1xyzFeUpDUeo55xEhZQHgveZijcxr7TLj/go-libp2p-peerstore" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" ) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 639e72c3d99..2e43a12eee5 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -8,8 +8,8 @@ import ( "testing" "time" + ipath "gx/ipfs/QmNYPETsdAu2uQ1k9q9S1jYEGURaLHV6cbYRSVFVRftpF8/go-path" "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" - ipath "gx/ipfs/QmZErC2Ay6WuGi96CPg316PwitdwgLo6RxZRqVjJjRj2MR/go-path" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index ddb3145f7a0..e8a1aba32eb 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -15,11 +15,11 @@ import ( coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "gx/ipfs/QmQXze9tG878pa4Euya4rrDpyTNX3kQe4dhCaBzBozGgpe/go-unixfs" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" cbor "gx/ipfs/QmRoARq3nkUb13HSKZGepCZSWe5GrVPwx7xURJGZ7KWv9V/go-ipld-cbor" + mdag "gx/ipfs/QmTQdH4848iTVCJmKXYyRiK72HufWTLYQQ8iN3JaQ8K1Hq/go-merkledag" "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" - "gx/ipfs/Qmbvw7kpSM2p6rbQ57WGRhhqNfCiNGW6EKH4xgHLw4bsnB/go-unixfs" - mdag "gx/ipfs/QmdV35UHnL1FM52baPkeUo6u7Fxm2CRUkPTLRPxeF8a4Ap/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) From ba369e588d63c47bef4252593027cfe363ac54a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 12 Jan 2019 15:41:19 +0100 Subject: [PATCH 167/286] coreapi: replace coreiface.DagAPI with ipld.DAGService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@8e049b49d6e97f38c682aed4b2c18cdb557b3b84 This commit was moved from ipfs/boxo@30ccbef95ef833214b85ad077614b4b07b85c9f1 --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 41 --------------- core/coreiface/options/dag.go | 95 ---------------------------------- core/coreiface/tests/dag.go | 77 ++++++++++++++++++--------- core/coreiface/tests/path.go | 38 +++++++++----- core/coreiface/tests/pin.go | 24 +++++---- core/coreiface/tests/unixfs.go | 6 +-- 7 files changed, 98 insertions(+), 185 deletions(-) delete mode 100644 core/coreiface/dag.go delete mode 100644 core/coreiface/options/dag.go diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 226399967ce..9d2100fcc50 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -19,7 +19,7 @@ type CoreAPI interface { Block() BlockAPI // Dag returns an implementation of Dag API - Dag() DagAPI + Dag() ipld.DAGService // Name returns an implementation of Name API Name() NameAPI diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go deleted file mode 100644 index eb9e2da4a0d..00000000000 --- a/core/coreiface/dag.go +++ /dev/null @@ -1,41 +0,0 @@ -package iface - -import ( - "context" - "io" - - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - - ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" -) - -// DagOps groups operations that can be batched together -type DagOps interface { - // Put inserts data using specified format and input encoding. - // Unless used with WithCodec or WithHash, the defaults "dag-cbor" and - // "sha256" are used. - Put(ctx context.Context, src io.Reader, opts ...options.DagPutOption) (ResolvedPath, error) -} - -// DagBatch is the batching version of DagAPI. All implementations of DagBatch -// should be threadsafe -type DagBatch interface { - DagOps - - // Commit commits nodes to the datastore and announces them to the network - Commit(ctx context.Context) error -} - -// DagAPI specifies the interface to IPLD -type DagAPI interface { - DagOps - - // Get attempts to resolve and get the node specified by the path - Get(ctx context.Context, path Path) (ipld.Node, error) - - // Tree returns list of paths within a node specified by the path. - Tree(ctx context.Context, path Path, opts ...options.DagTreeOption) ([]Path, error) - - // Batch creates new DagBatch - Batch(ctx context.Context) DagBatch -} diff --git a/core/coreiface/options/dag.go b/core/coreiface/options/dag.go deleted file mode 100644 index 9cccba58548..00000000000 --- a/core/coreiface/options/dag.go +++ /dev/null @@ -1,95 +0,0 @@ -package options - -import ( - "math" - - cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" -) - -type DagPutSettings struct { - InputEnc string - Codec uint64 - MhType uint64 - MhLength int -} - -type DagTreeSettings struct { - Depth int -} - -type DagPutOption func(*DagPutSettings) error -type DagTreeOption func(*DagTreeSettings) error - -func DagPutOptions(opts ...DagPutOption) (*DagPutSettings, error) { - options := &DagPutSettings{ - InputEnc: "json", - Codec: cid.DagCBOR, - MhType: math.MaxUint64, - MhLength: -1, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -func DagTreeOptions(opts ...DagTreeOption) (*DagTreeSettings, error) { - options := &DagTreeSettings{ - Depth: -1, - } - - for _, opt := range opts { - err := opt(options) - if err != nil { - return nil, err - } - } - return options, nil -} - -type dagOpts struct{} - -var Dag dagOpts - -// InputEnc is an option for Dag.Put which specifies the input encoding of the -// data. Default is "json", most formats/codecs support "raw" -func (dagOpts) InputEnc(enc string) DagPutOption { - return func(settings *DagPutSettings) error { - settings.InputEnc = enc - return nil - } -} - -// Codec is an option for Dag.Put which specifies the multicodec to use to -// serialize the object. Default is cid.DagCBOR (0x71) -func (dagOpts) Codec(codec uint64) DagPutOption { - return func(settings *DagPutSettings) error { - settings.Codec = codec - return nil - } -} - -// Hash is an option for Dag.Put which specifies the multihash settings to use -// when hashing the object. Default is based on the codec used -// (mh.SHA2_256 (0x12) for DagCBOR). If mhLen is set to -1, default length for -// the hash will be used -func (dagOpts) Hash(mhType uint64, mhLen int) DagPutOption { - return func(settings *DagPutSettings) error { - settings.MhType = mhType - settings.MhLength = mhLen - return nil - } -} - -// Depth is an option for Dag.Tree which specifies maximum depth of the -// returned tree. Default is -1 (no depth limit) -func (dagOpts) Depth(depth int) DagTreeOption { - return func(settings *DagTreeSettings) error { - settings.Depth = depth - return nil - } -} diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 70a45aa204c..e66106c3327 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -2,12 +2,13 @@ package tests import ( "context" + "math" "path" "strings" "testing" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" - opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + coredag "github.com/ipfs/go-ipfs/core/coredag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) @@ -45,13 +46,18 @@ func (tp *provider) TestPut(t *testing.T) { t.Error(err) } - res, err := api.Dag().Put(ctx, strings.NewReader(`"Hello"`)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`"Hello"`), math.MaxUint64, -1) + if err != nil { + t.Error(err) + } + + err = api.Dag().Add(ctx, nds[0]) if err != nil { t.Fatal(err) } - if res.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { - t.Errorf("got wrong cid: %s", res.Cid().String()) + if nds[0].Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { + t.Errorf("got wrong cid: %s", nds[0].Cid().String()) } } @@ -63,13 +69,18 @@ func (tp *provider) TestPutWithHash(t *testing.T) { t.Error(err) } - res, err := api.Dag().Put(ctx, strings.NewReader(`"Hello"`), opt.Dag.Hash(mh.ID, -1)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`"Hello"`), mh.ID, -1) + if err != nil { + t.Error(err) + } + + err = api.Dag().Add(ctx, nds[0]) if err != nil { t.Fatal(err) } - if res.Cid().String() != "z5hRLNd2sv4z1c" { - t.Errorf("got wrong cid: %s", res.Cid().String()) + if nds[0].Cid().String() != "z5hRLNd2sv4z1c" { + t.Errorf("got wrong cid: %s", nds[0].Cid().String()) } } @@ -81,28 +92,43 @@ func (tp *provider) TestDagPath(t *testing.T) { t.Error(err) } - sub, err := api.Dag().Put(ctx, strings.NewReader(`"foo"`)) + snds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`"foo"`), math.MaxUint64, -1) + if err != nil { + t.Error(err) + } + + err = api.Dag().Add(ctx, snds[0]) if err != nil { t.Fatal(err) } - res, err := api.Dag().Put(ctx, strings.NewReader(`{"lnk": {"/": "`+sub.Cid().String()+`"}}`)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"lnk": {"/": "`+snds[0].Cid().String()+`"}}`), math.MaxUint64, -1) + if err != nil { + t.Error(err) + } + + err = api.Dag().Add(ctx, nds[0]) if err != nil { t.Fatal(err) } - p, err := coreiface.ParsePath(path.Join(res.Cid().String(), "lnk")) + p, err := coreiface.ParsePath(path.Join(nds[0].Cid().String(), "lnk")) if err != nil { t.Error(err) } - nd, err := api.Dag().Get(ctx, p) + rp, err := api.ResolvePath(ctx, p) if err != nil { t.Error(err) } - if nd.Cid().String() != sub.Cid().String() { - t.Errorf("got unexpected cid %s, expected %s", nd.Cid().String(), sub.Cid().String()) + nd, err := api.Dag().Get(ctx, rp.Cid()) + if err != nil { + t.Error(err) + } + + if nd.Cid().String() != snds[0].Cid().String() { + t.Errorf("got unexpected cid %s, expected %s", nd.Cid().String(), snds[0].Cid().String()) } } @@ -114,12 +140,17 @@ func (tp *provider) TestTree(t *testing.T) { t.Error(err) } - c, err := api.Dag().Put(ctx, strings.NewReader(`{"a": 123, "b": "foo", "c": {"d": 321, "e": 111}}`)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"a": 123, "b": "foo", "c": {"d": 321, "e": 111}}`), math.MaxUint64, -1) + if err != nil { + t.Error(err) + } + + err = api.Dag().Add(ctx, nds[0]) if err != nil { t.Fatal(err) } - res, err := api.Dag().Get(ctx, c) + res, err := api.Dag().Get(ctx, nds[0].Cid()) if err != nil { t.Error(err) } @@ -144,27 +175,25 @@ func (tp *provider) TestBatch(t *testing.T) { t.Error(err) } - batch := api.Dag().Batch(ctx) - - c, err := batch.Put(ctx, strings.NewReader(`"Hello"`)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`"Hello"`), math.MaxUint64, -1) if err != nil { - t.Fatal(err) + t.Error(err) } - if c.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { - t.Errorf("got wrong cid: %s", c.Cid().String()) + if nds[0].Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { + t.Errorf("got wrong cid: %s", nds[0].Cid().String()) } - _, err = api.Dag().Get(ctx, c) + _, err = api.Dag().Get(ctx, nds[0].Cid()) if err == nil || err.Error() != "merkledag: not found" { t.Error(err) } - if err := batch.Commit(ctx); err != nil { + if err := api.Dag().AddMany(ctx, nds); err != nil { t.Error(err) } - _, err = api.Dag().Get(ctx, c) + _, err = api.Dag().Get(ctx, nds[0].Cid()) if err != nil { t.Error(err) } diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 50a1977d50b..01f2e6f36bb 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -2,11 +2,13 @@ package tests import ( "context" + "math" "strings" "testing" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/go-ipfs/core/coredag" ) func (tp *provider) TestPath(t *testing.T) { @@ -62,12 +64,16 @@ func (tp *provider) TestPathRemainder(t *testing.T) { t.Fatal(".Dag not implemented") } - obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { + t.Error(err) + } + + if err := api.Dag().AddMany(ctx, nds); err != nil { t.Fatal(err) } - p1, err := coreiface.ParsePath(obj.String() + "/foo/bar") + p1, err := coreiface.ParsePath(nds[0].String() + "/foo/bar") if err != nil { t.Error(err) } @@ -94,16 +100,16 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { t.Fatal(".Dag not implemented") } - obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { - t.Fatal(err) + t.Error(err) } - if obj.Remainder() != "" { - t.Error("expected the resolved path to not have a remainder") + if err := api.Dag().AddMany(ctx, nds); err != nil { + t.Fatal(err) } - p1, err := coreiface.ParsePath(obj.String()) + p1, err := coreiface.ParsePath(nds[0].Cid().String()) if err != nil { t.Error(err) } @@ -130,12 +136,16 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { t.Fatal(".Dag not implemented") } - obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"bar": "baz"}}`)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { + t.Error(err) + } + + if err := api.Dag().AddMany(ctx, nds); err != nil { t.Fatal(err) } - p1, err := coreiface.ParsePath(obj.String() + "/bar/baz") + p1, err := coreiface.ParsePath("/ipld/" + nds[0].Cid().String() + "/bar/baz") if err != nil { t.Error(err) } @@ -167,12 +177,16 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Fatal(".Dag not implemented") } - obj, err := api.Dag().Put(ctx, strings.NewReader(`{"foo": {"/": "`+blk.Path().Cid().String()+`"}}`)) + nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"foo": {"/": "`+blk.Path().Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { + t.Error(err) + } + + if err := api.Dag().AddMany(ctx, nds); err != nil { t.Fatal(err) } - p1, err := coreiface.ParsePath(obj.String() + "/foo") + p1, err := coreiface.ParsePath("/ipld/" + nds[0].Cid().String() + "/foo") if err != nil { t.Error(err) } @@ -182,7 +196,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Fatal(err) } - if rp.Root().String() != obj.Cid().String() { + if rp.Root().String() != nds[0].Cid().String() { t.Error("unexpected path root") } diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 87ad8a00489..25079922226 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -2,11 +2,13 @@ package tests import ( "context" - "github.com/ipfs/go-ipfs/core/coreapi/interface" + "math" "strings" "testing" + "github.com/ipfs/go-ipfs/core/coreapi/interface" opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/go-ipfs/core/coredag" ) func (tp *provider) TestPin(t *testing.T) { @@ -109,22 +111,26 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Error(err) } - p2, err := api.Dag().Put(ctx, strings.NewReader(`{"lnk": {"/": "`+p0.Cid().String()+`"}}`)) + nd2, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"lnk": {"/": "`+p0.Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - p3, err := api.Dag().Put(ctx, strings.NewReader(`{"lnk": {"/": "`+p1.Cid().String()+`"}}`)) + nd3, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"lnk": {"/": "`+p1.Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - err = api.Pin().Add(ctx, p2) + if err := api.Dag().AddMany(ctx, append(nd2, nd3...)); err != nil { + t.Fatal(err) + } + + err = api.Pin().Add(ctx, iface.IpldPath(nd2[0].Cid())) if err != nil { t.Error(err) } - err = api.Pin().Add(ctx, p3, opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, iface.IpldPath(nd3[0].Cid()), opt.Pin.Recursive(false)) if err != nil { t.Error(err) } @@ -147,8 +153,8 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().String() != p3.String() { - t.Error("unexpected path") + if list[0].Path().String() != iface.IpldPath(nd3[0].Cid()).String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), iface.IpfsPath(nd2[0].Cid()).String()) } list, err = api.Pin().Ls(ctx, opt.Pin.Type.Recursive()) @@ -160,8 +166,8 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().String() != p2.String() { - t.Error("unexpected path") + if list[0].Path().String() != iface.IpldPath(nd2[0].Cid()).String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), iface.IpldPath(nd3[0].Cid()).String()) } list, err = api.Pin().Ls(ctx, opt.Pin.Type.Indirect()) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index e8a1aba32eb..fce41ae8490 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -633,7 +633,7 @@ func (tp *provider) TestGetDir(t *testing.T) { t.Error(err) } edir := unixfs.EmptyDirNode() - _, err = api.Dag().Put(ctx, bytes.NewReader(edir.RawData()), options.Dag.Codec(cid.DagProtobuf), options.Dag.InputEnc("raw")) + err = api.Dag().Add(ctx, edir) if err != nil { t.Error(err) } @@ -667,7 +667,7 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) { } nd := new(mdag.ProtoNode) - _, err = api.Dag().Put(ctx, bytes.NewReader(nd.RawData()), options.Dag.Codec(nd.CidBuilder().GetCodec()), options.Dag.InputEnc("raw")) + err = api.Dag().Add(ctx, nd) if err != nil { t.Error(err) } @@ -801,7 +801,7 @@ func (tp *provider) TestLsNonUnixfs(t *testing.T) { t.Fatal(err) } - _, err = api.Dag().Put(ctx, bytes.NewReader(nd.RawData()), options.Dag.Codec(cid.DagCBOR), options.Dag.InputEnc("raw")) + err = api.Dag().Add(ctx, nd) if err != nil { t.Error(err) } From c1541fd86aa57b888199ad17018a99365ecd5af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 15 Jan 2019 18:51:29 +0100 Subject: [PATCH 168/286] coreapi: adjust some tests for go-ipfs-http-api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@fb15570caa8ff7cb9defce24198738273b23aa16 This commit was moved from ipfs/boxo@6d44270b3a49474f67a51f0fcddfbf40766363be --- core/coreiface/tests/block.go | 4 ++-- core/coreiface/tests/dht.go | 20 ++++++++++++++++++-- core/coreiface/tests/key.go | 16 ++++++++-------- core/coreiface/tests/object.go | 2 +- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 81a6fb0617b..427ad3357be 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -159,7 +159,7 @@ func (tp *provider) TestBlockRm(t *testing.T) { if err == nil { t.Error("expected err to exist") } - if err.Error() != "blockservice: key not found" { + if !strings.Contains(err.Error(), "blockservice: key not found") { t.Errorf("unexpected error; %s", err.Error()) } @@ -167,7 +167,7 @@ func (tp *provider) TestBlockRm(t *testing.T) { if err == nil { t.Error("expected err to exist") } - if err.Error() != "blockstore: block not found" { + if !strings.Contains(err.Error(), "blockstore: block not found") { t.Errorf("unexpected error; %s", err.Error()) } diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 3ec77d33bf1..d2eae1af479 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -35,12 +35,20 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) { t.Fatal(err) } + laddrs0, err := apis[0].Swarm().LocalAddrs(ctx) + if err != nil { + t.Fatal(err) + } + if len(laddrs0) != 1 { + t.Fatal("unexpected number of local addrs") + } + pi, err := apis[2].Dht().FindPeer(ctx, self0.ID()) if err != nil { t.Fatal(err) } - if pi.Addrs[0].String() != "/ip4/127.0.0.1/tcp/4001" { + if pi.Addrs[0].String() != laddrs0[0].String() { t.Errorf("got unexpected address from FindPeer: %s", pi.Addrs[0].String()) } @@ -54,7 +62,15 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) { t.Fatal(err) } - if pi.Addrs[0].String() != "/ip4/127.0.2.1/tcp/4001" { + laddrs2, err := apis[2].Swarm().LocalAddrs(ctx) + if err != nil { + t.Fatal(err) + } + if len(laddrs2) != 1 { + t.Fatal("unexpected number of local addrs") + } + + if pi.Addrs[0].String() != laddrs2[0].String() { t.Errorf("got unexpected address from FindPeer: %s", pi.Addrs[0].String()) } } diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index 8dd6af57f48..66011f99f9c 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -82,7 +82,7 @@ func (tp *provider) TestRenameSelf(t *testing.T) { if err == nil { t.Error("expected error to not be nil") } else { - if err.Error() != "cannot rename key with name 'self'" { + if !strings.Contains(err.Error(), "cannot rename key with name 'self'") { t.Fatalf("expected error 'cannot rename key with name 'self'', got '%s'", err.Error()) } } @@ -91,7 +91,7 @@ func (tp *provider) TestRenameSelf(t *testing.T) { if err == nil { t.Error("expected error to not be nil") } else { - if err.Error() != "cannot rename key with name 'self'" { + if !strings.Contains(err.Error(), "cannot rename key with name 'self'") { t.Fatalf("expected error 'cannot rename key with name 'self'', got '%s'", err.Error()) } } @@ -110,7 +110,7 @@ func (tp *provider) TestRemoveSelf(t *testing.T) { if err == nil { t.Error("expected error to not be nil") } else { - if err.Error() != "cannot remove key with name 'self'" { + if !strings.Contains(err.Error(), "cannot remove key with name 'self'") { t.Fatalf("expected error 'cannot remove key with name 'self'', got '%s'", err.Error()) } } @@ -206,7 +206,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) { if err == nil { t.Error("expected error to not be nil") } else { - if err.Error() != "key with name 'foo' already exists" { + if !strings.Contains(err.Error(), "key with name 'foo' already exists") { t.Fatalf("expected error 'key with name 'foo' already exists', got '%s'", err.Error()) } } @@ -215,7 +215,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) { if err == nil { t.Error("expected error to not be nil") } else { - if err.Error() != "cannot create key with name 'self'" { + if !strings.Contains(err.Error(), "cannot create key with name 'self'") { t.Fatalf("expected error 'cannot create key with name 'self'', got '%s'", err.Error()) } } @@ -314,7 +314,7 @@ func (tp *provider) TestRenameToSelf(t *testing.T) { if err == nil { t.Error("expected error to not be nil") } else { - if err.Error() != "cannot overwrite key with name 'self'" { + if !strings.Contains(err.Error(), "cannot overwrite key with name 'self'") { t.Fatalf("expected error 'cannot overwrite key with name 'self'', got '%s'", err.Error()) } } @@ -338,7 +338,7 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) { if err == nil { t.Error("expected error to not be nil") } else { - if err.Error() != "cannot overwrite key with name 'self'" { + if !strings.Contains(err.Error(), "cannot overwrite key with name 'self'") { t.Fatalf("expected error 'cannot overwrite key with name 'self'', got '%s'", err.Error()) } } @@ -368,7 +368,7 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { if err == nil { t.Error("expected error to not be nil") } else { - if err.Error() != "key by that name already exists, refusing to overwrite" { + if !strings.Contains(err.Error(), "key by that name already exists, refusing to overwrite") { t.Fatalf("expected error 'key by that name already exists, refusing to overwrite', got '%s'", err.Error()) } } diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 81d5b4117ce..2a3b1bd5ca6 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -300,7 +300,7 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { if err == nil { t.Fatal("expected an error") } - if err.Error() != "no link by that name" { + if !strings.Contains(err.Error(), "no link by that name") { t.Fatalf("unexpected error: %s", err.Error()) } From f2b47a6665c0ef780d1329b85cb251f8e368ae99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 11 Jan 2019 12:49:50 +0100 Subject: [PATCH 169/286] ls: report real size by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@d48b9e1c1f2c70766f5fd1cb13f872ec86075d4d This commit was moved from ipfs/boxo@b1caa58eae01f9d6623c504be4085c32ebc675f5 --- core/coreiface/tests/unixfs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index e8a1aba32eb..9e1454c4170 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -704,8 +704,8 @@ func (tp *provider) TestLs(t *testing.T) { if len(links) != 1 { t.Fatalf("expected 1 link, got %d", len(links)) } - if links[0].Size != 23 { - t.Fatalf("expected size = 23, got %d", links[0].Size) + if links[0].Size != 15 { + t.Fatalf("expected size = 15, got %d", links[0].Size) } if links[0].Name != "name-of-file" { t.Fatalf("expected name = name-of-file, got %s", links[0].Name) From dbeaf11b3970d6597b0b013712eda5b73b52242b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 11 Jan 2019 13:16:47 +0100 Subject: [PATCH 170/286] ls: skip size for directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@6c323ff16d39002eec98b8ae6337f7050937e0d8 This commit was moved from ipfs/boxo@100779d936550209ee7020525cb7b3ff0639787f --- core/coreiface/tests/unixfs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 9e1454c4170..e8a1aba32eb 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -704,8 +704,8 @@ func (tp *provider) TestLs(t *testing.T) { if len(links) != 1 { t.Fatalf("expected 1 link, got %d", len(links)) } - if links[0].Size != 15 { - t.Fatalf("expected size = 15, got %d", links[0].Size) + if links[0].Size != 23 { + t.Fatalf("expected size = 23, got %d", links[0].Size) } if links[0].Name != "name-of-file" { t.Fatalf("expected name = name-of-file, got %s", links[0].Name) From 20eafc59a59e7a5fc86f98603ad90b59450d1810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 21 Jan 2019 21:31:52 +0100 Subject: [PATCH 171/286] coreapi: few more error check fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@b4e7753bacca7684d5e70294f766948fd77bf1c7 This commit was moved from ipfs/boxo@b92dcf5817ba9154db34f6156ad70836b7669b03 --- core/coreiface/tests/dag.go | 2 +- core/coreiface/tests/path.go | 2 +- core/coreiface/tests/unixfs.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index e66106c3327..10fab125a22 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -185,7 +185,7 @@ func (tp *provider) TestBatch(t *testing.T) { } _, err = api.Dag().Get(ctx, nds[0].Cid()) - if err == nil || err.Error() != "merkledag: not found" { + if err == nil || !strings.Contains(err.Error(), "not found") { t.Error(err) } diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 01f2e6f36bb..e7df6f1fb7c 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -151,7 +151,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { } _, err = api.ResolvePath(ctx, p1) - if err == nil || err.Error() != "no such link found" { + if err == nil || !strings.Contains(err.Error(), "no such link found") { t.Fatalf("unexpected error: %s", err) } } diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index fce41ae8490..0ef3f031e54 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -587,7 +587,7 @@ func (tp *provider) TestAddHashOnly(t *testing.T) { if err == nil { t.Fatal("expected an error") } - if err.Error() != "blockservice: key not found" { + if !strings.Contains(err.Error(), "blockservice: key not found") { t.Errorf("unxepected error: %s", err.Error()) } } From 75fce9a3291127ed14cee84d4de50c2b0e3d9c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 22 Jan 2019 21:01:19 +0100 Subject: [PATCH 172/286] Port dag commansds to CoreAPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@f40d44ddbfd929eb84316d66e895f93dedf47424 This commit was moved from ipfs/boxo@9eb0432c770d33d2b1c15ea25e5d3974654e843f --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 core/coreiface/dag.go diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 9d2100fcc50..16b28182e6f 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -19,7 +19,7 @@ type CoreAPI interface { Block() BlockAPI // Dag returns an implementation of Dag API - Dag() ipld.DAGService + Dag() APIDagService // Name returns an implementation of Name API Name() NameAPI diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go new file mode 100644 index 00000000000..455d0045035 --- /dev/null +++ b/core/coreiface/dag.go @@ -0,0 +1,13 @@ +package iface + +import ( + ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" +) + +// APIDagService extends ipld.DAGService +type APIDagService interface { + ipld.DAGService + + // Pinning returns special NodeAdder which recursively pins added nodes + Pinning() ipld.NodeAdder +} From a437ea3e4e7ccf705adb78a7203fb9856861b7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 14 Jan 2019 21:01:39 +0100 Subject: [PATCH 173/286] Unixfs.Add nocopy test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@e49c3d2211a09a5bfa5c5eceeeaf08715b230313 This commit was moved from ipfs/boxo@f542e9c788b6601c072ec7408e73a9057921a0b2 --- core/coreiface/tests/unixfs.go | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 0ef3f031e54..0ceae06e1d9 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -101,6 +101,34 @@ func (tp *provider) TestAdd(t *testing.T) { return coreiface.IpfsPath(c) } + rf, err := ioutil.TempFile(os.TempDir(), "unixfs-add-real") + if err != nil { + t.Fatal(err) + } + rfp := rf.Name() + + if _, err := rf.Write([]byte(helloStr)); err != nil { + t.Fatal(err) + } + + stat, err := rf.Stat() + if err != nil { + t.Fatal(err) + } + + if err := rf.Close(); err != nil { + t.Fatal(err) + } + defer os.Remove(rfp) + + realFile := func() files.Node { + n, err := files.NewReaderPathFile(rfp, ioutil.NopCloser(strings.NewReader(helloStr)), stat) + if err != nil { + t.Fatal(err) + } + return n + } + cases := []struct { name string data func() files.Node @@ -323,6 +351,20 @@ func (tp *provider) TestAdd(t *testing.T) { path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp", opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)}, }, + // NoCopy + { + name: "simpleNoCopy", + data: realFile, + path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + opts: []options.UnixfsAddOption{options.Unixfs.Nocopy(true)}, + }, + { + name: "noCopyNoRaw", + data: realFile, + path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + opts: []options.UnixfsAddOption{options.Unixfs.Nocopy(true), options.Unixfs.RawLeaves(false)}, + err: "nocopy option requires '--raw-leaves' to be enabled as well", + }, // Events / Progress { name: "simpleAddEvent", From f590838d14beed45d05b5db680eb4d010470123d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 14 Jan 2019 22:00:57 +0100 Subject: [PATCH 174/286] Unixfs: enforce refs on files when using nocopy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@3de10ba1bd3faefa63d1c9353a7ac47c5de45d2d This commit was moved from ipfs/boxo@089430e39729baec439315f08826de38643a99fb --- core/coreiface/tests/unixfs.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 0ceae06e1d9..fdc1a08cd0c 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -16,6 +16,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" "gx/ipfs/QmQXze9tG878pa4Euya4rrDpyTNX3kQe4dhCaBzBozGgpe/go-unixfs" + "gx/ipfs/QmQXze9tG878pa4Euya4rrDpyTNX3kQe4dhCaBzBozGgpe/go-unixfs/importer/helpers" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" cbor "gx/ipfs/QmRoARq3nkUb13HSKZGepCZSWe5GrVPwx7xURJGZ7KWv9V/go-ipld-cbor" mdag "gx/ipfs/QmTQdH4848iTVCJmKXYyRiK72HufWTLYQQ8iN3JaQ8K1Hq/go-merkledag" @@ -365,6 +366,13 @@ func (tp *provider) TestAdd(t *testing.T) { opts: []options.UnixfsAddOption{options.Unixfs.Nocopy(true), options.Unixfs.RawLeaves(false)}, err: "nocopy option requires '--raw-leaves' to be enabled as well", }, + { + name: "noCopyNoPath", + data: strFile(helloStr), + path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + opts: []options.UnixfsAddOption{options.Unixfs.Nocopy(true)}, + err: helpers.ErrMissingFsRef.Error(), + }, // Events / Progress { name: "simpleAddEvent", From d40a54caaf9cfee2f0efb3412c3eb6094e838c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 14 Jan 2019 22:05:10 +0100 Subject: [PATCH 175/286] gx: update go-unixfs to 1.2.14 and go-bitswap to 1.1.21 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (and everything else...) License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@3cc6578657ac8580d77f93a681f80ceeba1d6389 This commit was moved from ipfs/boxo@99fe5e7502f9c05b67e338490b47816d4434aa71 --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/object.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/tests/name.go | 2 +- core/coreiface/tests/unixfs.go | 8 ++++---- core/coreiface/unixfs.go | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 16b28182e6f..d26ec4f7d1a 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -7,7 +7,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" + ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index 455d0045035..d15e24360e1 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -1,7 +1,7 @@ package iface import ( - ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" + ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" ) // APIDagService extends ipld.DAGService diff --git a/core/coreiface/object.go b/core/coreiface/object.go index ba6f5a95d63..2ed357cb63a 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -7,7 +7,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" + ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 5f92f3eea41..109a63f1d8c 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -5,7 +5,7 @@ import ( "fmt" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - dag "gx/ipfs/QmTQdH4848iTVCJmKXYyRiK72HufWTLYQQ8iN3JaQ8K1Hq/go-merkledag" + dag "gx/ipfs/Qmb2UEG2TAeVrEJSjqsZF7Y2he7wRDkrdt6c3bECxwZf4k/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 580703a7326..b96e0e77570 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,8 +1,8 @@ package iface import ( - ipfspath "gx/ipfs/QmNYPETsdAu2uQ1k9q9S1jYEGURaLHV6cbYRSVFVRftpF8/go-path" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" + ipfspath "gx/ipfs/QmWqh9oob7ZHQRwU5CdTqpnC8ip8BEkFNrwXRxeNo5Y7vA/go-path" ) //TODO: merge with ipfspath so we don't depend on it diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 2e43a12eee5..7b0a5d8f08c 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -8,7 +8,7 @@ import ( "testing" "time" - ipath "gx/ipfs/QmNYPETsdAu2uQ1k9q9S1jYEGURaLHV6cbYRSVFVRftpF8/go-path" + ipath "gx/ipfs/QmWqh9oob7ZHQRwU5CdTqpnC8ip8BEkFNrwXRxeNo5Y7vA/go-path" "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index fdc1a08cd0c..6f10406ebfa 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -15,12 +15,12 @@ import ( coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmQXze9tG878pa4Euya4rrDpyTNX3kQe4dhCaBzBozGgpe/go-unixfs" - "gx/ipfs/QmQXze9tG878pa4Euya4rrDpyTNX3kQe4dhCaBzBozGgpe/go-unixfs/importer/helpers" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - cbor "gx/ipfs/QmRoARq3nkUb13HSKZGepCZSWe5GrVPwx7xURJGZ7KWv9V/go-ipld-cbor" - mdag "gx/ipfs/QmTQdH4848iTVCJmKXYyRiK72HufWTLYQQ8iN3JaQ8K1Hq/go-merkledag" + cbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" + "gx/ipfs/QmSMJ4rZbCJaih3y82Ebq7BZqK6vU2FHsKcWKQiE1DPTpS/go-unixfs" + "gx/ipfs/QmSMJ4rZbCJaih3y82Ebq7BZqK6vU2FHsKcWKQiE1DPTpS/go-unixfs/importer/helpers" "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" + mdag "gx/ipfs/Qmb2UEG2TAeVrEJSjqsZF7Y2he7wRDkrdt6c3bECxwZf4k/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index b42b454cc2a..3c27881967c 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" files "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" - ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format" ) type AddEvent struct { From 0f40b6847509dd7a52c54d9931dc9230e39ed4f3 Mon Sep 17 00:00:00 2001 From: Overbool Date: Thu, 13 Dec 2018 23:02:55 +0800 Subject: [PATCH 176/286] cmds/pin: use coreapi/pin License: MIT Signed-off-by: Overbool This commit was moved from ipfs/interface-go-ipfs-core@3e1cd71bb97f70a6309fa31f3d9e719c7b38f254 This commit was moved from ipfs/boxo@6b2d6ab3cdddb3db4b653e82ac78560e2c1b842f --- core/coreiface/options/pin.go | 36 ++++++++++++++++++++++++++++++++++- core/coreiface/pin.go | 2 +- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index 9d1107f927d..630b561de4c 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -8,12 +8,23 @@ type PinLsSettings struct { Type string } +// PinRmSettings represents the settings of pin rm command +type PinRmSettings struct { + Recursive bool + Force bool +} + type PinUpdateSettings struct { Unpin bool } type PinAddOption func(*PinAddSettings) error -type PinLsOption func(settings *PinLsSettings) error + +// PinRmOption pin rm option func +type PinRmOption func(*PinRmSettings) error + +// PinLsOption pin ls option func +type PinLsOption func(*PinLsSettings) error type PinUpdateOption func(*PinUpdateSettings) error func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { @@ -31,6 +42,21 @@ func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { return options, nil } +// PinRmOptions pin rm options +func PinRmOptions(opts ...PinRmOption) (*PinRmSettings, error) { + options := &PinRmSettings{ + Recursive: true, + } + + for _, opt := range opts { + if err := opt(options); err != nil { + return nil, err + } + } + + return options, nil +} + func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { options := &PinLsSettings{ Type: "all", @@ -102,6 +128,14 @@ func (pinOpts) Recursive(recursive bool) PinAddOption { } } +// RmRecursive is an option for Pin.Rm +func (pinOpts) RmRecursive(recursive bool) PinRmOption { + return func(settings *PinRmSettings) error { + settings.Recursive = recursive + return nil + } +} + // Type is an option for Pin.Ls which allows to specify which pin types should // be returned // diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 2e119cbeae8..6e13def8f54 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -43,7 +43,7 @@ type PinAPI interface { Ls(context.Context, ...options.PinLsOption) ([]Pin, error) // Rm removes pin for object specified by the path - Rm(context.Context, Path) error + Rm(context.Context, Path, ...options.PinRmOption) error // Update changes one pin to another, skipping checks for matching paths in // the old tree From bcc6216709b9f782931d640abeaa7f14563f5d06 Mon Sep 17 00:00:00 2001 From: Overbool Date: Sat, 15 Dec 2018 11:14:29 +0800 Subject: [PATCH 177/286] cmds/pin: modify test License: MIT Signed-off-by: Overbool This commit was moved from ipfs/interface-go-ipfs-core@8e9e8d1b419aa93da6f3573bf424db57a60399ae This commit was moved from ipfs/boxo@e3960a2b9f8f40403f8ffbce29e576a217dbbf74 --- core/coreiface/options/pin.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index 630b561de4c..cc4a8ef2966 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -11,7 +11,6 @@ type PinLsSettings struct { // PinRmSettings represents the settings of pin rm command type PinRmSettings struct { Recursive bool - Force bool } type PinUpdateSettings struct { From e00e0dfed2c142410b5878783818ba29569acad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 30 Jan 2019 17:42:14 +0100 Subject: [PATCH 178/286] gx: update go-unixfs to propagate archive changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@fbde8e2781a69d29530a3a55c8007f135d65e25e This commit was moved from ipfs/boxo@c6503a1ba9fa4f111fd0ca2975a9f7285d5d4768 --- core/coreiface/tests/name.go | 2 +- core/coreiface/tests/unixfs.go | 6 +++--- core/coreiface/unixfs.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 7b0a5d8f08c..8690f22c31e 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -9,7 +9,7 @@ import ( "time" ipath "gx/ipfs/QmWqh9oob7ZHQRwU5CdTqpnC8ip8BEkFNrwXRxeNo5Y7vA/go-path" - "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" + "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 6f10406ebfa..2f1ab90a42f 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -15,11 +15,11 @@ import ( coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs" + "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs/importer/helpers" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" cbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" - "gx/ipfs/QmSMJ4rZbCJaih3y82Ebq7BZqK6vU2FHsKcWKQiE1DPTpS/go-unixfs" - "gx/ipfs/QmSMJ4rZbCJaih3y82Ebq7BZqK6vU2FHsKcWKQiE1DPTpS/go-unixfs/importer/helpers" - "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" + "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" mdag "gx/ipfs/Qmb2UEG2TAeVrEJSjqsZF7Y2he7wRDkrdt6c3bECxwZf4k/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 3c27881967c..408280cbcb8 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -6,7 +6,7 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" - files "gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files" + files "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" ) type AddEvent struct { From 8f0b53d1f78c8eb7c2977416ba492ad6c21be47e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 21 Jan 2019 12:30:34 +0100 Subject: [PATCH 179/286] coreapi: add some seeker tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@be8e8d1aebcd3b544b0b9c345338ed9c55bbfe1c This commit was moved from ipfs/boxo@ac20c6ad8101683bb28e0a57955bcefc454a959f --- core/coreiface/tests/unixfs.go | 105 +++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 2f1ab90a42f..5ae2739878b 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -3,9 +3,11 @@ package tests import ( "bytes" "context" + "fmt" "io" "io/ioutil" "math" + "math/rand" "os" "strconv" "strings" @@ -43,6 +45,7 @@ func (tp *provider) TestUnixfs(t *testing.T) { t.Run("TestLsEmptyDir", tp.TestLsEmptyDir) t.Run("TestLsNonUnixfs", tp.TestLsNonUnixfs) t.Run("TestAddCloses", tp.TestAddCloses) + t.Run("TestGetSeek", tp.TestGetSeek) } // `echo -n 'hello, world!' | ipfs add` @@ -934,5 +937,107 @@ func (tp *provider) TestAddCloses(t *testing.T) { t.Errorf("dir %d not closed!", i) } } +} + +func (tp *provider) TestGetSeek(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Error(err) + } + + dataSize := int64(100000) + tf := files.NewReaderFile(io.LimitReader(rand.New(rand.NewSource(1403768328)), dataSize)) + + p, err := api.Unixfs().Add(ctx, tf, options.Unixfs.Chunker("size-100")) + if err != nil { + t.Fatal(err) + } + + r, err := api.Unixfs().Get(ctx, p) + if err != nil { + t.Fatal(err) + } + + f := files.ToFile(r) + if f == nil { + t.Fatal("not a file") + } + + orig := make([]byte, dataSize) + if _, err := f.Read(orig); err != nil { + t.Fatal(err) + } + f.Close() + + origR := bytes.NewReader(orig) + + r, err = api.Unixfs().Get(ctx, p) + if err != nil { + t.Fatal(err) + } + + f = files.ToFile(r) + if f == nil { + t.Fatal("not a file") + } + + test := func(offset int64, whence int, read int, expect int64, shouldEof bool) { + t.Run(fmt.Sprintf("seek%d+%d-r%d-%d", whence, offset, read, expect), func(t *testing.T) { + n, err := f.Seek(offset, whence) + if err != nil { + t.Fatal(err) + } + origN, err := origR.Seek(offset, whence) + if err != nil { + t.Fatal(err) + } + + if n != origN { + t.Fatalf("offsets didn't match, expected %d, got %d", origN, n) + } + + buf := make([]byte, read) + origBuf := make([]byte, read) + origRead, err := origR.Read(origBuf) + if err != nil { + t.Fatalf("orig: %s", err) + } + r, err := f.Read(buf) + switch { + case shouldEof && err != nil && err != io.EOF: + fallthrough + case !shouldEof && err != nil: + t.Fatalf("f: %s", err) + case shouldEof: + _, err := f.Read([]byte{0}) + if err != io.EOF { + t.Fatal("expected EOF") + } + _, err = origR.Read([]byte{0}) + if err != io.EOF { + t.Fatal("expected EOF (orig)") + } + } + + if int64(r) != expect { + t.Fatal("read wrong amount of data") + } + if r != origRead { + t.Fatal("read different amount of data than bytes.Reader") + } + if !bytes.Equal(buf, origBuf) { + t.Fatal("data didn't match") + } + }) + } + test(3, io.SeekCurrent, 10, 10, false) + test(3, io.SeekCurrent, 10, 10, false) + test(500, io.SeekCurrent, 10, 10, false) + test(350, io.SeekStart, 100, 100, false) + test(-123, io.SeekCurrent, 100, 100, false) + test(dataSize-50, io.SeekStart, 100, 50, true) + test(-5, io.SeekEnd, 100, 5, true) } From aeb9cdfae0878d4954ecc2cdc570168449887463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 1 Feb 2019 19:48:43 +0100 Subject: [PATCH 180/286] coreapi: use chan for returning results in Unixfs.Ls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@93175e9900f58425d3868381c3a8668500ac39a9 This commit was moved from ipfs/boxo@3afaf889d4d49000482655a90591acdd3eb16349 --- core/coreiface/tests/unixfs.go | 18 ++++++++++-------- core/coreiface/unixfs.go | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 5ae2739878b..68d408e6c89 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -754,18 +754,20 @@ func (tp *provider) TestLs(t *testing.T) { t.Error(err) } - if len(links) != 1 { - t.Fatalf("expected 1 link, got %d", len(links)) + link := <- links + if link.Size != 23 { + t.Fatalf("expected size = 23, got %d", link.Size) } - if links[0].Size != 23 { - t.Fatalf("expected size = 23, got %d", links[0].Size) + if link.Name != "name-of-file" { + t.Fatalf("expected name = name-of-file, got %s", link.Name) } - if links[0].Name != "name-of-file" { - t.Fatalf("expected name = name-of-file, got %s", links[0].Name) + if link.Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { + t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", link.Cid) } - if links[0].Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { - t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", links[0].Cid) + if _, ok := <-links; ok { + t.Errorf("didn't expect a second link") } + } func (tp *provider) TestEntriesExpired(t *testing.T) { diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 408280cbcb8..cdb6a1e0ce3 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -31,5 +31,5 @@ type UnixfsAPI interface { Get(context.Context, Path) (files.Node, error) // Ls returns the list of links in a directory - Ls(context.Context, Path) ([]*ipld.Link, error) + Ls(context.Context, Path) (<-chan *ipld.Link, error) } From 9f4c14741c76ab5c65de43a7871bbb24609b72d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 1 Feb 2019 20:12:48 +0100 Subject: [PATCH 181/286] coreapi: asunc ls option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@72006bfe2d78cd6cb507ff0265cd1844521d190e This commit was moved from ipfs/boxo@db66d03977366d25aa6b91f30a6ec7a9fcae9037 --- core/coreiface/options/unixfs.go | 30 ++++++++++++++++++++++++++++++ core/coreiface/tests/unixfs.go | 22 ++++++++++++++++++++-- core/coreiface/unixfs.go | 6 +++--- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 109a63f1d8c..819cc3b6bf3 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -42,7 +42,12 @@ type UnixfsAddSettings struct { Progress bool } +type UnixfsLsSettings struct { + Async bool +} + type UnixfsAddOption func(*UnixfsAddSettings) error +type UnixfsLsOption func(*UnixfsLsSettings) error func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, error) { options := &UnixfsAddSettings{ @@ -122,6 +127,21 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, return options, prefix, nil } +func UnixfsLsOptions(opts ...UnixfsLsOption) (*UnixfsLsSettings, error) { + options := &UnixfsLsSettings{ + Async: true, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + + return options, nil +} + type unixfsOpts struct{} var Unixfs unixfsOpts @@ -290,3 +310,13 @@ func (unixfsOpts) Nocopy(enable bool) UnixfsAddOption { return nil } } + +// Async tells ls to return results as soon as they are available, which can be +// useful for listing HAMT directories. When this option is set to true returned +// results won't be returned in order +func (unixfsOpts) Async(async bool) UnixfsLsOption { + return func(settings *UnixfsLsSettings) error { + settings.Async = async + return nil + } +} diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 68d408e6c89..b2b5a9ebb03 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -749,12 +749,12 @@ func (tp *provider) TestLs(t *testing.T) { t.Error(err) } - links, err := api.Unixfs().Ls(ctx, p) + links, err := api.Unixfs().Ls(ctx, p, options.Unixfs.Async(false)) if err != nil { t.Error(err) } - link := <- links + link := (<-links).Link if link.Size != 23 { t.Fatalf("expected size = 23, got %d", link.Size) } @@ -768,6 +768,24 @@ func (tp *provider) TestLs(t *testing.T) { t.Errorf("didn't expect a second link") } + links, err = api.Unixfs().Ls(ctx, p, options.Unixfs.Async(true)) + if err != nil { + t.Error(err) + } + + link = (<-links).Link + if link.Size != 23 { + t.Fatalf("expected size = 23, got %d", link.Size) + } + if link.Name != "name-of-file" { + t.Fatalf("expected name = name-of-file, got %s", link.Name) + } + if link.Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { + t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", link.Cid) + } + if _, ok := <-links; ok { + t.Errorf("didn't expect a second link") + } } func (tp *provider) TestEntriesExpired(t *testing.T) { diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index cdb6a1e0ce3..ba2673fee07 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" - files "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" + ft "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs" + "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" ) type AddEvent struct { @@ -31,5 +31,5 @@ type UnixfsAPI interface { Get(context.Context, Path) (files.Node, error) // Ls returns the list of links in a directory - Ls(context.Context, Path) (<-chan *ipld.Link, error) + Ls(context.Context, Path, ...options.UnixfsLsOption) (<-chan ft.LinkResult, error) } From ef5879661a0feb801ce0463548ca60cf06c9d3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 1 Feb 2019 23:07:19 +0100 Subject: [PATCH 182/286] coreapi: resolve type/size in Unixfs.Ls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@01bbf29cf470532d94aba2bc5a912eb44d9997d0 This commit was moved from ipfs/boxo@54f7855257d69f5f79fe37d7896ddff4e0d1c2f7 --- core/coreiface/options/unixfs.go | 17 +++++++++++++++++ core/coreiface/unixfs.go | 14 +++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 819cc3b6bf3..6dbab93b624 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -44,6 +44,9 @@ type UnixfsAddSettings struct { type UnixfsLsSettings struct { Async bool + + ResolveType bool + ResolveSize bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -320,3 +323,17 @@ func (unixfsOpts) Async(async bool) UnixfsLsOption { return nil } } + +func (unixfsOpts) ResolveSize(resolve bool) UnixfsLsOption { + return func(settings *UnixfsLsSettings) error { + settings.ResolveSize = resolve + return nil + } +} + +func (unixfsOpts) ResolveType(resolve bool) UnixfsLsOption { + return func(settings *UnixfsLsSettings) error { + settings.ResolveSize = resolve + return nil + } +} \ No newline at end of file diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index ba2673fee07..846b7462961 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -2,10 +2,10 @@ package iface import ( "context" - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - ft "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs" + "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs/pb" + ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" ) @@ -16,6 +16,14 @@ type AddEvent struct { Size string `json:",omitempty"` } +type LsLink struct { + Link *ipld.Link + Size uint64 + Type unixfs_pb.Data_DataType + + Err error +} + // UnixfsAPI is the basic interface to immutable files in IPFS // NOTE: This API is heavily WIP, things are guaranteed to break frequently type UnixfsAPI interface { @@ -31,5 +39,5 @@ type UnixfsAPI interface { Get(context.Context, Path) (files.Node, error) // Ls returns the list of links in a directory - Ls(context.Context, Path, ...options.UnixfsLsOption) (<-chan ft.LinkResult, error) + Ls(context.Context, Path, ...options.UnixfsLsOption) (<-chan LsLink, error) } From 3dab84314914893061a215ef9cc56f154f9a343c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 2 Feb 2019 00:18:44 +0100 Subject: [PATCH 183/286] ls: use CoreAPI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@fad4bd392abb9eb689687497d89d9e51e56486fb This commit was moved from ipfs/boxo@966d0008c10b29c04075261e3c59b0cab8953faa --- core/coreiface/options/unixfs.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 6dbab93b624..4ff5cdb3f81 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -133,6 +133,9 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, func UnixfsLsOptions(opts ...UnixfsLsOption) (*UnixfsLsSettings, error) { options := &UnixfsLsSettings{ Async: true, + + ResolveSize: true, + ResolveType: true, } for _, opt := range opts { @@ -333,7 +336,7 @@ func (unixfsOpts) ResolveSize(resolve bool) UnixfsLsOption { func (unixfsOpts) ResolveType(resolve bool) UnixfsLsOption { return func(settings *UnixfsLsSettings) error { - settings.ResolveSize = resolve + settings.ResolveType = resolve return nil } -} \ No newline at end of file +} From 9f41461f572ba3ed3e2a9c247521690595705d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 2 Feb 2019 03:42:00 +0100 Subject: [PATCH 184/286] coreapi: stream only ls, handle storting in command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@a62acc82d4b5f8135f1d1249a22e91572a9a03c0 This commit was moved from ipfs/boxo@328e6f8ac9b4229e990201a93954213be992c45d --- core/coreiface/options/unixfs.go | 14 -------------- core/coreiface/tests/unixfs.go | 21 +-------------------- core/coreiface/unixfs.go | 3 ++- 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 4ff5cdb3f81..7e77410bc60 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -43,8 +43,6 @@ type UnixfsAddSettings struct { } type UnixfsLsSettings struct { - Async bool - ResolveType bool ResolveSize bool } @@ -132,8 +130,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, func UnixfsLsOptions(opts ...UnixfsLsOption) (*UnixfsLsSettings, error) { options := &UnixfsLsSettings{ - Async: true, - ResolveSize: true, ResolveType: true, } @@ -317,16 +313,6 @@ func (unixfsOpts) Nocopy(enable bool) UnixfsAddOption { } } -// Async tells ls to return results as soon as they are available, which can be -// useful for listing HAMT directories. When this option is set to true returned -// results won't be returned in order -func (unixfsOpts) Async(async bool) UnixfsLsOption { - return func(settings *UnixfsLsSettings) error { - settings.Async = async - return nil - } -} - func (unixfsOpts) ResolveSize(resolve bool) UnixfsLsOption { return func(settings *UnixfsLsSettings) error { settings.ResolveSize = resolve diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index b2b5a9ebb03..054461de1d8 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -749,7 +749,7 @@ func (tp *provider) TestLs(t *testing.T) { t.Error(err) } - links, err := api.Unixfs().Ls(ctx, p, options.Unixfs.Async(false)) + links, err := api.Unixfs().Ls(ctx, p) if err != nil { t.Error(err) } @@ -767,25 +767,6 @@ func (tp *provider) TestLs(t *testing.T) { if _, ok := <-links; ok { t.Errorf("didn't expect a second link") } - - links, err = api.Unixfs().Ls(ctx, p, options.Unixfs.Async(true)) - if err != nil { - t.Error(err) - } - - link = (<-links).Link - if link.Size != 23 { - t.Fatalf("expected size = 23, got %d", link.Size) - } - if link.Name != "name-of-file" { - t.Fatalf("expected name = name-of-file, got %s", link.Name) - } - if link.Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { - t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", link.Cid) - } - if _, ok := <-links; ok { - t.Errorf("didn't expect a second link") - } } func (tp *provider) TestEntriesExpired(t *testing.T) { diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 846b7462961..a77011988d5 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -38,6 +38,7 @@ type UnixfsAPI interface { // to operations performed on the returned file Get(context.Context, Path) (files.Node, error) - // Ls returns the list of links in a directory + // Ls returns the list of links in a directory. Links aren't guaranteed to be + // returned in order Ls(context.Context, Path, ...options.UnixfsLsOption) (<-chan LsLink, error) } From 39204505d087da8853f0800111b03348d5d896ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 2 Feb 2019 17:13:28 +0100 Subject: [PATCH 185/286] coreapi ls: merge ResolveType and ResolveSize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@d93b9f110ec9df2fb0e4f840974243ae878ffdf6 This commit was moved from ipfs/boxo@8d88635d4a9ae6462528d7a6cd7737ecbd5716de --- core/coreiface/options/unixfs.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 7e77410bc60..015c2dca3c5 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -43,8 +43,7 @@ type UnixfsAddSettings struct { } type UnixfsLsSettings struct { - ResolveType bool - ResolveSize bool + ResolveChildren bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -130,8 +129,7 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, func UnixfsLsOptions(opts ...UnixfsLsOption) (*UnixfsLsSettings, error) { options := &UnixfsLsSettings{ - ResolveSize: true, - ResolveType: true, + ResolveChildren: true, } for _, opt := range opts { @@ -313,16 +311,9 @@ func (unixfsOpts) Nocopy(enable bool) UnixfsAddOption { } } -func (unixfsOpts) ResolveSize(resolve bool) UnixfsLsOption { +func (unixfsOpts) ResolveChildren(resolve bool) UnixfsLsOption { return func(settings *UnixfsLsSettings) error { - settings.ResolveSize = resolve - return nil - } -} - -func (unixfsOpts) ResolveType(resolve bool) UnixfsLsOption { - return func(settings *UnixfsLsSettings) error { - settings.ResolveType = resolve + settings.ResolveChildren = resolve return nil } } From eac8515c0b25512058d104042fdfde3e7d63d34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 2 Feb 2019 17:27:54 +0100 Subject: [PATCH 186/286] coreapi: mirror unixfs file types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@e8196db410d2fc38fb64613bebedccc79c1ecaec This commit was moved from ipfs/boxo@e47af31e2d3e5b497f91392603ed5f6b760f6eff --- core/coreiface/unixfs.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index a77011988d5..1fb07638f88 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,7 +4,7 @@ import ( "context" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs/pb" + "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs" ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" ) @@ -16,10 +16,21 @@ type AddEvent struct { Size string `json:",omitempty"` } +type FileType int32 + +const ( + TRaw = FileType(unixfs.TRaw) + TFile = FileType(unixfs.TFile) + TDirectory = FileType(unixfs.TDirectory) + TMetadata = FileType(unixfs.TMetadata) + TSymlink = FileType(unixfs.TSymlink) + THAMTShard = FileType(unixfs.THAMTShard) +) + type LsLink struct { Link *ipld.Link Size uint64 - Type unixfs_pb.Data_DataType + Type FileType Err error } From abebd4e1d81dc18a53db02f740784084c7ab3a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 4 Feb 2019 18:05:05 +0100 Subject: [PATCH 187/286] block put --pin option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@005752045c872e4dabb17e5c9ba1732f3cf04ea6 This commit was moved from ipfs/boxo@9ea89f38600dab60d9a09740c28d935ef9bfc202 --- core/coreiface/options/block.go | 11 ++++++++++ core/coreiface/tests/block.go | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index ea4ae26bb61..40dfba79ab2 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -10,6 +10,7 @@ type BlockPutSettings struct { Codec string MhType uint64 MhLength int + Pin bool } type BlockRmSettings struct { @@ -24,6 +25,7 @@ func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, cid.Prefix, err Codec: "", MhType: mh.SHA2_256, MhLength: -1, + Pin: false, } for _, opt := range opts { @@ -105,6 +107,15 @@ func (blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { } } +// Pin is an option for Block.Put which specifies whether to (recursively) pin +// added blocks +func (blockOpts) Pin(pin bool) BlockPutOption { + return func(settings *BlockPutSettings) error { + settings.Pin = pin + return nil + } +} + // Force is an option for Block.Rm which, when set to true, will ignore // non-existing blocks func (blockOpts) Force(force bool) BlockRmOption { diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 427ad3357be..c2ee70a3a6e 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -26,6 +26,7 @@ func (tp *provider) TestBlock(t *testing.T) { t.Run("TestBlockGet", tp.TestBlockGet) t.Run("TestBlockRm", tp.TestBlockRm) t.Run("TestBlockStat", tp.TestBlockStat) + t.Run("TestBlockPin", tp.TestBlockPin) } func (tp *provider) TestBlockPut(t *testing.T) { @@ -203,3 +204,40 @@ func (tp *provider) TestBlockStat(t *testing.T) { t.Error("length doesn't match") } } + +func (tp *provider) TestBlockPin(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Error(err) + } + + _, err = api.Block().Put(ctx, strings.NewReader(`Hello`)) + if err != nil { + t.Fatal(err) + } + + if pins, err := api.Pin().Ls(ctx); err != nil || len(pins) != 0 { + t.Fatal("expected 0 pins") + } + + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Pin(true)) + if err != nil { + t.Fatal(err) + } + + pins, err := api.Pin().Ls(ctx) + if err != nil { + return + } + if len(pins) != 1 { + t.Fatal("expected 1 pin") + } + if pins[0].Type() != "recursive" { + t.Error("expected a recursive pin") + } + if pins[0].Path().String() != res.Path().String() { + t.Error("pin path didn't match") + } +} From 6e4a14d89d5e8c88c29b026056606bc57d196499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 5 Feb 2019 20:20:27 +0100 Subject: [PATCH 188/286] coreapi: fix seek test on http impl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@3291f565631f8ccbb1d09bb71e686265cc00803d This commit was moved from ipfs/boxo@1e59d281dfae25d81b2f2dba9ca6138537c431a6 --- core/coreiface/tests/unixfs.go | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 054461de1d8..1c21f4fd01c 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -3,6 +3,7 @@ package tests import ( "bytes" "context" + "encoding/hex" "fmt" "io" "io/ioutil" @@ -754,9 +755,13 @@ func (tp *provider) TestLs(t *testing.T) { t.Error(err) } - link := (<-links).Link - if link.Size != 23 { - t.Fatalf("expected size = 23, got %d", link.Size) + linkRes := <-links + if linkRes.Err != nil { + t.Fatal(linkRes.Err) + } + link := linkRes.Link + if linkRes.Size != 15 { + t.Fatalf("expected size = 15, got %d", link.Size) } if link.Name != "name-of-file" { t.Fatalf("expected name = name-of-file, got %s", link.Name) @@ -764,8 +769,11 @@ func (tp *provider) TestLs(t *testing.T) { if link.Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", link.Cid) } - if _, ok := <-links; ok { + if l, ok := <-links; ok { t.Errorf("didn't expect a second link") + if l.Err != nil { + t.Error(l.Err) + } } } @@ -967,7 +975,7 @@ func (tp *provider) TestGetSeek(t *testing.T) { } orig := make([]byte, dataSize) - if _, err := f.Read(orig); err != nil { + if _, err := io.ReadFull(f, orig); err != nil { t.Fatal(err) } f.Close() @@ -1005,9 +1013,9 @@ func (tp *provider) TestGetSeek(t *testing.T) { if err != nil { t.Fatalf("orig: %s", err) } - r, err := f.Read(buf) + r, err := io.ReadFull(f, buf) switch { - case shouldEof && err != nil && err != io.EOF: + case shouldEof && err != nil && err != io.ErrUnexpectedEOF: fallthrough case !shouldEof && err != nil: t.Fatalf("f: %s", err) @@ -1029,6 +1037,8 @@ func (tp *provider) TestGetSeek(t *testing.T) { t.Fatal("read different amount of data than bytes.Reader") } if !bytes.Equal(buf, origBuf) { + fmt.Fprintf(os.Stderr, "original:\n%s\n", hex.Dump(origBuf)) + fmt.Fprintf(os.Stderr, "got:\n%s\n", hex.Dump(buf)) t.Fatal("data didn't match") } }) @@ -1039,6 +1049,7 @@ func (tp *provider) TestGetSeek(t *testing.T) { test(500, io.SeekCurrent, 10, 10, false) test(350, io.SeekStart, 100, 100, false) test(-123, io.SeekCurrent, 100, 100, false) + test(0, io.SeekStart, int(dataSize), dataSize, false) test(dataSize-50, io.SeekStart, 100, 50, true) test(-5, io.SeekEnd, 100, 5, true) } From be9d4de4d421fd9883404935b23c206e21021829 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 7 Feb 2019 17:11:29 -0800 Subject: [PATCH 189/286] gx: update go-libp2p-peer Switch _back_ to the 0.4.18 style of peer IDs while we figure things out. See https://github.com/libp2p/specs/issues/138. License: MIT Signed-off-by: Steven Allen This commit was moved from ipfs/interface-go-ipfs-core@67fd754fced65b8d75a92217fe265af48822cef1 This commit was moved from ipfs/boxo@132387d33db2093e89e1b97dbe292ba780debf0f --- core/coreiface/dht.go | 4 ++-- core/coreiface/key.go | 2 +- core/coreiface/options/unixfs.go | 2 +- core/coreiface/path.go | 2 +- core/coreiface/pubsub.go | 2 +- core/coreiface/swarm.go | 6 +++--- core/coreiface/tests/name.go | 2 +- core/coreiface/tests/unixfs.go | 6 +++--- core/coreiface/unixfs.go | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index ec8bd92c34d..94fb3779f7a 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - pstore "gx/ipfs/QmPiemjiKBC9VA7vZF82m4x1oygtg2c2YVqag8PX7dN1BD/go-libp2p-peerstore" - peer "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" + peer "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" + pstore "gx/ipfs/QmQFFp4ntkd4C14sP3FaH9WJyBuetuGUVo6dShNHvnoEvC/go-libp2p-peerstore" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/key.go b/core/coreiface/key.go index f310c3cc2ef..69857e6137a 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" + "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 015c2dca3c5..0dd12960967 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -5,7 +5,7 @@ import ( "fmt" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - dag "gx/ipfs/Qmb2UEG2TAeVrEJSjqsZF7Y2he7wRDkrdt6c3bECxwZf4k/go-merkledag" + dag "gx/ipfs/QmUtsx89yiCY6F8mbpP6ecXckiSzCBH7EvkKZuZEHBcr1m/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index b96e0e77570..d59a851b458 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,8 +1,8 @@ package iface import ( + ipfspath "gx/ipfs/QmQ3YSqfxunT5QBg6KBVskKyRE26q6hjSMyhpxchpm7jEN/go-path" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - ipfspath "gx/ipfs/QmWqh9oob7ZHQRwU5CdTqpnC8ip8BEkFNrwXRxeNo5Y7vA/go-path" ) //TODO: merge with ipfspath so we don't depend on it diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index 867c8adc444..9336738260d 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - peer "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" + peer "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" ) // PubSubSubscription is an active PubSub subscription diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 83e20728241..3af078f17ac 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -6,9 +6,9 @@ import ( "time" ma "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr" - net "gx/ipfs/QmNgLg1NTw37iWbYPKcyK85YJ9Whs1MkPtJwhfqbNYAyKg/go-libp2p-net" - pstore "gx/ipfs/QmPiemjiKBC9VA7vZF82m4x1oygtg2c2YVqag8PX7dN1BD/go-libp2p-peerstore" - "gx/ipfs/QmY5Grm8pJdiSSVsYxx4uNRgweY72EmYwuSDbRnbFok3iY/go-libp2p-peer" + "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" + pstore "gx/ipfs/QmQFFp4ntkd4C14sP3FaH9WJyBuetuGUVo6dShNHvnoEvC/go-libp2p-peerstore" + net "gx/ipfs/QmZ7cBWUXkyWTMN4qH6NGoyMVs7JugyFChBNP4ZUp5rJHH/go-libp2p-net" "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" ) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 8690f22c31e..8d87bd495d2 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -8,7 +8,7 @@ import ( "testing" "time" - ipath "gx/ipfs/QmWqh9oob7ZHQRwU5CdTqpnC8ip8BEkFNrwXRxeNo5Y7vA/go-path" + ipath "gx/ipfs/QmQ3YSqfxunT5QBg6KBVskKyRE26q6hjSMyhpxchpm7jEN/go-path" "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 1c21f4fd01c..f5ce85b78be 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -18,12 +18,12 @@ import ( coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs" - "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs/importer/helpers" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" cbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" + mdag "gx/ipfs/QmUtsx89yiCY6F8mbpP6ecXckiSzCBH7EvkKZuZEHBcr1m/go-merkledag" + "gx/ipfs/QmZArMcsVDsXdcLbUx4844CuqKXBpbxdeiryM4cnmGTNRq/go-unixfs" + "gx/ipfs/QmZArMcsVDsXdcLbUx4844CuqKXBpbxdeiryM4cnmGTNRq/go-unixfs/importer/helpers" "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" - mdag "gx/ipfs/Qmb2UEG2TAeVrEJSjqsZF7Y2he7wRDkrdt6c3bECxwZf4k/go-merkledag" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 1fb07638f88..8e559022ccd 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,8 +4,8 @@ import ( "context" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs" ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" + "gx/ipfs/QmZArMcsVDsXdcLbUx4844CuqKXBpbxdeiryM4cnmGTNRq/go-unixfs" "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" ) From 23d84ed3ef15cb86a8c41d0db2db1007d650414f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 8 Feb 2019 17:58:56 +0100 Subject: [PATCH 190/286] coreapi: cleanup coredag references in interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@c3fa814784e5a96d5baeb5722bc51da7750a09ce This commit was moved from ipfs/boxo@d15daa504fd1884c0e2a9c57ae3ae42343ec482e --- core/coreiface/tests/dag.go | 53 ++++++++++++++++++------------------ core/coreiface/tests/path.go | 32 ++++++++++++---------- core/coreiface/tests/pin.go | 22 ++++++++------- 3 files changed, 56 insertions(+), 51 deletions(-) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 10fab125a22..4decfebb4b7 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -8,8 +8,9 @@ import ( "testing" coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" - coredag "github.com/ipfs/go-ipfs/core/coredag" + ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" + ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) @@ -46,18 +47,18 @@ func (tp *provider) TestPut(t *testing.T) { t.Error(err) } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`"Hello"`), math.MaxUint64, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`"Hello"`), math.MaxUint64, -1) if err != nil { t.Error(err) } - err = api.Dag().Add(ctx, nds[0]) + err = api.Dag().Add(ctx, nd) if err != nil { t.Fatal(err) } - if nds[0].Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { - t.Errorf("got wrong cid: %s", nds[0].Cid().String()) + if nd.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { + t.Errorf("got wrong cid: %s", nd.Cid().String()) } } @@ -69,18 +70,18 @@ func (tp *provider) TestPutWithHash(t *testing.T) { t.Error(err) } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`"Hello"`), mh.ID, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`"Hello"`), mh.ID, -1) if err != nil { t.Error(err) } - err = api.Dag().Add(ctx, nds[0]) + err = api.Dag().Add(ctx, nd) if err != nil { t.Fatal(err) } - if nds[0].Cid().String() != "z5hRLNd2sv4z1c" { - t.Errorf("got wrong cid: %s", nds[0].Cid().String()) + if nd.Cid().String() != "z5hRLNd2sv4z1c" { + t.Errorf("got wrong cid: %s", nd.Cid().String()) } } @@ -92,27 +93,27 @@ func (tp *provider) TestDagPath(t *testing.T) { t.Error(err) } - snds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`"foo"`), math.MaxUint64, -1) + snd, err := ipldcbor.FromJSON(strings.NewReader(`"foo"`), math.MaxUint64, -1) if err != nil { t.Error(err) } - err = api.Dag().Add(ctx, snds[0]) + err = api.Dag().Add(ctx, snd) if err != nil { t.Fatal(err) } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"lnk": {"/": "`+snds[0].Cid().String()+`"}}`), math.MaxUint64, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+snd.Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - err = api.Dag().Add(ctx, nds[0]) + err = api.Dag().Add(ctx, nd) if err != nil { t.Fatal(err) } - p, err := coreiface.ParsePath(path.Join(nds[0].Cid().String(), "lnk")) + p, err := coreiface.ParsePath(path.Join(nd.Cid().String(), "lnk")) if err != nil { t.Error(err) } @@ -122,13 +123,13 @@ func (tp *provider) TestDagPath(t *testing.T) { t.Error(err) } - nd, err := api.Dag().Get(ctx, rp.Cid()) + ndd, err := api.Dag().Get(ctx, rp.Cid()) if err != nil { t.Error(err) } - if nd.Cid().String() != snds[0].Cid().String() { - t.Errorf("got unexpected cid %s, expected %s", nd.Cid().String(), snds[0].Cid().String()) + if nd.Cid().String() != snd.Cid().String() { + t.Errorf("got unexpected cid %s, expected %s", ndd.Cid().String(), snd.Cid().String()) } } @@ -140,17 +141,17 @@ func (tp *provider) TestTree(t *testing.T) { t.Error(err) } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"a": 123, "b": "foo", "c": {"d": 321, "e": 111}}`), math.MaxUint64, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`{"a": 123, "b": "foo", "c": {"d": 321, "e": 111}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - err = api.Dag().Add(ctx, nds[0]) + err = api.Dag().Add(ctx, nd) if err != nil { t.Fatal(err) } - res, err := api.Dag().Get(ctx, nds[0].Cid()) + res, err := api.Dag().Get(ctx, nd.Cid()) if err != nil { t.Error(err) } @@ -175,25 +176,25 @@ func (tp *provider) TestBatch(t *testing.T) { t.Error(err) } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`"Hello"`), math.MaxUint64, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`"Hello"`), math.MaxUint64, -1) if err != nil { t.Error(err) } - if nds[0].Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { - t.Errorf("got wrong cid: %s", nds[0].Cid().String()) + if nd.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { + t.Errorf("got wrong cid: %s", nd.Cid().String()) } - _, err = api.Dag().Get(ctx, nds[0].Cid()) + _, err = api.Dag().Get(ctx, nd.Cid()) if err == nil || !strings.Contains(err.Error(), "not found") { t.Error(err) } - if err := api.Dag().AddMany(ctx, nds); err != nil { + if err := api.Dag().AddMany(ctx, []ipld.Node{nd}); err != nil { t.Error(err) } - _, err = api.Dag().Get(ctx, nds[0].Cid()) + _, err = api.Dag().Get(ctx, nd.Cid()) if err != nil { t.Error(err) } diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index e7df6f1fb7c..5594cf0da51 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -8,7 +8,8 @@ import ( coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "github.com/ipfs/go-ipfs/core/coredag" + + ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" ) func (tp *provider) TestPath(t *testing.T) { @@ -37,7 +38,8 @@ func (tp *provider) TestMutablePath(t *testing.T) { t.Error("expected /ipld path to be immutable") } - // get self /ipns path + // get self /ipns path ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" + if api.Key() == nil { t.Fatal(".Key not implemented") } @@ -64,16 +66,16 @@ func (tp *provider) TestPathRemainder(t *testing.T) { t.Fatal(".Dag not implemented") } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - if err := api.Dag().AddMany(ctx, nds); err != nil { + if err := api.Dag().Add(ctx, nd); err != nil { t.Fatal(err) } - p1, err := coreiface.ParsePath(nds[0].String() + "/foo/bar") + p1, err := coreiface.ParsePath(nd.String() + "/foo/bar") if err != nil { t.Error(err) } @@ -100,16 +102,16 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { t.Fatal(".Dag not implemented") } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - if err := api.Dag().AddMany(ctx, nds); err != nil { + if err := api.Dag().Add(ctx, nd); err != nil { t.Fatal(err) } - p1, err := coreiface.ParsePath(nds[0].Cid().String()) + p1, err := coreiface.ParsePath(nd.Cid().String()) if err != nil { t.Error(err) } @@ -136,16 +138,16 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { t.Fatal(".Dag not implemented") } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - if err := api.Dag().AddMany(ctx, nds); err != nil { + if err := api.Dag().Add(ctx, nd); err != nil { t.Fatal(err) } - p1, err := coreiface.ParsePath("/ipld/" + nds[0].Cid().String() + "/bar/baz") + p1, err := coreiface.ParsePath("/ipld/" + nd.Cid().String() + "/bar/baz") if err != nil { t.Error(err) } @@ -177,16 +179,16 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Fatal(".Dag not implemented") } - nds, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"foo": {"/": "`+blk.Path().Cid().String()+`"}}`), math.MaxUint64, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"/": "`+blk.Path().Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - if err := api.Dag().AddMany(ctx, nds); err != nil { + if err := api.Dag().Add(ctx, nd); err != nil { t.Fatal(err) } - p1, err := coreiface.ParsePath("/ipld/" + nds[0].Cid().String() + "/foo") + p1, err := coreiface.ParsePath("/ipld/" + nd.Cid().String() + "/foo") if err != nil { t.Error(err) } @@ -196,7 +198,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Fatal(err) } - if rp.Root().String() != nds[0].Cid().String() { + if rp.Root().String() != nd.Cid().String() { t.Error("unexpected path root") } diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 25079922226..35c9136187c 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -8,7 +8,9 @@ import ( "github.com/ipfs/go-ipfs/core/coreapi/interface" opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" - "github.com/ipfs/go-ipfs/core/coredag" + + ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" + ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" ) func (tp *provider) TestPin(t *testing.T) { @@ -111,26 +113,26 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Error(err) } - nd2, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"lnk": {"/": "`+p0.Cid().String()+`"}}`), math.MaxUint64, -1) + nd2, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+p0.Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - nd3, err := coredag.ParseInputs("json", "dag-cbor", strings.NewReader(`{"lnk": {"/": "`+p1.Cid().String()+`"}}`), math.MaxUint64, -1) + nd3, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+p1.Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Error(err) } - if err := api.Dag().AddMany(ctx, append(nd2, nd3...)); err != nil { + if err := api.Dag().AddMany(ctx, []ipld.Node{nd2, nd3}); err != nil { t.Fatal(err) } - err = api.Pin().Add(ctx, iface.IpldPath(nd2[0].Cid())) + err = api.Pin().Add(ctx, iface.IpldPath(nd2.Cid())) if err != nil { t.Error(err) } - err = api.Pin().Add(ctx, iface.IpldPath(nd3[0].Cid()), opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, iface.IpldPath(nd3.Cid()), opt.Pin.Recursive(false)) if err != nil { t.Error(err) } @@ -153,8 +155,8 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().String() != iface.IpldPath(nd3[0].Cid()).String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().String(), iface.IpfsPath(nd2[0].Cid()).String()) + if list[0].Path().String() != iface.IpldPath(nd3.Cid()).String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), iface.IpfsPath(nd2.Cid()).String()) } list, err = api.Pin().Ls(ctx, opt.Pin.Type.Recursive()) @@ -166,8 +168,8 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().String() != iface.IpldPath(nd2[0].Cid()).String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().String(), iface.IpldPath(nd3[0].Cid()).String()) + if list[0].Path().String() != iface.IpldPath(nd2.Cid()).String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), iface.IpldPath(nd3.Cid()).String()) } list, err = api.Pin().Ls(ctx, opt.Pin.Type.Indirect()) From 97c433323baad09ba2dbcea901cd3acc5bbdc9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 8 Feb 2019 19:23:01 +0100 Subject: [PATCH 191/286] coreapi: move namesys options to coreapi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@263199d56ec6e7f2dab7c8619b75e2a6fbcf5f15 This commit was moved from ipfs/boxo@a2f6e434b94663fc953c37e74156ee27b8ab73fe --- core/coreiface/options/name.go | 2 +- core/coreiface/options/namesys/opts.go | 74 ++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 core/coreiface/options/namesys/opts.go diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index e2a0fc16498..e07ef8a595e 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -3,7 +3,7 @@ package options import ( "time" - ropts "github.com/ipfs/go-ipfs/namesys/opts" + ropts "github.com/ipfs/go-ipfs/core/coreapi/interface/options/namesys" ) const ( diff --git a/core/coreiface/options/namesys/opts.go b/core/coreiface/options/namesys/opts.go new file mode 100644 index 00000000000..ee2bd5ac2a4 --- /dev/null +++ b/core/coreiface/options/namesys/opts.go @@ -0,0 +1,74 @@ +package nsopts + +import ( + "time" +) + +const ( + // DefaultDepthLimit is the default depth limit used by Resolve. + DefaultDepthLimit = 32 + + // UnlimitedDepth allows infinite recursion in Resolve. You + // probably don't want to use this, but it's here if you absolutely + // trust resolution to eventually complete and can't put an upper + // limit on how many steps it will take. + UnlimitedDepth = 0 +) + +// ResolveOpts specifies options for resolving an IPNS path +type ResolveOpts struct { + // Recursion depth limit + Depth uint + // The number of IPNS records to retrieve from the DHT + // (the best record is selected from this set) + DhtRecordCount uint + // The amount of time to wait for DHT records to be fetched + // and verified. A zero value indicates that there is no explicit + // timeout (although there is an implicit timeout due to dial + // timeouts within the DHT) + DhtTimeout time.Duration +} + +// DefaultResolveOpts returns the default options for resolving +// an IPNS path +func DefaultResolveOpts() ResolveOpts { + return ResolveOpts{ + Depth: DefaultDepthLimit, + DhtRecordCount: 16, + DhtTimeout: time.Minute, + } +} + +// ResolveOpt is used to set an option +type ResolveOpt func(*ResolveOpts) + +// Depth is the recursion depth limit +func Depth(depth uint) ResolveOpt { + return func(o *ResolveOpts) { + o.Depth = depth + } +} + +// DhtRecordCount is the number of IPNS records to retrieve from the DHT +func DhtRecordCount(count uint) ResolveOpt { + return func(o *ResolveOpts) { + o.DhtRecordCount = count + } +} + +// DhtTimeout is the amount of time to wait for DHT records to be fetched +// and verified. A zero value indicates that there is no explicit timeout +func DhtTimeout(timeout time.Duration) ResolveOpt { + return func(o *ResolveOpts) { + o.DhtTimeout = timeout + } +} + +// ProcessOpts converts an array of ResolveOpt into a ResolveOpts object +func ProcessOpts(opts []ResolveOpt) ResolveOpts { + rsopts := DefaultResolveOpts() + for _, option := range opts { + option(&rsopts) + } + return rsopts +} From 46dbdf4d64dee7706d3c22804179bdfb2080a8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 8 Feb 2019 20:38:21 +0100 Subject: [PATCH 192/286] coreapi: fix failing dag test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera This commit was moved from ipfs/interface-go-ipfs-core@268b4fdbf1604d9296e09fe2cf1cf3328f498898 This commit was moved from ipfs/boxo@ea6b30e219991d9a4125537ac16e3e50df0650d8 --- core/coreiface/tests/dag.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 4decfebb4b7..cf332027c88 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -128,7 +128,7 @@ func (tp *provider) TestDagPath(t *testing.T) { t.Error(err) } - if nd.Cid().String() != snd.Cid().String() { + if ndd.Cid().String() != snd.Cid().String() { t.Errorf("got unexpected cid %s, expected %s", ndd.Cid().String(), snd.Cid().String()) } } From af23d0324bce51a7e51a56f6f514bb84d519664c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 9 Feb 2019 01:15:09 +0100 Subject: [PATCH 193/286] Update imports This commit was moved from ipfs/interface-go-ipfs-core@515a114be219fdfdeed3f26c56c91fb7477439bb This commit was moved from ipfs/boxo@5c537a46d37b548c6a830a7ea9ca8aca833e9acc --- core/coreiface/block.go | 2 +- core/coreiface/coreapi.go | 2 +- core/coreiface/dht.go | 2 +- core/coreiface/key.go | 2 +- core/coreiface/name.go | 2 +- core/coreiface/object.go | 2 +- core/coreiface/options/name.go | 2 +- core/coreiface/pin.go | 2 +- core/coreiface/pubsub.go | 2 +- core/coreiface/tests/api.go | 2 +- core/coreiface/tests/block.go | 4 ++-- core/coreiface/tests/dag.go | 2 +- core/coreiface/tests/dht.go | 4 ++-- core/coreiface/tests/key.go | 4 ++-- core/coreiface/tests/name.go | 4 ++-- core/coreiface/tests/object.go | 4 ++-- core/coreiface/tests/path.go | 4 ++-- core/coreiface/tests/pin.go | 4 ++-- core/coreiface/tests/pubsub.go | 5 +++-- core/coreiface/tests/unixfs.go | 4 ++-- core/coreiface/unixfs.go | 2 +- 21 files changed, 31 insertions(+), 30 deletions(-) diff --git a/core/coreiface/block.go b/core/coreiface/block.go index b99b05fdb72..587ad339f61 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -4,7 +4,7 @@ import ( "context" "io" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + options "github.com/ipfs/interface-go-ipfs-core/options" ) // BlockStat contains information about a block diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index d26ec4f7d1a..651af8bf08a 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,7 +5,7 @@ package iface import ( "context" - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/interface-go-ipfs-core/options" ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" ) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 94fb3779f7a..b3f7879e338 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -3,7 +3,7 @@ package iface import ( "context" - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/interface-go-ipfs-core/options" peer "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" pstore "gx/ipfs/QmQFFp4ntkd4C14sP3FaH9WJyBuetuGUVo6dShNHvnoEvC/go-libp2p-peerstore" diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 69857e6137a..154f82b669f 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -3,7 +3,7 @@ package iface import ( "context" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + options "github.com/ipfs/interface-go-ipfs-core/options" "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" ) diff --git a/core/coreiface/name.go b/core/coreiface/name.go index a02bc078748..51b005b7ef6 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -4,7 +4,7 @@ import ( "context" "errors" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + options "github.com/ipfs/interface-go-ipfs-core/options" ) var ErrResolveFailed = errors.New("could not resolve name") diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 2ed357cb63a..28613aaa04b 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -4,7 +4,7 @@ import ( "context" "io" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + options "github.com/ipfs/interface-go-ipfs-core/options" cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index e07ef8a595e..59aaf2ca360 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -3,7 +3,7 @@ package options import ( "time" - ropts "github.com/ipfs/go-ipfs/core/coreapi/interface/options/namesys" + ropts "github.com/ipfs/interface-go-ipfs-core/options/namesys" ) const ( diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 6e13def8f54..6a7dab41377 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -3,7 +3,7 @@ package iface import ( "context" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + options "github.com/ipfs/interface-go-ipfs-core/options" ) // Pin holds information about pinned resource diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index 9336738260d..40cea689a92 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -4,7 +4,7 @@ import ( "context" "io" - options "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + options "github.com/ipfs/interface-go-ipfs-core/options" peer "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" ) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index 7a4bd738624..5e7c1f54159 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -6,7 +6,7 @@ import ( "testing" "time" - coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" + coreiface "github.com/ipfs/interface-go-ipfs-core" ) var apiNotImplemented = errors.New("api not implemented") diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index c2ee70a3a6e..2e0a84b4089 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" - opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + coreiface "github.com/ipfs/interface-go-ipfs-core" + opt "github.com/ipfs/interface-go-ipfs-core/options" mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" ) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index cf332027c88..9e0bc34ba77 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" + coreiface "github.com/ipfs/interface-go-ipfs-core" ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index d2eae1af479..1793cd7384c 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -5,8 +5,8 @@ import ( "io" "testing" - "github.com/ipfs/go-ipfs/core/coreapi/interface" - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/interface-go-ipfs-core" + "github.com/ipfs/interface-go-ipfs-core/options" ) func (tp *provider) TestDht(t *testing.T) { diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index 66011f99f9c..dbbfce0599c 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "github.com/ipfs/go-ipfs/core/coreapi/interface" - opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/interface-go-ipfs-core" + opt "github.com/ipfs/interface-go-ipfs-core/options" ) func (tp *provider) TestKey(t *testing.T) { diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 8d87bd495d2..eb5cd1e3a3f 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -11,8 +11,8 @@ import ( ipath "gx/ipfs/QmQ3YSqfxunT5QBg6KBVskKyRE26q6hjSMyhpxchpm7jEN/go-path" "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" - coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" - opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + coreiface "github.com/ipfs/interface-go-ipfs-core" + opt "github.com/ipfs/interface-go-ipfs-core/options" ) func (tp *provider) TestName(t *testing.T) { diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 2a3b1bd5ca6..026def73bb8 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "github.com/ipfs/go-ipfs/core/coreapi/interface" - opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/interface-go-ipfs-core" + opt "github.com/ipfs/interface-go-ipfs-core/options" ) func (tp *provider) TestObject(t *testing.T) { diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 5594cf0da51..01841d869c4 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + coreiface "github.com/ipfs/interface-go-ipfs-core" + "github.com/ipfs/interface-go-ipfs-core/options" ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" ) diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 35c9136187c..27ed2ad5db9 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - "github.com/ipfs/go-ipfs/core/coreapi/interface" - opt "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/interface-go-ipfs-core" + opt "github.com/ipfs/interface-go-ipfs-core/options" ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index b993f51dc55..14e3545a9d7 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -2,10 +2,11 @@ package tests import ( "context" - "github.com/ipfs/go-ipfs/core/coreapi/interface" - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" "testing" "time" + + "github.com/ipfs/interface-go-ipfs-core" + "github.com/ipfs/interface-go-ipfs-core/options" ) func (tp *provider) TestPubSub(t *testing.T) { diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index f5ce85b78be..cb5897b69c2 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -15,8 +15,8 @@ import ( "sync" "testing" - coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface" - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + coreiface "github.com/ipfs/interface-go-ipfs-core" + "github.com/ipfs/interface-go-ipfs-core/options" "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" cbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 8e559022ccd..c01ccde78e9 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -2,7 +2,7 @@ package iface import ( "context" - "github.com/ipfs/go-ipfs/core/coreapi/interface/options" + "github.com/ipfs/interface-go-ipfs-core/options" ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" "gx/ipfs/QmZArMcsVDsXdcLbUx4844CuqKXBpbxdeiryM4cnmGTNRq/go-unixfs" From 152a54ad8586075d70a281587489740137802e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sat, 9 Feb 2019 01:23:13 +0100 Subject: [PATCH 194/286] gx-go uw This commit was moved from ipfs/interface-go-ipfs-core@93299fcb14d845e3ed4c128f0792f18458794c62 This commit was moved from ipfs/boxo@def3b3d8058572379b772d2db227011fd45662ee --- core/coreiface/coreapi.go | 2 +- core/coreiface/dag.go | 2 +- core/coreiface/dht.go | 4 ++-- core/coreiface/key.go | 2 +- core/coreiface/object.go | 4 ++-- core/coreiface/options/block.go | 4 ++-- core/coreiface/options/unixfs.go | 6 +++--- core/coreiface/path.go | 4 ++-- core/coreiface/pubsub.go | 2 +- core/coreiface/swarm.go | 10 +++++----- core/coreiface/tests/block.go | 2 +- core/coreiface/tests/dag.go | 6 +++--- core/coreiface/tests/name.go | 4 ++-- core/coreiface/tests/path.go | 4 ++-- core/coreiface/tests/pin.go | 4 ++-- core/coreiface/tests/unixfs.go | 14 +++++++------- core/coreiface/unixfs.go | 6 +++--- 17 files changed, 40 insertions(+), 40 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 651af8bf08a..f3433c0890b 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -7,7 +7,7 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" - ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" + ipld "github.com/ipfs/go-ipld-format" ) // CoreAPI defines an unified interface to IPFS for Go programs diff --git a/core/coreiface/dag.go b/core/coreiface/dag.go index d15e24360e1..3cc3aeb4de2 100644 --- a/core/coreiface/dag.go +++ b/core/coreiface/dag.go @@ -1,7 +1,7 @@ package iface import ( - ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" + ipld "github.com/ipfs/go-ipld-format" ) // APIDagService extends ipld.DAGService diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index b3f7879e338..d1ae05125d6 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,8 +5,8 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" - peer "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" - pstore "gx/ipfs/QmQFFp4ntkd4C14sP3FaH9WJyBuetuGUVo6dShNHvnoEvC/go-libp2p-peerstore" + peer "github.com/libp2p/go-libp2p-peer" + pstore "github.com/libp2p/go-libp2p-peerstore" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 154f82b669f..78c29d26843 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( options "github.com/ipfs/interface-go-ipfs-core/options" - "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" + "github.com/libp2p/go-libp2p-peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 28613aaa04b..4f9652fb1d7 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -6,8 +6,8 @@ import ( options "github.com/ipfs/interface-go-ipfs-core/options" - cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" + cid "github.com/ipfs/go-cid" + ipld "github.com/ipfs/go-ipld-format" ) // ObjectStat provides information about dag nodes diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 40dfba79ab2..043dfdea462 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -2,8 +2,8 @@ package options import ( "fmt" - cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" + cid "github.com/ipfs/go-cid" + mh "github.com/multiformats/go-multihash" ) type BlockPutSettings struct { diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 0dd12960967..b76b01adf41 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -4,9 +4,9 @@ import ( "errors" "fmt" - cid "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - dag "gx/ipfs/QmUtsx89yiCY6F8mbpP6ecXckiSzCBH7EvkKZuZEHBcr1m/go-merkledag" - mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" + cid "github.com/ipfs/go-cid" + dag "github.com/ipfs/go-merkledag" + mh "github.com/multiformats/go-multihash" ) type Layout int diff --git a/core/coreiface/path.go b/core/coreiface/path.go index d59a851b458..4e86172ace3 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,8 +1,8 @@ package iface import ( - ipfspath "gx/ipfs/QmQ3YSqfxunT5QBg6KBVskKyRE26q6hjSMyhpxchpm7jEN/go-path" - "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" + "github.com/ipfs/go-cid" + ipfspath "github.com/ipfs/go-path" ) //TODO: merge with ipfspath so we don't depend on it diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index 40cea689a92..212e7722536 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/interface-go-ipfs-core/options" - peer "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" + peer "github.com/libp2p/go-libp2p-peer" ) // PubSubSubscription is an active PubSub subscription diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 3af078f17ac..2e00ecbd311 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,11 +5,11 @@ import ( "errors" "time" - ma "gx/ipfs/QmNTCey11oxhb1AxDnQBRHtdhap6Ctud872NjAYPYYXPuc/go-multiaddr" - "gx/ipfs/QmPJxxDsX2UbchSHobbYuvz7qnyJTFKvaKMzE2rZWJ4x5B/go-libp2p-peer" - pstore "gx/ipfs/QmQFFp4ntkd4C14sP3FaH9WJyBuetuGUVo6dShNHvnoEvC/go-libp2p-peerstore" - net "gx/ipfs/QmZ7cBWUXkyWTMN4qH6NGoyMVs7JugyFChBNP4ZUp5rJHH/go-libp2p-net" - "gx/ipfs/QmZNkThpqfVXs9GNbexPrfBbXSLNYeKrE7jwFM2oqHbyqN/go-libp2p-protocol" + net "github.com/libp2p/go-libp2p-net" + "github.com/libp2p/go-libp2p-peer" + pstore "github.com/libp2p/go-libp2p-peerstore" + "github.com/libp2p/go-libp2p-protocol" + ma "github.com/multiformats/go-multiaddr" ) var ( diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 2e0a84b4089..3cd74358d96 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -9,7 +9,7 @@ import ( coreiface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" - mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" + mh "github.com/multiformats/go-multihash" ) func (tp *provider) TestBlock(t *testing.T) { diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 9e0bc34ba77..7446c20de35 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -9,9 +9,9 @@ import ( coreiface "github.com/ipfs/interface-go-ipfs-core" - ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" - ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" - mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" + ipldcbor "github.com/ipfs/go-ipld-cbor" + ipld "github.com/ipfs/go-ipld-format" + mh "github.com/multiformats/go-multihash" ) func (tp *provider) TestDag(t *testing.T) { diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index eb5cd1e3a3f..1eb2dd51362 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -8,8 +8,8 @@ import ( "testing" "time" - ipath "gx/ipfs/QmQ3YSqfxunT5QBg6KBVskKyRE26q6hjSMyhpxchpm7jEN/go-path" - "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" + "github.com/ipfs/go-ipfs-files" + ipath "github.com/ipfs/go-path" coreiface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 01841d869c4..4da1a5181bb 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -9,7 +9,7 @@ import ( coreiface "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/options" - ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" + ipldcbor "github.com/ipfs/go-ipld-cbor" ) func (tp *provider) TestPath(t *testing.T) { @@ -38,7 +38,7 @@ func (tp *provider) TestMutablePath(t *testing.T) { t.Error("expected /ipld path to be immutable") } - // get self /ipns path ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" + // get self /ipns path if api.Key() == nil { t.Fatal(".Key not implemented") diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 27ed2ad5db9..eed5422833f 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -9,8 +9,8 @@ import ( "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" - ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" - ipldcbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" + ipldcbor "github.com/ipfs/go-ipld-cbor" + ipld "github.com/ipfs/go-ipld-format" ) func (tp *provider) TestPin(t *testing.T) { diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index cb5897b69c2..bcb5331d51b 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -18,13 +18,13 @@ import ( coreiface "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/options" - "gx/ipfs/QmR8BauakNcBa3RbE4nbQu76PDiJgoQgz8AJdhJuiU4TAw/go-cid" - cbor "gx/ipfs/QmRZxJ7oybgnnwriuRub9JXp5YdFM9wiGSyRq38QC7swpS/go-ipld-cbor" - mdag "gx/ipfs/QmUtsx89yiCY6F8mbpP6ecXckiSzCBH7EvkKZuZEHBcr1m/go-merkledag" - "gx/ipfs/QmZArMcsVDsXdcLbUx4844CuqKXBpbxdeiryM4cnmGTNRq/go-unixfs" - "gx/ipfs/QmZArMcsVDsXdcLbUx4844CuqKXBpbxdeiryM4cnmGTNRq/go-unixfs/importer/helpers" - "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" - mh "gx/ipfs/QmerPMzPk1mJVowm8KgmoknWa4yCYvvugMPsgWmDNUvDLW/go-multihash" + "github.com/ipfs/go-cid" + "github.com/ipfs/go-ipfs-files" + cbor "github.com/ipfs/go-ipld-cbor" + mdag "github.com/ipfs/go-merkledag" + "github.com/ipfs/go-unixfs" + "github.com/ipfs/go-unixfs/importer/helpers" + mh "github.com/multiformats/go-multihash" ) func (tp *provider) TestUnixfs(t *testing.T) { diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index c01ccde78e9..5aae00dc4b7 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,9 +4,9 @@ import ( "context" "github.com/ipfs/interface-go-ipfs-core/options" - ipld "gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format" - "gx/ipfs/QmZArMcsVDsXdcLbUx4844CuqKXBpbxdeiryM4cnmGTNRq/go-unixfs" - "gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files" + "github.com/ipfs/go-ipfs-files" + ipld "github.com/ipfs/go-ipld-format" + "github.com/ipfs/go-unixfs" ) type AddEvent struct { From 0a6bdbaa6cfa478a88b43a724695698e2e53414c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 12 Feb 2019 13:30:07 +0100 Subject: [PATCH 195/286] pubsub: fix race in test This commit was moved from ipfs/interface-go-ipfs-core@a84bfa1f4055bb15e3727841df03c3f306ed5cfc This commit was moved from ipfs/boxo@bc7e36143ffe315dc853eecd39d4be5e9b1ab425 --- core/coreiface/tests/pubsub.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index 14e3545a9d7..bb870de6c36 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -38,7 +38,7 @@ func (tp *provider) TestBasicPubSub(t *testing.T) { tick := time.Tick(100 * time.Millisecond) for { - err = apis[1].PubSub().Publish(ctx, "testch", []byte("hello world")) + err := apis[1].PubSub().Publish(ctx, "testch", []byte("hello world")) if err != nil { t.Fatal(err) } From 8542b6569a6169c39694cda227378484b6b40e18 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 19 Feb 2019 02:39:21 -0800 Subject: [PATCH 196/286] errors: introduce a 'not supported' error This commit was moved from ipfs/interface-go-ipfs-core@a81e4359ce5808c1de22b5ec3c6f05b83d86499d This commit was moved from ipfs/boxo@2c70ad1761014168a0bdd27b6ec4628cb08e1001 --- core/coreiface/errors.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/coreiface/errors.go b/core/coreiface/errors.go index 234abe5667e..e0bd7805d86 100644 --- a/core/coreiface/errors.go +++ b/core/coreiface/errors.go @@ -3,7 +3,8 @@ package iface import "errors" var ( - ErrIsDir = errors.New("this dag node is a directory") - ErrNotFile = errors.New("this dag node is not a regular file") - ErrOffline = errors.New("this action must be run in online mode, try running 'ipfs daemon' first") + ErrIsDir = errors.New("this dag node is a directory") + ErrNotFile = errors.New("this dag node is not a regular file") + ErrOffline = errors.New("this action must be run in online mode, try running 'ipfs daemon' first") + ErrNotSupported = errors.New("operation not supported") ) From 987a46a697747db37898d501e7efeed72e4989c4 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 4 Mar 2019 20:11:38 -0800 Subject: [PATCH 197/286] tweak the Ls interface 1. Avoid `ipld.Link`. This is a protodag specific thing that will go away in future IPLD versions. 2. Avoid exposing the underlying file types. The user shouldn't care if they're dealing with a hamt, etc. 3. Add a field for a symlink's target. 4. Rename LsLink to DirEntry to better this type's role. This commit was moved from ipfs/interface-go-ipfs-core@dbee8cc1adb3b53a10ea33add0584b030f92106a This commit was moved from ipfs/boxo@9c3cf70c5f23696257374f5f42212364d706d427 --- core/coreiface/tests/unixfs.go | 23 +++++++++++----------- core/coreiface/unixfs.go | 36 +++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index bcb5331d51b..a0c33c0b0a2 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -750,26 +750,25 @@ func (tp *provider) TestLs(t *testing.T) { t.Error(err) } - links, err := api.Unixfs().Ls(ctx, p) + entries, err := api.Unixfs().Ls(ctx, p) if err != nil { t.Error(err) } - linkRes := <-links - if linkRes.Err != nil { - t.Fatal(linkRes.Err) + entry := <-entries + if entry.Err != nil { + t.Fatal(entry.Err) } - link := linkRes.Link - if linkRes.Size != 15 { - t.Fatalf("expected size = 15, got %d", link.Size) + if entry.Size != 15 { + t.Fatalf("expected size = 15, got %d", entry.Size) } - if link.Name != "name-of-file" { - t.Fatalf("expected name = name-of-file, got %s", link.Name) + if entry.Name != "name-of-file" { + t.Fatalf("expected name = name-of-file, got %s", entry.Name) } - if link.Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { - t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", link.Cid) + if entry.Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { + t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", entry.Cid) } - if l, ok := <-links; ok { + if l, ok := <-entries; ok { t.Errorf("didn't expect a second link") if l.Err != nil { t.Error(l.Err) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 5aae00dc4b7..bdf08b5c3cf 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,9 +4,8 @@ import ( "context" "github.com/ipfs/interface-go-ipfs-core/options" - "github.com/ipfs/go-ipfs-files" - ipld "github.com/ipfs/go-ipld-format" - "github.com/ipfs/go-unixfs" + cid "github.com/ipfs/go-cid" + files "github.com/ipfs/go-ipfs-files" ) type AddEvent struct { @@ -16,21 +15,30 @@ type AddEvent struct { Size string `json:",omitempty"` } +// FileType is an enum of possible UnixFS file types. type FileType int32 const ( - TRaw = FileType(unixfs.TRaw) - TFile = FileType(unixfs.TFile) - TDirectory = FileType(unixfs.TDirectory) - TMetadata = FileType(unixfs.TMetadata) - TSymlink = FileType(unixfs.TSymlink) - THAMTShard = FileType(unixfs.THAMTShard) + // TUnknown means the file type isn't known (e.g., it hasn't been + // resolved). + TUnknown FileType = iota + // TFile is a regular file. + TFile + // TDirectory is a directory. + TDirectory + // TSymlink is a symlink. + TSymlink ) -type LsLink struct { - Link *ipld.Link - Size uint64 - Type FileType +// DirEntry is a directory entry returned by `Ls`. +type DirEntry struct { + Name string + Cid cid.Cid + + // Only filled when asked to resolve the directory entry. + Size uint64 // The size of the file in bytes (or the size of the symlink). + Type FileType // The type of the file. + Target Path // The symlink target (if a symlink). Err error } @@ -51,5 +59,5 @@ type UnixfsAPI interface { // Ls returns the list of links in a directory. Links aren't guaranteed to be // returned in order - Ls(context.Context, Path, ...options.UnixfsLsOption) (<-chan LsLink, error) + Ls(context.Context, Path, ...options.UnixfsLsOption) (<-chan DirEntry, error) } From 483caf76fd36aeebc9d4ea2caf02e007271c5fd1 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 5 Mar 2019 09:36:58 -0800 Subject: [PATCH 198/286] file type: add stringer This commit was moved from ipfs/interface-go-ipfs-core@4e99a8e9250040b9cfc9600641d138fca8ff01f9 This commit was moved from ipfs/boxo@ee697a3b097c25457cccf63c42ba03fadde9d4ef --- core/coreiface/unixfs.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index bdf08b5c3cf..d0e3ec572d3 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -30,6 +30,21 @@ const ( TSymlink ) +func (t FileType) String() string { + switch t { + case TUnknown: + return "unknown" + case TFile: + return "file" + case TDirectory: + return "directory" + case TSymlink: + return "symlink" + default: + return "" + } +} + // DirEntry is a directory entry returned by `Ls`. type DirEntry struct { Name string From cc2b187d07091d649f29f129bcd57078cbec9aba Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 5 Mar 2019 09:37:40 -0800 Subject: [PATCH 199/286] tests: add symlink target test (also, fix some error versus fatal nits) This commit was moved from ipfs/interface-go-ipfs-core@5c6a751986f6d5fe1174819442fcd5f60e0a6f7d This commit was moved from ipfs/boxo@4be6e60dbea5e9dd8cf37d1f7a5b038e2a18dbf7 --- core/coreiface/tests/unixfs.go | 35 +++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index a0c33c0b0a2..b8b22e50aea 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -737,22 +737,23 @@ func (tp *provider) TestLs(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } r := strings.NewReader("content-of-file") p, err := api.Unixfs().Add(ctx, files.NewMapDirectory(map[string]files.Node{ "0": files.NewMapDirectory(map[string]files.Node{ - "name-of-file": files.NewReaderFile(r), + "name-of-file": files.NewReaderFile(r), + "name-of-symlink": files.NewLinkFile("/foo/bar", nil), }), })) if err != nil { - t.Error(err) + t.Fatal(err) } entries, err := api.Unixfs().Ls(ctx, p) if err != nil { - t.Error(err) + t.Fatal(err) } entry := <-entries @@ -760,13 +761,33 @@ func (tp *provider) TestLs(t *testing.T) { t.Fatal(entry.Err) } if entry.Size != 15 { - t.Fatalf("expected size = 15, got %d", entry.Size) + t.Errorf("expected size = 15, got %d", entry.Size) } if entry.Name != "name-of-file" { - t.Fatalf("expected name = name-of-file, got %s", entry.Name) + t.Errorf("expected name = name-of-file, got %s", entry.Name) + } + if entry.Type != coreiface.TFile { + t.Errorf("wrong type %s", entry.Type) } if entry.Cid.String() != "QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr" { - t.Fatalf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", entry.Cid) + t.Errorf("expected cid = QmX3qQVKxDGz3URVC3861Z3CKtQKGBn6ffXRBBWGMFz9Lr, got %s", entry.Cid) + } + entry = <-entries + if entry.Err != nil { + t.Fatal(entry.Err) + } + if entry.Type != coreiface.TSymlink { + t.Errorf("wrong type %s", entry.Type) + } + if entry.Name != "name-of-symlink" { + t.Errorf("expected name = name-of-symlink, got %s", entry.Name) + } + if entry.Target.String() != "/foo/bar" { + t.Errorf("expected symlink target to be /foo/bar, got %s", entry.Target) + } + + if int(entry.Size) != len(entry.Target.String()) { + t.Errorf("expected size = %d, got %d", len(entry.Target.String()), entry.Size) } if l, ok := <-entries; ok { t.Errorf("didn't expect a second link") From 30b344a5af44bae2c7606e18126f0cf66f73915e Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 5 Mar 2019 09:54:43 -0800 Subject: [PATCH 200/286] switch symlink target type to string (path can't represent relative paths) This commit was moved from ipfs/interface-go-ipfs-core@368881fa4a30814112d1b2096c37c91f5fd16976 This commit was moved from ipfs/boxo@e2900773a64d532ccbbabd5ed23c048270bfbefe --- core/coreiface/tests/unixfs.go | 6 +++--- core/coreiface/unixfs.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index b8b22e50aea..79dedf155eb 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -782,12 +782,12 @@ func (tp *provider) TestLs(t *testing.T) { if entry.Name != "name-of-symlink" { t.Errorf("expected name = name-of-symlink, got %s", entry.Name) } - if entry.Target.String() != "/foo/bar" { + if entry.Target != "/foo/bar" { t.Errorf("expected symlink target to be /foo/bar, got %s", entry.Target) } - if int(entry.Size) != len(entry.Target.String()) { - t.Errorf("expected size = %d, got %d", len(entry.Target.String()), entry.Size) + if int(entry.Size) != len(entry.Target) { + t.Errorf("expected size = %d, got %d", len(entry.Target), entry.Size) } if l, ok := <-entries; ok { t.Errorf("didn't expect a second link") diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index d0e3ec572d3..f9508f13852 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -53,7 +53,7 @@ type DirEntry struct { // Only filled when asked to resolve the directory entry. Size uint64 // The size of the file in bytes (or the size of the symlink). Type FileType // The type of the file. - Target Path // The symlink target (if a symlink). + Target string // The symlink target (if a symlink). Err error } From 5cdd4b3d81e43fb3a8d794315ce3b34d59afbbce Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 6 Mar 2019 16:41:05 -0800 Subject: [PATCH 201/286] remove target size requirement It's complicated. We need to carefully think through how sizes work. This commit was moved from ipfs/interface-go-ipfs-core@7a7cf9694be27b62820f05e2ac11bb4a57bab982 This commit was moved from ipfs/boxo@f5117736743ee8753e359aa7e7dbcaf602d75224 --- core/coreiface/tests/unixfs.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 79dedf155eb..bbcb6689970 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -786,9 +786,6 @@ func (tp *provider) TestLs(t *testing.T) { t.Errorf("expected symlink target to be /foo/bar, got %s", entry.Target) } - if int(entry.Size) != len(entry.Target) { - t.Errorf("expected size = %d, got %d", len(entry.Target), entry.Size) - } if l, ok := <-entries; ok { t.Errorf("didn't expect a second link") if l.Err != nil { From 01b61d76346799d4f762b7527466871aa6ad66d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 25 Feb 2019 17:10:23 +0100 Subject: [PATCH 202/286] unixfs add: Changes for fixed wrap logic This commit was moved from ipfs/interface-go-ipfs-core@e87318a2c3620d2402517a6833e21749c065a397 This commit was moved from ipfs/boxo@1ec848f9a24d9c67927520cedcce7c2393893b9a --- core/coreiface/options/unixfs.go | 11 +++ core/coreiface/tests/unixfs.go | 116 ++++++++++++++++++------------- 2 files changed, 80 insertions(+), 47 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index b76b01adf41..44ba8c7cd3e 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -35,6 +35,7 @@ type UnixfsAddSettings struct { Wrap bool Hidden bool + TopHidden bool StdinName string Events chan<- interface{} @@ -69,6 +70,7 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, Wrap: false, Hidden: false, + TopHidden: false, StdinName: "", Events: nil, @@ -255,6 +257,15 @@ func (unixfsOpts) Hidden(hidden bool) UnixfsAddOption { } } +// TopHidden enables adding of hidden files in top-level directory (files +// prefixed with '.') +func (unixfsOpts) TopHidden(hidden bool) UnixfsAddOption { + return func(settings *UnixfsAddSettings) error { + settings.TopHidden = hidden + return nil + } +} + // StdinName is the name set for files which don specify FilePath as // os.Stdin.Name() func (unixfsOpts) StdinName(name string) UnixfsAddOption { diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index bbcb6689970..1ad31933351 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -82,11 +82,14 @@ func flatDir() files.Node { }) } -func wrapped(name string) func(f files.Node) files.Node { +func wrapped(names ...string) func(f files.Node) files.Node { return func(f files.Node) files.Node { - return files.NewMapDirectory(map[string]files.Node{ - name: f, - }) + for i := range names { + f = files.NewMapDirectory(map[string]files.Node{ + names[len(names)-i-1]: f, + }) + } + return f } } @@ -241,16 +244,30 @@ func (tp *provider) TestAdd(t *testing.T) { }, // multi file { - name: "simpleDir", + name: "simpleDirNoWrap", data: flatDir, - wrap: "t", path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp", }, { - name: "twoLevelDir", - data: twoLevelDir(), - wrap: "t", - path: "/ipfs/QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr", + name: "simpleDirWrap", + data: flatDir, + expect: wrapped("QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp"), + path: "/ipfs/QmXxCaQkC8Z6Qws1nTkTQfCsL9y4XvWXnrPokp9bhmjC1L", + opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, + }, + { + name: "simpleDir", + data: flatDir, + wrap: "t", + expect: wrapped("t"), + path: "/ipfs/Qmc3nGXm1HtUVCmnXLQHvWcNwfdZGpfg2SRm1CxLf7Q2Rm", + }, + { + name: "twoLevelDir", + data: twoLevelDir(), + wrap: "t", + expect: wrapped("t"), + path: "/ipfs/QmPwsL3T5sWhDmmAWZHAzyjKtMVDS9a11aHNRqb3xoVnmg", }, // wrapped { @@ -261,15 +278,6 @@ func (tp *provider) TestAdd(t *testing.T) { }, wrap: "foo", expect: wrapped("foo"), - opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, - }, - { - name: "addNotWrappedDirFile", - path: hello, - data: func() files.Node { - return files.NewBytesFile([]byte(helloStr)) - }, - wrap: "foo", }, { name: "stdinWrapped", @@ -306,16 +314,16 @@ func (tp *provider) TestAdd(t *testing.T) { name: "twoLevelDirWrapped", data: twoLevelDir(), wrap: "t", - expect: wrapped("t"), - path: "/ipfs/QmPwsL3T5sWhDmmAWZHAzyjKtMVDS9a11aHNRqb3xoVnmg", + expect: wrapped("QmPwsL3T5sWhDmmAWZHAzyjKtMVDS9a11aHNRqb3xoVnmg", "t"), + path: "/ipfs/QmXzZwAh34pmNjuKsVGZfpbByis5S5qeZjCCUxa1ajZqzH", opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, }, { name: "twoLevelInlineHash", data: twoLevelDir(), wrap: "t", - expect: wrapped("t"), - path: "/ipfs/zBunoruKoyCHKkALNSWxDvj4L7yuQnMgQ4hUa9j1Z64tVcDEcu6Zdetyu7eeFCxMPfxb7YJvHeFHoFoHMkBUQf6vfdhmi", + expect: wrapped("zBunoruKoyCHKkALNSWxDvj4L7yuQnMgQ4hUa9j1Z64tVcDEcu6Zdetyu7eeFCxMPfxb7YJvHeFHoFoHMkBUQf6vfdhmi", "t"), + path: "/ipfs/QmUX6GykDGHTMtLmDkfjqs48QwQK82vou51xwaY9TSU7Zo", opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true), options.Unixfs.Hash(mh.SHA3)}, }, // hidden @@ -328,17 +336,20 @@ func (tp *provider) TestAdd(t *testing.T) { "foo": files.NewBytesFile([]byte("hello1")), }) }, - wrap: "t", - path: "/ipfs/QmehGvpf2hY196MzDFmjL8Wy27S4jbgGDUAhBJyvXAwr3g", - opts: []options.UnixfsAddOption{options.Unixfs.Hidden(true)}, + wrap: "t", + expect: wrapped("t"), + path: "/ipfs/QmPXLSBX382vJDLrGakcbrZDkU3grfkjMox7EgSC9KFbtQ", + opts: []options.UnixfsAddOption{options.Unixfs.Hidden(true)}, }, { - name: "hiddenFileAlwaysAdded", + name: "topHiddenFileAdded", data: func() files.Node { return files.NewBytesFile([]byte(helloStr)) }, - wrap: ".foo", - path: hello, + wrap: ".foo", + expect: wrapped(".foo"), + path: "/ipfs/QmciAVG3krCbvzUaK9gr6jUgfEjQtYmuuXi1n67teQ4Ni2", + opts: []options.UnixfsAddOption{options.Unixfs.TopHidden(true)}, }, { name: "hiddenFilesNotAdded", @@ -352,10 +363,25 @@ func (tp *provider) TestAdd(t *testing.T) { expect: func(files.Node) files.Node { return flatDir() }, - wrap: "t", path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp", opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)}, }, + { + name: "hiddenFilesWrappedNotAdded", + data: func() files.Node { + return files.NewMapDirectory(map[string]files.Node{ + ".bar": files.NewBytesFile([]byte("hello2")), + "bar": files.NewBytesFile([]byte("hello2")), + "foo": files.NewBytesFile([]byte("hello1")), + }) + }, + expect: func(files.Node) files.Node { + return wrapped("t")(flatDir()) + }, + wrap: "t", + path: "/ipfs/Qmc3nGXm1HtUVCmnXLQHvWcNwfdZGpfg2SRm1CxLf7Q2Rm", + opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)}, + }, // NoCopy { name: "simpleNoCopy", @@ -392,10 +418,9 @@ func (tp *provider) TestAdd(t *testing.T) { data: twoLevelDir(), path: "/ipfs/QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr", events: []coreiface.AddEvent{ - {Name: "t/abc", Path: p("QmU7nuGs2djqK99UNsNgEPGh6GV4662p6WtsgccBNGTDxt"), Size: "62"}, - {Name: "t", Path: p("QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr"), Size: "229"}, + {Name: "abc", Path: p("QmU7nuGs2djqK99UNsNgEPGh6GV4662p6WtsgccBNGTDxt"), Size: "62"}, + {Name: "", Path: p("QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr"), Size: "229"}, }, - wrap: "t", opts: []options.UnixfsAddOption{options.Unixfs.Silent(true)}, }, { @@ -403,13 +428,12 @@ func (tp *provider) TestAdd(t *testing.T) { data: twoLevelDir(), path: "/ipfs/QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr", events: []coreiface.AddEvent{ - {Name: "t/abc/def", Path: p("QmNyJpQkU1cEkBwMDhDNFstr42q55mqG5GE5Mgwug4xyGk"), Size: "13"}, - {Name: "t/bar", Path: p("QmS21GuXiRMvJKHos4ZkEmQDmRBqRaF5tQS2CQCu2ne9sY"), Size: "14"}, - {Name: "t/foo", Path: p("QmfAjGiVpTN56TXi6SBQtstit5BEw3sijKj1Qkxn6EXKzJ"), Size: "14"}, - {Name: "t/abc", Path: p("QmU7nuGs2djqK99UNsNgEPGh6GV4662p6WtsgccBNGTDxt"), Size: "62"}, - {Name: "t", Path: p("QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr"), Size: "229"}, + {Name: "abc/def", Path: p("QmNyJpQkU1cEkBwMDhDNFstr42q55mqG5GE5Mgwug4xyGk"), Size: "13"}, + {Name: "bar", Path: p("QmS21GuXiRMvJKHos4ZkEmQDmRBqRaF5tQS2CQCu2ne9sY"), Size: "14"}, + {Name: "foo", Path: p("QmfAjGiVpTN56TXi6SBQtstit5BEw3sijKj1Qkxn6EXKzJ"), Size: "14"}, + {Name: "abc", Path: p("QmU7nuGs2djqK99UNsNgEPGh6GV4662p6WtsgccBNGTDxt"), Size: "62"}, + {Name: "", Path: p("QmVG2ZYCkV1S4TK8URA3a4RupBF17A8yAr4FqsRDXVJASr"), Size: "229"}, }, - wrap: "t", }, { name: "progress1M", @@ -528,14 +552,14 @@ func (tp *provider) TestAdd(t *testing.T) { _, origDir := orig.(files.Directory) _, gotDir := got.(files.Directory) - if origDir != gotDir { - t.Fatal("file type mismatch") - } - if origName != gotName { t.Errorf("file name mismatch, orig='%s', got='%s'", origName, gotName) } + if origDir != gotDir { + t.Fatalf("file type mismatch on %s", origName) + } + if !gotDir { defer orig.Close() defer got.Close() @@ -804,9 +828,7 @@ func (tp *provider) TestEntriesExpired(t *testing.T) { r := strings.NewReader("content-of-file") p, err := api.Unixfs().Add(ctx, files.NewMapDirectory(map[string]files.Node{ - "0": files.NewMapDirectory(map[string]files.Node{ - "name-of-file": files.NewReaderFile(r), - }), + "name-of-file": files.NewReaderFile(r), })) if err != nil { t.Error(err) @@ -846,7 +868,7 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) { t.Error(err) } - _, err = api.Unixfs().Add(ctx, files.NewMapDirectory(map[string]files.Node{"0": files.NewSliceDirectory([]files.DirEntry{})})) + _, err = api.Unixfs().Add(ctx, files.NewSliceDirectory([]files.DirEntry{})) if err != nil { t.Error(err) } From a6fe80000c9e7d17491adc25a02882af3d53a829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 10 Mar 2019 22:10:02 +0100 Subject: [PATCH 203/286] unixfs add: Remove hidden file handling This commit was moved from ipfs/interface-go-ipfs-core@56944d64d1ad4bb349a3d1a30633d5bea06d6a2e This commit was moved from ipfs/boxo@4274224bd095962491241080f0b1fc794d999239 --- core/coreiface/options/unixfs.go | 21 --------------- core/coreiface/tests/unixfs.go | 44 +------------------------------- 2 files changed, 1 insertion(+), 64 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 44ba8c7cd3e..574d46b985f 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -34,8 +34,6 @@ type UnixfsAddSettings struct { NoCopy bool Wrap bool - Hidden bool - TopHidden bool StdinName string Events chan<- interface{} @@ -69,8 +67,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, NoCopy: false, Wrap: false, - Hidden: false, - TopHidden: false, StdinName: "", Events: nil, @@ -249,23 +245,6 @@ func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption { } } -// Hidden enables adding of hidden files (files prefixed with '.') -func (unixfsOpts) Hidden(hidden bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Hidden = hidden - return nil - } -} - -// TopHidden enables adding of hidden files in top-level directory (files -// prefixed with '.') -func (unixfsOpts) TopHidden(hidden bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.TopHidden = hidden - return nil - } -} - // StdinName is the name set for files which don specify FilePath as // os.Stdin.Name() func (unixfsOpts) StdinName(name string) UnixfsAddOption { diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 1ad31933351..0defd2f327d 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -328,7 +328,7 @@ func (tp *provider) TestAdd(t *testing.T) { }, // hidden { - name: "hiddenFiles", + name: "hiddenFilesAdded", data: func() files.Node { return files.NewMapDirectory(map[string]files.Node{ ".bar": files.NewBytesFile([]byte("hello2")), @@ -339,48 +339,6 @@ func (tp *provider) TestAdd(t *testing.T) { wrap: "t", expect: wrapped("t"), path: "/ipfs/QmPXLSBX382vJDLrGakcbrZDkU3grfkjMox7EgSC9KFbtQ", - opts: []options.UnixfsAddOption{options.Unixfs.Hidden(true)}, - }, - { - name: "topHiddenFileAdded", - data: func() files.Node { - return files.NewBytesFile([]byte(helloStr)) - }, - wrap: ".foo", - expect: wrapped(".foo"), - path: "/ipfs/QmciAVG3krCbvzUaK9gr6jUgfEjQtYmuuXi1n67teQ4Ni2", - opts: []options.UnixfsAddOption{options.Unixfs.TopHidden(true)}, - }, - { - name: "hiddenFilesNotAdded", - data: func() files.Node { - return files.NewMapDirectory(map[string]files.Node{ - ".bar": files.NewBytesFile([]byte("hello2")), - "bar": files.NewBytesFile([]byte("hello2")), - "foo": files.NewBytesFile([]byte("hello1")), - }) - }, - expect: func(files.Node) files.Node { - return flatDir() - }, - path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp", - opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)}, - }, - { - name: "hiddenFilesWrappedNotAdded", - data: func() files.Node { - return files.NewMapDirectory(map[string]files.Node{ - ".bar": files.NewBytesFile([]byte("hello2")), - "bar": files.NewBytesFile([]byte("hello2")), - "foo": files.NewBytesFile([]byte("hello1")), - }) - }, - expect: func(files.Node) files.Node { - return wrapped("t")(flatDir()) - }, - wrap: "t", - path: "/ipfs/Qmc3nGXm1HtUVCmnXLQHvWcNwfdZGpfg2SRm1CxLf7Q2Rm", - opts: []options.UnixfsAddOption{options.Unixfs.Hidden(false)}, }, // NoCopy { From 726e8c0db1b97af0b40f26ae6447662651d01ebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 11 Mar 2019 13:36:57 +0100 Subject: [PATCH 204/286] unixfs: fix ls test for new add This commit was moved from ipfs/interface-go-ipfs-core@91f8aac428155f9f302c3d6327c5f8659742013f This commit was moved from ipfs/boxo@bd1689b886cda8cd5095b711df1eba9d15cabc7f --- core/coreiface/tests/unixfs.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 0defd2f327d..d4af7c3f08c 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -724,10 +724,8 @@ func (tp *provider) TestLs(t *testing.T) { r := strings.NewReader("content-of-file") p, err := api.Unixfs().Add(ctx, files.NewMapDirectory(map[string]files.Node{ - "0": files.NewMapDirectory(map[string]files.Node{ - "name-of-file": files.NewReaderFile(r), - "name-of-symlink": files.NewLinkFile("/foo/bar", nil), - }), + "name-of-file": files.NewReaderFile(r), + "name-of-symlink": files.NewLinkFile("/foo/bar", nil), })) if err != nil { t.Fatal(err) From 905898b66787e0970c3e26f1072e8d2471c644db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 11 Mar 2019 15:58:40 +0100 Subject: [PATCH 205/286] unixfs add: remove StdinName This commit was moved from ipfs/interface-go-ipfs-core@e12c21afc03931525ceefc18be0bda8c71818d29 This commit was moved from ipfs/boxo@f3f74adfdbb7715898650b91985c61e3ba7a2788 --- core/coreiface/options/unixfs.go | 15 ++------------- core/coreiface/tests/unixfs.go | 18 ------------------ 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 574d46b985f..578eb53205f 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -33,8 +33,7 @@ type UnixfsAddSettings struct { FsCache bool NoCopy bool - Wrap bool - StdinName string + Wrap bool Events chan<- interface{} Silent bool @@ -66,8 +65,7 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, FsCache: false, NoCopy: false, - Wrap: false, - StdinName: "", + Wrap: false, Events: nil, Silent: false, @@ -245,15 +243,6 @@ func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption { } } -// StdinName is the name set for files which don specify FilePath as -// os.Stdin.Name() -func (unixfsOpts) StdinName(name string) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.StdinName = name - return nil - } -} - // Events specifies channel which will be used to report events about ongoing // Add operation. // diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index d4af7c3f08c..c27826b5120 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -292,24 +292,6 @@ func (tp *provider) TestAdd(t *testing.T) { }, opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, }, - { - name: "stdinNamed", - path: "/ipfs/QmQ6cGBmb3ZbdrQW1MRm1RJnYnaxCqfssz7CrTa9NEhQyS", - data: func() files.Node { - rf, err := files.NewReaderPathFile(os.Stdin.Name(), ioutil.NopCloser(strings.NewReader(helloStr)), nil) - if err != nil { - panic(err) - } - - return rf - }, - expect: func(files.Node) files.Node { - return files.NewMapDirectory(map[string]files.Node{ - "test": files.NewBytesFile([]byte(helloStr)), - }) - }, - opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true), options.Unixfs.StdinName("test")}, - }, { name: "twoLevelDirWrapped", data: twoLevelDir(), From 84faa010ce5dbb944845c22658025f4a0523ab6d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 22 Mar 2019 15:05:41 -0700 Subject: [PATCH 206/286] remove Wrap This can be trivially implemented by the end-user if desired. The best the CoreAPI can do is name the file with it's own hash so this isn't really all that helpful either. Note: This differs from js-ipfs because _there_, all files have paths (even outside directories). This commit was moved from ipfs/interface-go-ipfs-core@ac37dde21aaeea010bbe50c8c37155e4471c0000 This commit was moved from ipfs/boxo@a0c8ed395649c7fcda2ceaccdd65aa13feb2d2ae --- core/coreiface/options/unixfs.go | 13 ------------ core/coreiface/tests/unixfs.go | 36 -------------------------------- 2 files changed, 49 deletions(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 578eb53205f..3fd96f772c8 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -33,8 +33,6 @@ type UnixfsAddSettings struct { FsCache bool NoCopy bool - Wrap bool - Events chan<- interface{} Silent bool Progress bool @@ -65,8 +63,6 @@ func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, FsCache: false, NoCopy: false, - Wrap: false, - Events: nil, Silent: false, Progress: false, @@ -234,15 +230,6 @@ func (unixfsOpts) HashOnly(hashOnly bool) UnixfsAddOption { } } -// Wrap tells the adder to wrap the added file structure with an additional -// directory. -func (unixfsOpts) Wrap(wrap bool) UnixfsAddOption { - return func(settings *UnixfsAddSettings) error { - settings.Wrap = wrap - return nil - } -} - // Events specifies channel which will be used to report events about ongoing // Add operation. // diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index c27826b5120..0fd494f667d 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -248,13 +248,6 @@ func (tp *provider) TestAdd(t *testing.T) { data: flatDir, path: "/ipfs/QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp", }, - { - name: "simpleDirWrap", - data: flatDir, - expect: wrapped("QmRKGpFfR32FVXdvJiHfo4WJ5TDYBsM1P9raAp1p6APWSp"), - path: "/ipfs/QmXxCaQkC8Z6Qws1nTkTQfCsL9y4XvWXnrPokp9bhmjC1L", - opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, - }, { name: "simpleDir", data: flatDir, @@ -279,35 +272,6 @@ func (tp *provider) TestAdd(t *testing.T) { wrap: "foo", expect: wrapped("foo"), }, - { - name: "stdinWrapped", - path: "/ipfs/QmU3r81oZycjHS9oaSHw37ootMFuFUw1DvMLKXPsezdtqU", - data: func() files.Node { - return files.NewBytesFile([]byte(helloStr)) - }, - expect: func(files.Node) files.Node { - return files.NewMapDirectory(map[string]files.Node{ - "QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk": files.NewBytesFile([]byte(helloStr)), - }) - }, - opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, - }, - { - name: "twoLevelDirWrapped", - data: twoLevelDir(), - wrap: "t", - expect: wrapped("QmPwsL3T5sWhDmmAWZHAzyjKtMVDS9a11aHNRqb3xoVnmg", "t"), - path: "/ipfs/QmXzZwAh34pmNjuKsVGZfpbByis5S5qeZjCCUxa1ajZqzH", - opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true)}, - }, - { - name: "twoLevelInlineHash", - data: twoLevelDir(), - wrap: "t", - expect: wrapped("zBunoruKoyCHKkALNSWxDvj4L7yuQnMgQ4hUa9j1Z64tVcDEcu6Zdetyu7eeFCxMPfxb7YJvHeFHoFoHMkBUQf6vfdhmi", "t"), - path: "/ipfs/QmUX6GykDGHTMtLmDkfjqs48QwQK82vou51xwaY9TSU7Zo", - opts: []options.UnixfsAddOption{options.Unixfs.Wrap(true), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true), options.Unixfs.Hash(mh.SHA3)}, - }, // hidden { name: "hiddenFilesAdded", From 6190be29b97faebf6537ecf3eedb942d5c9eff08 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 26 Mar 2019 18:27:35 +0000 Subject: [PATCH 207/286] make unrecoverable test errors fatal Otherwise, we can get random panics form dereferencing nil pointers. This commit was moved from ipfs/interface-go-ipfs-core@6d166d40d8d347faa4a10aec30444999d5d7b85b This commit was moved from ipfs/boxo@35272d3a3b89759460bf3fb96c15e36019036da4 --- core/coreiface/tests/block.go | 28 +++++++++---------- core/coreiface/tests/dag.go | 36 ++++++++++++------------ core/coreiface/tests/key.go | 26 ++++++++--------- core/coreiface/tests/path.go | 18 ++++++------ core/coreiface/tests/pin.go | 26 ++++++++--------- core/coreiface/tests/unixfs.go | 51 ++++++++++++++++++---------------- 6 files changed, 94 insertions(+), 91 deletions(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 3cd74358d96..d584ac98aa8 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -52,7 +52,7 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Format("cbor")) @@ -70,7 +70,7 @@ func (tp *provider) TestBlockPutHash(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Hash(mh.KECCAK_512, -1)) @@ -88,7 +88,7 @@ func (tp *provider) TestBlockGet(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Hash(mh.KECCAK_512, -1)) @@ -98,12 +98,12 @@ func (tp *provider) TestBlockGet(t *testing.T) { r, err := api.Block().Get(ctx, res.Path()) if err != nil { - t.Error(err) + t.Fatal(err) } d, err := ioutil.ReadAll(r) if err != nil { - t.Error(err) + t.Fatal(err) } if string(d) != "Hello" { @@ -112,7 +112,7 @@ func (tp *provider) TestBlockGet(t *testing.T) { p, err := coreiface.ParsePath("/ipfs/" + res.Path().Cid().String()) if err != nil { - t.Error(err) + t.Fatal(err) } rp, err := api.ResolvePath(ctx, p) @@ -129,7 +129,7 @@ func (tp *provider) TestBlockRm(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) @@ -139,12 +139,12 @@ func (tp *provider) TestBlockRm(t *testing.T) { r, err := api.Block().Get(ctx, res.Path()) if err != nil { - t.Error(err) + t.Fatal(err) } d, err := ioutil.ReadAll(r) if err != nil { - t.Error(err) + t.Fatal(err) } if string(d) != "Hello" { @@ -153,7 +153,7 @@ func (tp *provider) TestBlockRm(t *testing.T) { err = api.Block().Rm(ctx, res.Path()) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Block().Get(ctx, res.Path()) @@ -174,7 +174,7 @@ func (tp *provider) TestBlockRm(t *testing.T) { err = api.Block().Rm(ctx, res.Path(), opt.Block.Force(true)) if err != nil { - t.Error(err) + t.Fatal(err) } } @@ -183,7 +183,7 @@ func (tp *provider) TestBlockStat(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) @@ -193,7 +193,7 @@ func (tp *provider) TestBlockStat(t *testing.T) { stat, err := api.Block().Stat(ctx, res.Path()) if err != nil { - t.Error(err) + t.Fatal(err) } if stat.Path().String() != res.Path().String() { @@ -210,7 +210,7 @@ func (tp *provider) TestBlockPin(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Block().Put(ctx, strings.NewReader(`Hello`)) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 7446c20de35..ff034beecae 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -44,12 +44,12 @@ func (tp *provider) TestPut(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } nd, err := ipldcbor.FromJSON(strings.NewReader(`"Hello"`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } err = api.Dag().Add(ctx, nd) @@ -67,12 +67,12 @@ func (tp *provider) TestPutWithHash(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } nd, err := ipldcbor.FromJSON(strings.NewReader(`"Hello"`), mh.ID, -1) if err != nil { - t.Error(err) + t.Fatal(err) } err = api.Dag().Add(ctx, nd) @@ -90,12 +90,12 @@ func (tp *provider) TestDagPath(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } snd, err := ipldcbor.FromJSON(strings.NewReader(`"foo"`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } err = api.Dag().Add(ctx, snd) @@ -105,7 +105,7 @@ func (tp *provider) TestDagPath(t *testing.T) { nd, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+snd.Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } err = api.Dag().Add(ctx, nd) @@ -115,17 +115,17 @@ func (tp *provider) TestDagPath(t *testing.T) { p, err := coreiface.ParsePath(path.Join(nd.Cid().String(), "lnk")) if err != nil { - t.Error(err) + t.Fatal(err) } rp, err := api.ResolvePath(ctx, p) if err != nil { - t.Error(err) + t.Fatal(err) } ndd, err := api.Dag().Get(ctx, rp.Cid()) if err != nil { - t.Error(err) + t.Fatal(err) } if ndd.Cid().String() != snd.Cid().String() { @@ -138,12 +138,12 @@ func (tp *provider) TestTree(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } nd, err := ipldcbor.FromJSON(strings.NewReader(`{"a": 123, "b": "foo", "c": {"d": 321, "e": 111}}`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } err = api.Dag().Add(ctx, nd) @@ -153,7 +153,7 @@ func (tp *provider) TestTree(t *testing.T) { res, err := api.Dag().Get(ctx, nd.Cid()) if err != nil { - t.Error(err) + t.Fatal(err) } lst := res.Tree("", -1) @@ -173,12 +173,12 @@ func (tp *provider) TestBatch(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } nd, err := ipldcbor.FromJSON(strings.NewReader(`"Hello"`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } if nd.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { @@ -187,15 +187,15 @@ func (tp *provider) TestBatch(t *testing.T) { _, err = api.Dag().Get(ctx, nd.Cid()) if err == nil || !strings.Contains(err.Error(), "not found") { - t.Error(err) + t.Fatal(err) } if err := api.Dag().AddMany(ctx, []ipld.Node{nd}); err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Dag().Get(ctx, nd.Cid()) if err != nil { - t.Error(err) + t.Fatal(err) } } diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index dbbfce0599c..7ff5f33300a 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -121,7 +121,7 @@ func (tp *provider) TestGenerate(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } k, err := api.Key().Generate(ctx, "foo") @@ -144,7 +144,7 @@ func (tp *provider) TestGenerateSize(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } k, err := api.Key().Generate(ctx, "foo", opt.Key.Size(1024)) @@ -169,7 +169,7 @@ func (tp *provider) TestGenerateType(t *testing.T) { api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } k, err := api.Key().Generate(ctx, "bar", opt.Key.Type(opt.Ed25519Key)) @@ -193,7 +193,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Key().Generate(ctx, "foo") @@ -226,7 +226,7 @@ func (tp *provider) TestList(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Key().Generate(ctx, "foo") @@ -272,7 +272,7 @@ func (tp *provider) TestRename(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Key().Generate(ctx, "foo") @@ -301,7 +301,7 @@ func (tp *provider) TestRenameToSelf(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Key().Generate(ctx, "foo") @@ -325,7 +325,7 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Key().Generate(ctx, "foo") @@ -349,7 +349,7 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Key().Generate(ctx, "foo") @@ -379,7 +379,7 @@ func (tp *provider) TestRenameOverwrite(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } kfoo, err := api.Key().Generate(ctx, "foo") @@ -418,7 +418,7 @@ func (tp *provider) TestRenameSameNameNoForce(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Key().Generate(ctx, "foo") @@ -447,7 +447,7 @@ func (tp *provider) TestRenameSameName(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Key().Generate(ctx, "foo") @@ -476,7 +476,7 @@ func (tp *provider) TestRemove(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } k, err := api.Key().Generate(ctx, "foo") diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 4da1a5181bb..b99e8ab9ccb 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -68,7 +68,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) { nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } if err := api.Dag().Add(ctx, nd); err != nil { @@ -77,7 +77,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) { p1, err := coreiface.ParsePath(nd.String() + "/foo/bar") if err != nil { - t.Error(err) + t.Fatal(err) } rp1, err := api.ResolvePath(ctx, p1) @@ -104,7 +104,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } if err := api.Dag().Add(ctx, nd); err != nil { @@ -113,7 +113,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { p1, err := coreiface.ParsePath(nd.Cid().String()) if err != nil { - t.Error(err) + t.Fatal(err) } rp1, err := api.ResolvePath(ctx, p1) @@ -140,7 +140,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } if err := api.Dag().Add(ctx, nd); err != nil { @@ -149,7 +149,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { p1, err := coreiface.ParsePath("/ipld/" + nd.Cid().String() + "/bar/baz") if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.ResolvePath(ctx, p1) @@ -181,7 +181,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"/": "`+blk.Path().Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } if err := api.Dag().Add(ctx, nd); err != nil { @@ -190,7 +190,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { p1, err := coreiface.ParsePath("/ipld/" + nd.Cid().String() + "/foo") if err != nil { - t.Error(err) + t.Fatal(err) } rp, err := api.ResolvePath(ctx, p1) @@ -210,7 +210,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { func (tp *provider) TestPathJoin(t *testing.T) { p1, err := coreiface.ParsePath("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") if err != nil { - t.Error(err) + t.Fatal(err) } if coreiface.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index eed5422833f..ff6f98e3589 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -31,17 +31,17 @@ func (tp *provider) TestPinAdd(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } p, err := api.Unixfs().Add(ctx, strFile("foo")()) if err != nil { - t.Error(err) + t.Fatal(err) } err = api.Pin().Add(ctx, p) if err != nil { - t.Error(err) + t.Fatal(err) } } @@ -50,17 +50,17 @@ func (tp *provider) TestPinSimple(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } p, err := api.Unixfs().Add(ctx, strFile("foo")()) if err != nil { - t.Error(err) + t.Fatal(err) } err = api.Pin().Add(ctx, p) if err != nil { - t.Error(err) + t.Fatal(err) } list, err := api.Pin().Ls(ctx) @@ -100,27 +100,27 @@ func (tp *provider) TestPinRecursive(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } p0, err := api.Unixfs().Add(ctx, strFile("foo")()) if err != nil { - t.Error(err) + t.Fatal(err) } p1, err := api.Unixfs().Add(ctx, strFile("bar")()) if err != nil { - t.Error(err) + t.Fatal(err) } nd2, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+p0.Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } nd3, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+p1.Cid().String()+`"}}`), math.MaxUint64, -1) if err != nil { - t.Error(err) + t.Fatal(err) } if err := api.Dag().AddMany(ctx, []ipld.Node{nd2, nd3}); err != nil { @@ -129,12 +129,12 @@ func (tp *provider) TestPinRecursive(t *testing.T) { err = api.Pin().Add(ctx, iface.IpldPath(nd2.Cid())) if err != nil { - t.Error(err) + t.Fatal(err) } err = api.Pin().Add(ctx, iface.IpldPath(nd3.Cid()), opt.Pin.Recursive(false)) if err != nil { - t.Error(err) + t.Fatal(err) } list, err := api.Pin().Ls(ctx) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index c27826b5120..e99bf44295b 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -98,7 +98,7 @@ func (tp *provider) TestAdd(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } p := func(h string) coreiface.ResolvedPath { @@ -566,15 +566,18 @@ func (tp *provider) TestAddPinned(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Unixfs().Add(ctx, strFile(helloStr)(), options.Unixfs.Pin(true)) if err != nil { - t.Error(err) + t.Fatal(err) } pins, err := api.Pin().Ls(ctx) + if err != nil { + t.Fatal(err) + } if len(pins) != 1 { t.Fatalf("expected 1 pin, got %d", len(pins)) } @@ -589,12 +592,12 @@ func (tp *provider) TestAddHashOnly(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } p, err := api.Unixfs().Add(ctx, strFile(helloStr)(), options.Unixfs.HashOnly(true)) if err != nil { - t.Error(err) + t.Fatal(err) } if p.String() != hello { @@ -648,18 +651,18 @@ func (tp *provider) TestGetDir(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } edir := unixfs.EmptyDirNode() err = api.Dag().Add(ctx, edir) if err != nil { - t.Error(err) + t.Fatal(err) } p := coreiface.IpfsPath(edir.Cid()) emptyDir, err := api.Object().New(ctx, options.Object.Type("unixfs-dir")) if err != nil { - t.Error(err) + t.Fatal(err) } if p.String() != coreiface.IpfsPath(emptyDir.Cid()).String() { @@ -668,7 +671,7 @@ func (tp *provider) TestGetDir(t *testing.T) { r, err := api.Unixfs().Get(ctx, coreiface.IpfsPath(emptyDir.Cid())) if err != nil { - t.Error(err) + t.Fatal(err) } if _, ok := r.(files.Directory); !ok { @@ -681,13 +684,13 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } nd := new(mdag.ProtoNode) err = api.Dag().Add(ctx, nd) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Unixfs().Get(ctx, coreiface.IpfsPath(nd.Cid())) @@ -761,7 +764,7 @@ func (tp *provider) TestEntriesExpired(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } r := strings.NewReader("content-of-file") @@ -769,14 +772,14 @@ func (tp *provider) TestEntriesExpired(t *testing.T) { "name-of-file": files.NewReaderFile(r), })) if err != nil { - t.Error(err) + t.Fatal(err) } ctx, cancel = context.WithCancel(ctx) nd, err := api.Unixfs().Get(ctx, p) if err != nil { - t.Error(err) + t.Fatal(err) } cancel() @@ -803,22 +806,22 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } _, err = api.Unixfs().Add(ctx, files.NewSliceDirectory([]files.DirEntry{})) if err != nil { - t.Error(err) + t.Fatal(err) } emptyDir, err := api.Object().New(ctx, options.Object.Type("unixfs-dir")) if err != nil { - t.Error(err) + t.Fatal(err) } links, err := api.Unixfs().Ls(ctx, coreiface.IpfsPath(emptyDir.Cid())) if err != nil { - t.Error(err) + t.Fatal(err) } if len(links) != 0 { @@ -832,7 +835,7 @@ func (tp *provider) TestLsNonUnixfs(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } nd, err := cbor.WrapObject(map[string]interface{}{"foo": "bar"}, math.MaxUint64, -1) @@ -842,12 +845,12 @@ func (tp *provider) TestLsNonUnixfs(t *testing.T) { err = api.Dag().Add(ctx, nd) if err != nil { - t.Error(err) + t.Fatal(err) } links, err := api.Unixfs().Ls(ctx, coreiface.IpfsPath(nd.Cid())) if err != nil { - t.Error(err) + t.Fatal(err) } if len(links) != 0 { @@ -890,7 +893,7 @@ func (tp *provider) TestAddCloses(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } n4 := &closeTestF{files.NewBytesFile([]byte("foo")), false, t} @@ -907,7 +910,7 @@ func (tp *provider) TestAddCloses(t *testing.T) { _, err = api.Unixfs().Add(ctx, d0) if err != nil { - t.Error(err) + t.Fatal(err) } d0.Close() // Adder doesn't close top-level file @@ -930,7 +933,7 @@ func (tp *provider) TestGetSeek(t *testing.T) { defer cancel() api, err := tp.makeAPI(ctx) if err != nil { - t.Error(err) + t.Fatal(err) } dataSize := int64(100000) From 1f87fa6168ea5ffcba06e5fb0de0ad9324b8d09b Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 26 Mar 2019 18:35:13 +0000 Subject: [PATCH 208/286] tests: remove t.Fatal from goroutines This commit was moved from ipfs/interface-go-ipfs-core@5f17f8346b441a6105b569084fa020af989b0f4c This commit was moved from ipfs/boxo@ccb4a5c183b98b9dcf40eee0c0ac8e4a317b4ed8 --- core/coreiface/tests/pubsub.go | 4 +++- core/coreiface/tests/unixfs.go | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index bb870de6c36..dd05b73cf20 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -40,7 +40,9 @@ func (tp *provider) TestBasicPubSub(t *testing.T) { for { err := apis[1].PubSub().Publish(ctx, "testch", []byte("hello world")) if err != nil { - t.Fatal(err) + t.Error(err) + cancel() + return } select { case <-tick: diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index e99bf44295b..576160500c5 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -423,11 +423,13 @@ func (tp *provider) TestAdd(t *testing.T) { for evt := range eventOut { event, ok := evt.(*coreiface.AddEvent) if !ok { - t.Fatal("unexpected event type") + t.Error("unexpected event type") + continue } if len(expected) < 1 { - t.Fatal("got more events than expected") + t.Error("got more events than expected") + continue } if expected[0].Size != event.Size { @@ -453,7 +455,7 @@ func (tp *provider) TestAdd(t *testing.T) { } if len(expected) > 0 { - t.Fatalf("%d event(s) didn't arrive", len(expected)) + t.Errorf("%d event(s) didn't arrive", len(expected)) } }() } From ba5e78a4c5de8bc560ba0579887f80aa47844419 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 26 Mar 2019 18:37:40 +0000 Subject: [PATCH 209/286] tests: remove ticker leak This commit was moved from ipfs/interface-go-ipfs-core@a7d4a7199895a4bd66fa655b73f94ecea4540fdf This commit was moved from ipfs/boxo@b75b1243fb9738e1b5eb6fd19bca980bd156299c --- core/coreiface/tests/pubsub.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index dd05b73cf20..418fc4867c8 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -35,7 +35,8 @@ func (tp *provider) TestBasicPubSub(t *testing.T) { } go func() { - tick := time.Tick(100 * time.Millisecond) + ticker := time.NewTicker(100 * time.Millisecond) + defer ticker.Stop() for { err := apis[1].PubSub().Publish(ctx, "testch", []byte("hello world")) @@ -45,7 +46,7 @@ func (tp *provider) TestBasicPubSub(t *testing.T) { return } select { - case <-tick: + case <-ticker.C: case <-ctx.Done(): return } From adddfdf0f7f8c50957d4581c04db4711ddb4f925 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 26 Mar 2019 18:38:02 +0000 Subject: [PATCH 210/286] tests: fix unused variable lints This commit was moved from ipfs/interface-go-ipfs-core@5d6a474f3191362120268fa1b0396823013fbe41 This commit was moved from ipfs/boxo@bbf450e3e44f7595a128eba9b7578a412ddcd551 --- core/coreiface/tests/object.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 026def73bb8..8682a2edca6 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -296,7 +296,7 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { t.Fatal(err) } - p3, err := api.Object().AddLink(ctx, p2, "abc/d", p2) + _, err = api.Object().AddLink(ctx, p2, "abc/d", p2) if err == nil { t.Fatal("expected an error") } @@ -304,7 +304,7 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { t.Fatalf("unexpected error: %s", err.Error()) } - p3, err = api.Object().AddLink(ctx, p2, "abc/d", p2, opt.Object.Create(true)) + p3, err := api.Object().AddLink(ctx, p2, "abc/d", p2, opt.Object.Create(true)) if err != nil { t.Fatal(err) } @@ -384,6 +384,9 @@ func (tp *provider) TestObjectAddData(t *testing.T) { } data, err := ioutil.ReadAll(r) + if err != nil { + t.Fatal(err) + } if string(data) != "foobar" { t.Error("unexpected data") @@ -414,6 +417,9 @@ func (tp *provider) TestObjectSetData(t *testing.T) { } data, err := ioutil.ReadAll(r) + if err != nil { + t.Fatal(err) + } if string(data) != "bar" { t.Error("unexpected data") From 6c4219a102a7cb05ec824fc035e01abe79b8e072 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 26 Mar 2019 19:01:23 +0000 Subject: [PATCH 211/286] don't close the top-level addr See https://github.com/ipfs/go-ipfs-http-client/pull/10/files#r269268326 This commit was moved from ipfs/interface-go-ipfs-core@1b707f294336a6eaf3274e27ab0ce85a2b374fbe This commit was moved from ipfs/boxo@21ade61b10b9757f9dfd2dafdb3c95a0ec00ccb1 --- core/coreiface/tests/unixfs.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 0fd494f667d..ea36b7330b7 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -834,6 +834,7 @@ type closeTestD struct { } func (f *closeTestD) Close() error { + f.t.Helper() if f.closed { f.t.Fatal("already closed") } @@ -874,8 +875,6 @@ func (tp *provider) TestAddCloses(t *testing.T) { t.Error(err) } - d0.Close() // Adder doesn't close top-level file - for i, n := range []*closeTestF{n1, n2, n4} { if !n.closed { t.Errorf("file %d not closed!", i) From 686f55459c5747fac06c8b76810a371c9e635d9b Mon Sep 17 00:00:00 2001 From: Edgar Lee Date: Fri, 29 Mar 2019 16:16:16 -0700 Subject: [PATCH 212/286] Update Pin.RmRecursive docs to clarify shared indirect pins are not removed This commit was moved from ipfs/interface-go-ipfs-core@c908a059feab33b74ce66dca01fd521389372942 This commit was moved from ipfs/boxo@ea26ae5e0535dc2429c8c2797b79982317cc9bb3 --- core/coreiface/options/pin.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index cc4a8ef2966..6b211bb73bc 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -127,7 +127,9 @@ func (pinOpts) Recursive(recursive bool) PinAddOption { } } -// RmRecursive is an option for Pin.Rm +// RmRecursive is an option for Pin.Rm which specifies whether to recursively +// unpin the object linked to by the specified object(s). This does not remove +// indirect pins referenced by other recursive pins. func (pinOpts) RmRecursive(recursive bool) PinRmOption { return func(settings *PinRmSettings) error { settings.Recursive = recursive From 1a2e8ce6d76f9517240ca53339937d4e07dcfe96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 25 Mar 2019 17:03:44 +0100 Subject: [PATCH 213/286] path: drop error from ParsePath This commit was moved from ipfs/interface-go-ipfs-core@2b9bff7523c812447641aa70c39ec0b096f5b5c4 This commit was moved from ipfs/boxo@31071e1f5e59a62d53e2c2c7e259eedff6d49f6f --- core/coreiface/path.go | 51 +++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/core/coreiface/path.go b/core/coreiface/path.go index 4e86172ace3..ede190df7de 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,7 +1,9 @@ package iface import ( - "github.com/ipfs/go-cid" + "strings" + + cid "github.com/ipfs/go-cid" ipfspath "github.com/ipfs/go-path" ) @@ -23,6 +25,9 @@ type Path interface { // Namespace returns the first component of the path. // // For example path "/ipfs/QmHash", calling Namespace() will return "ipfs" + // + // Calling this method on invalid paths (IsValid() != nil) will result in + // empty string Namespace() string // Mutable returns false if the data pointed to by this path in guaranteed @@ -30,9 +35,14 @@ type Path interface { // // Note that resolved mutable path can be immutable. Mutable() bool + + // IsValid checks if this path is a valid ipfs Path, returning nil iff it is + // valid + IsValid() error } -// ResolvedPath is a path which was resolved to the last resolvable node +// ResolvedPath is a path which was resolved to the last resolvable node. +// ResolvedPaths are guaranteed to return nil from `IsValid` type ResolvedPath interface { // Cid returns the CID of the node referenced by the path. Remainder of the // path is guaranteed to be within the node. @@ -94,7 +104,7 @@ type ResolvedPath interface { // path implements coreiface.Path type path struct { - path ipfspath.Path + path string } // resolvedPath implements coreiface.resolvedPath @@ -107,14 +117,14 @@ type resolvedPath struct { // Join appends provided segments to the base path func Join(base Path, a ...string) Path { - s := ipfspath.Join(append([]string{base.String()}, a...)) - return &path{path: ipfspath.FromString(s)} + s := strings.Join(append([]string{base.String()}, a...), "/") + return &path{path: s} } // IpfsPath creates new /ipfs path from the provided CID func IpfsPath(c cid.Cid) ResolvedPath { return &resolvedPath{ - path: path{ipfspath.Path("/ipfs/" + c.String())}, + path: path{"/ipfs/" + c.String()}, cid: c, root: c, remainder: "", @@ -124,7 +134,7 @@ func IpfsPath(c cid.Cid) ResolvedPath { // IpldPath creates new /ipld path from the provided CID func IpldPath(c cid.Cid) ResolvedPath { return &resolvedPath{ - path: path{ipfspath.Path("/ipld/" + c.String())}, + path: path{"/ipld/" + c.String()}, cid: c, root: c, remainder: "", @@ -132,13 +142,12 @@ func IpldPath(c cid.Cid) ResolvedPath { } // ParsePath parses string path to a Path -func ParsePath(p string) (Path, error) { - pp, err := ipfspath.ParsePath(p) - if err != nil { - return nil, err +func ParsePath(p string) Path { + if pp, err := ipfspath.ParsePath(p); err == nil { + p = pp.String() } - return &path{path: pp}, nil + return &path{path: p} } // NewResolvedPath creates new ResolvedPath. This function performs no checks @@ -146,7 +155,7 @@ func ParsePath(p string) (Path, error) { // cause panics. Handle with care. func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) ResolvedPath { return &resolvedPath{ - path: path{ipath}, + path: path{ipath.String()}, cid: c, root: root, remainder: remainder, @@ -154,14 +163,19 @@ func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder str } func (p *path) String() string { - return p.path.String() + return p.path } func (p *path) Namespace() string { - if len(p.path.Segments()) < 1 { + ip, err := ipfspath.ParsePath(p.path) + if err != nil { + return "" + } + + if len(ip.Segments()) < 1 { panic("path without namespace") //this shouldn't happen under any scenario } - return p.path.Segments()[0] + return ip.Segments()[0] } func (p *path) Mutable() bool { @@ -169,6 +183,11 @@ func (p *path) Mutable() bool { return p.Namespace() == "ipns" } +func (p *path) IsValid() error { + _, err := ipfspath.ParsePath(p.path) + return err +} + func (p *resolvedPath) Cid() cid.Cid { return p.cid } From aca6f61a63b790c779744a6cca8d058ac6388973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 25 Mar 2019 17:03:53 +0100 Subject: [PATCH 214/286] path: fix tests This commit was moved from ipfs/interface-go-ipfs-core@33d445a6140b26da90a07d2bf86c8827d74284b6 This commit was moved from ipfs/boxo@1497150b1f90816ac7b117fbe0b2fb6aacaa7968 --- core/coreiface/tests/block.go | 5 +---- core/coreiface/tests/dag.go | 5 +---- core/coreiface/tests/name.go | 6 +----- core/coreiface/tests/path.go | 33 +++++---------------------------- core/coreiface/tests/unixfs.go | 5 +---- 5 files changed, 9 insertions(+), 45 deletions(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index d584ac98aa8..96319b4887f 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -110,10 +110,7 @@ func (tp *provider) TestBlockGet(t *testing.T) { t.Error("didn't get correct data back") } - p, err := coreiface.ParsePath("/ipfs/" + res.Path().Cid().String()) - if err != nil { - t.Fatal(err) - } + p := coreiface.ParsePath("/ipfs/" + res.Path().Cid().String()) rp, err := api.ResolvePath(ctx, p) if err != nil { diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index ff034beecae..a17296d1d25 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -113,10 +113,7 @@ func (tp *provider) TestDagPath(t *testing.T) { t.Fatal(err) } - p, err := coreiface.ParsePath(path.Join(nd.Cid().String(), "lnk")) - if err != nil { - t.Fatal(err) - } + p := coreiface.ParsePath(path.Join(nd.Cid().String(), "lnk")) rp, err := api.ResolvePath(ctx, p) if err != nil { diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 1eb2dd51362..c9e99a584ac 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -35,11 +35,7 @@ func addTestObject(ctx context.Context, api coreiface.CoreAPI) (coreiface.Path, } func appendPath(p coreiface.Path, sub string) coreiface.Path { - p, err := coreiface.ParsePath(path.Join(p.String(), sub)) - if err != nil { - panic(err) - } - return p + return coreiface.ParsePath(path.Join(p.String(), sub)) } func (tp *provider) TestPublishResolve(t *testing.T) { diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index b99e8ab9ccb..f5b0ee34897 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -75,12 +75,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) { t.Fatal(err) } - p1, err := coreiface.ParsePath(nd.String() + "/foo/bar") - if err != nil { - t.Fatal(err) - } - - rp1, err := api.ResolvePath(ctx, p1) + rp1, err := api.ResolvePath(ctx, coreiface.ParsePath(nd.String()+"/foo/bar")) if err != nil { t.Fatal(err) } @@ -111,12 +106,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { t.Fatal(err) } - p1, err := coreiface.ParsePath(nd.Cid().String()) - if err != nil { - t.Fatal(err) - } - - rp1, err := api.ResolvePath(ctx, p1) + rp1, err := api.ResolvePath(ctx, coreiface.ParsePath(nd.Cid().String())) if err != nil { t.Fatal(err) } @@ -147,12 +137,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { t.Fatal(err) } - p1, err := coreiface.ParsePath("/ipld/" + nd.Cid().String() + "/bar/baz") - if err != nil { - t.Fatal(err) - } - - _, err = api.ResolvePath(ctx, p1) + _, err = api.ResolvePath(ctx, coreiface.ParsePath("/ipld/"+nd.Cid().String()+"/bar/baz")) if err == nil || !strings.Contains(err.Error(), "no such link found") { t.Fatalf("unexpected error: %s", err) } @@ -188,12 +173,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Fatal(err) } - p1, err := coreiface.ParsePath("/ipld/" + nd.Cid().String() + "/foo") - if err != nil { - t.Fatal(err) - } - - rp, err := api.ResolvePath(ctx, p1) + rp, err := api.ResolvePath(ctx, coreiface.ParsePath("/ipld/"+nd.Cid().String()+"/foo")) if err != nil { t.Fatal(err) } @@ -208,10 +188,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { } func (tp *provider) TestPathJoin(t *testing.T) { - p1, err := coreiface.ParsePath("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") - if err != nil { - t.Fatal(err) - } + p1 := coreiface.ParsePath("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") if coreiface.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { t.Error("unexpected path") diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 611ea54761e..15cb8abc83f 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -592,10 +592,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) { t.Fatal(err) } - emptyFilePath, err := coreiface.ParsePath(emptyFile) - if err != nil { - t.Fatal(err) - } + emptyFilePath := coreiface.ParsePath(emptyFile) r, err := api.Unixfs().Get(ctx, emptyFilePath) if err != nil { From 51a937fffd45edbc0543fe4a2338b6034e5ea2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 25 Mar 2019 19:37:28 +0100 Subject: [PATCH 215/286] path: WIP This commit was moved from ipfs/interface-go-ipfs-core@5a836515396273412794edaaba72ef0cf3ead46d This commit was moved from ipfs/boxo@b8463e7c123e4ff15fd8fdd33a02a6414682ca9a --- core/coreiface/block.go | 11 +- core/coreiface/coreapi.go | 5 +- core/coreiface/dht.go | 7 +- core/coreiface/key.go | 5 +- core/coreiface/name.go | 11 +- core/coreiface/object.go | 29 ++--- core/coreiface/path.go | 197 -------------------------------- core/coreiface/path/path.go | 199 +++++++++++++++++++++++++++++++++ core/coreiface/pin.go | 13 ++- core/coreiface/tests/block.go | 3 +- core/coreiface/tests/dag.go | 5 +- core/coreiface/tests/name.go | 12 +- core/coreiface/tests/path.go | 14 +-- core/coreiface/tests/pin.go | 13 ++- core/coreiface/tests/unixfs.go | 19 ++-- core/coreiface/unixfs.go | 17 +-- 16 files changed, 287 insertions(+), 273 deletions(-) create mode 100644 core/coreiface/path/path.go diff --git a/core/coreiface/block.go b/core/coreiface/block.go index 587ad339f61..9f0ad9cbb4b 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -2,9 +2,10 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "io" - options "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/options" ) // BlockStat contains information about a block @@ -13,7 +14,7 @@ type BlockStat interface { Size() int // Path returns path to the block - Path() ResolvedPath + Path() path.ResolvedPath } // BlockAPI specifies the interface to the block layer @@ -22,15 +23,15 @@ type BlockAPI interface { Put(context.Context, io.Reader, ...options.BlockPutOption) (BlockStat, error) // Get attempts to resolve the path and return a reader for data in the block - Get(context.Context, Path) (io.Reader, error) + Get(context.Context, path.Path) (io.Reader, error) // Rm removes the block specified by the path from local blockstore. // By default an error will be returned if the block can't be found locally. // // NOTE: If the specified block is pinned it won't be removed and no error // will be returned - Rm(context.Context, Path, ...options.BlockRmOption) error + Rm(context.Context, path.Path, ...options.BlockRmOption) error // Stat returns information on - Stat(context.Context, Path) (BlockStat, error) + Stat(context.Context, path.Path) (BlockStat, error) } diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index f3433c0890b..bef3ce01fce 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -4,6 +4,7 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" @@ -43,11 +44,11 @@ type CoreAPI interface { PubSub() PubSubAPI // ResolvePath resolves the path using Unixfs resolver - ResolvePath(context.Context, Path) (ResolvedPath, error) + ResolvePath(context.Context, path.Path) (path.ResolvedPath, error) // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node - ResolveNode(context.Context, Path) (ipld.Node, error) + ResolveNode(context.Context, path.Path) (ipld.Node, error) // WithOptions creates new instance of CoreAPI based on this instance with // a set of options applied diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index d1ae05125d6..0cb7893ef34 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -2,10 +2,11 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" - peer "github.com/libp2p/go-libp2p-peer" + "github.com/libp2p/go-libp2p-peer" pstore "github.com/libp2p/go-libp2p-peerstore" ) @@ -19,8 +20,8 @@ type DhtAPI interface { // FindProviders finds peers in the DHT who can provide a specific value // given a key. - FindProviders(context.Context, Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error) + FindProviders(context.Context, path.Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error) // Provide announces to the network that you are providing given values - Provide(context.Context, Path, ...options.DhtProvideOption) error + Provide(context.Context, path.Path, ...options.DhtProvideOption) error } diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 78c29d26843..e7fb3f44274 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -2,8 +2,9 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" - options "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/options" "github.com/libp2p/go-libp2p-peer" ) @@ -14,7 +15,7 @@ type Key interface { Name() string // Path returns key path - Path() Path + Path() path.Path // ID returns key PeerID ID() peer.ID diff --git a/core/coreiface/name.go b/core/coreiface/name.go index 51b005b7ef6..3dc9f687838 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -3,8 +3,9 @@ package iface import ( "context" "errors" + path "github.com/ipfs/interface-go-ipfs-core/path" - options "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/options" ) var ErrResolveFailed = errors.New("could not resolve name") @@ -14,11 +15,11 @@ type IpnsEntry interface { // Name returns IpnsEntry name Name() string // Value returns IpnsEntry value - Value() Path + Value() path.Path } type IpnsResult struct { - Path + path.Path Err error } @@ -32,10 +33,10 @@ type IpnsResult struct { // You can use .Key API to list and generate more names and their respective keys. type NameAPI interface { // Publish announces new IPNS name - Publish(ctx context.Context, path Path, opts ...options.NamePublishOption) (IpnsEntry, error) + Publish(ctx context.Context, path path.Path, opts ...options.NamePublishOption) (IpnsEntry, error) // Resolve attempts to resolve the newest version of the specified name - Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (Path, error) + Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (path.Path, error) // Search is a version of Resolve which outputs paths as they are discovered, // reducing the time to first entry diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 4f9652fb1d7..3e4b7e0876e 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -2,11 +2,12 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "io" - options "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/options" - cid "github.com/ipfs/go-cid" + "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" ) @@ -58,11 +59,11 @@ type ObjectChange struct { // Before holds the link path before the change. Note that when a link is // added, this will be nil. - Before ResolvedPath + Before path.ResolvedPath // After holds the link path after the change. Note that when a link is // removed, this will be nil. - After ResolvedPath + After path.ResolvedPath } // ObjectAPI specifies the interface to MerkleDAG and contains useful utilities @@ -72,35 +73,35 @@ type ObjectAPI interface { New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) // Put imports the data into merkledag - Put(context.Context, io.Reader, ...options.ObjectPutOption) (ResolvedPath, error) + Put(context.Context, io.Reader, ...options.ObjectPutOption) (path.ResolvedPath, error) // Get returns the node for the path - Get(context.Context, Path) (ipld.Node, error) + Get(context.Context, path.Path) (ipld.Node, error) // Data returns reader for data of the node - Data(context.Context, Path) (io.Reader, error) + Data(context.Context, path.Path) (io.Reader, error) // Links returns lint or links the node contains - Links(context.Context, Path) ([]*ipld.Link, error) + Links(context.Context, path.Path) ([]*ipld.Link, error) // Stat returns information about the node - Stat(context.Context, Path) (*ObjectStat, error) + Stat(context.Context, path.Path) (*ObjectStat, error) // AddLink adds a link under the specified path. child path can point to a // subdirectory within the patent which must be present (can be overridden // with WithCreate option). - AddLink(ctx context.Context, base Path, name string, child Path, opts ...options.ObjectAddLinkOption) (ResolvedPath, error) + AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...options.ObjectAddLinkOption) (path.ResolvedPath, error) // RmLink removes a link from the node - RmLink(ctx context.Context, base Path, link string) (ResolvedPath, error) + RmLink(ctx context.Context, base path.Path, link string) (path.ResolvedPath, error) // AppendData appends data to the node - AppendData(context.Context, Path, io.Reader) (ResolvedPath, error) + AppendData(context.Context, path.Path, io.Reader) (path.ResolvedPath, error) // SetData sets the data contained in the node - SetData(context.Context, Path, io.Reader) (ResolvedPath, error) + SetData(context.Context, path.Path, io.Reader) (path.ResolvedPath, error) // Diff returns a set of changes needed to transform the first object into the // second. - Diff(context.Context, Path, Path) ([]ObjectChange, error) + Diff(context.Context, path.Path, path.Path) ([]ObjectChange, error) } diff --git a/core/coreiface/path.go b/core/coreiface/path.go index ede190df7de..198651129c9 100644 --- a/core/coreiface/path.go +++ b/core/coreiface/path.go @@ -1,201 +1,4 @@ package iface -import ( - "strings" - - cid "github.com/ipfs/go-cid" - ipfspath "github.com/ipfs/go-path" -) - //TODO: merge with ipfspath so we don't depend on it -// Path is a generic wrapper for paths used in the API. A path can be resolved -// to a CID using one of Resolve functions in the API. -// -// Paths must be prefixed with a valid prefix: -// -// * /ipfs - Immutable unixfs path (files) -// * /ipld - Immutable ipld path (data) -// * /ipns - Mutable names. Usually resolves to one of the immutable paths -//TODO: /local (MFS) -type Path interface { - // String returns the path as a string. - String() string - - // Namespace returns the first component of the path. - // - // For example path "/ipfs/QmHash", calling Namespace() will return "ipfs" - // - // Calling this method on invalid paths (IsValid() != nil) will result in - // empty string - Namespace() string - - // Mutable returns false if the data pointed to by this path in guaranteed - // to not change. - // - // Note that resolved mutable path can be immutable. - Mutable() bool - - // IsValid checks if this path is a valid ipfs Path, returning nil iff it is - // valid - IsValid() error -} - -// ResolvedPath is a path which was resolved to the last resolvable node. -// ResolvedPaths are guaranteed to return nil from `IsValid` -type ResolvedPath interface { - // Cid returns the CID of the node referenced by the path. Remainder of the - // path is guaranteed to be within the node. - // - // Examples: - // If you have 3 linked objects: QmRoot -> A -> B: - // - // cidB := {"foo": {"bar": 42 }} - // cidA := {"B": {"/": cidB }} - // cidRoot := {"A": {"/": cidA }} - // - // And resolve paths: - // - // * "/ipfs/${cidRoot}" - // * Calling Cid() will return `cidRoot` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `` - // - // * "/ipfs/${cidRoot}/A" - // * Calling Cid() will return `cidA` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `` - // - // * "/ipfs/${cidRoot}/A/B/foo" - // * Calling Cid() will return `cidB` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `foo` - // - // * "/ipfs/${cidRoot}/A/B/foo/bar" - // * Calling Cid() will return `cidB` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `foo/bar` - Cid() cid.Cid - - // Root returns the CID of the root object of the path - // - // Example: - // If you have 3 linked objects: QmRoot -> A -> B, and resolve path - // "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot - // - // For more examples see the documentation of Cid() method - Root() cid.Cid - - // Remainder returns unresolved part of the path - // - // Example: - // If you have 2 linked objects: QmRoot -> A, where A is a CBOR node - // containing the following data: - // - // {"foo": {"bar": 42 }} - // - // When resolving "/ipld/QmRoot/A/foo/bar", Remainder will return "foo/bar" - // - // For more examples see the documentation of Cid() method - Remainder() string - - Path -} - -// path implements coreiface.Path -type path struct { - path string -} - -// resolvedPath implements coreiface.resolvedPath -type resolvedPath struct { - path - cid cid.Cid - root cid.Cid - remainder string -} - -// Join appends provided segments to the base path -func Join(base Path, a ...string) Path { - s := strings.Join(append([]string{base.String()}, a...), "/") - return &path{path: s} -} - -// IpfsPath creates new /ipfs path from the provided CID -func IpfsPath(c cid.Cid) ResolvedPath { - return &resolvedPath{ - path: path{"/ipfs/" + c.String()}, - cid: c, - root: c, - remainder: "", - } -} - -// IpldPath creates new /ipld path from the provided CID -func IpldPath(c cid.Cid) ResolvedPath { - return &resolvedPath{ - path: path{"/ipld/" + c.String()}, - cid: c, - root: c, - remainder: "", - } -} - -// ParsePath parses string path to a Path -func ParsePath(p string) Path { - if pp, err := ipfspath.ParsePath(p); err == nil { - p = pp.String() - } - - return &path{path: p} -} - -// NewResolvedPath creates new ResolvedPath. This function performs no checks -// and is intended to be used by resolver implementations. Incorrect inputs may -// cause panics. Handle with care. -func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) ResolvedPath { - return &resolvedPath{ - path: path{ipath.String()}, - cid: c, - root: root, - remainder: remainder, - } -} - -func (p *path) String() string { - return p.path -} - -func (p *path) Namespace() string { - ip, err := ipfspath.ParsePath(p.path) - if err != nil { - return "" - } - - if len(ip.Segments()) < 1 { - panic("path without namespace") //this shouldn't happen under any scenario - } - return ip.Segments()[0] -} - -func (p *path) Mutable() bool { - //TODO: MFS: check for /local - return p.Namespace() == "ipns" -} - -func (p *path) IsValid() error { - _, err := ipfspath.ParsePath(p.path) - return err -} - -func (p *resolvedPath) Cid() cid.Cid { - return p.cid -} - -func (p *resolvedPath) Root() cid.Cid { - return p.root -} - -func (p *resolvedPath) Remainder() string { - return p.remainder -} diff --git a/core/coreiface/path/path.go b/core/coreiface/path/path.go new file mode 100644 index 00000000000..414d454fa69 --- /dev/null +++ b/core/coreiface/path/path.go @@ -0,0 +1,199 @@ +package path + +import ( + "strings" + + cid "github.com/ipfs/go-cid" + ipfspath "github.com/ipfs/go-path" +) + +// Path is a generic wrapper for paths used in the API. A path can be resolved +// to a CID using one of Resolve functions in the API. +// +// Paths must be prefixed with a valid prefix: +// +// * /ipfs - Immutable unixfs path (files) +// * /ipld - Immutable ipld path (data) +// * /ipns - Mutable names. Usually resolves to one of the immutable paths +//TODO: /local (MFS) +type Path interface { + // String returns the path as a string. + String() string + + // Namespace returns the first component of the path. + // + // For example path "/ipfs/QmHash", calling Namespace() will return "ipfs" + // + // Calling this method on invalid paths (IsValid() != nil) will result in + // empty string + Namespace() string + + // Mutable returns false if the data pointed to by this path in guaranteed + // to not change. + // + // Note that resolved mutable path can be immutable. + Mutable() bool + + // IsValid checks if this path is a valid ipfs Path, returning nil iff it is + // valid + IsValid() error +} + +// ResolvedPath is a path which was resolved to the last resolvable node. +// ResolvedPaths are guaranteed to return nil from `IsValid` +type ResolvedPath interface { + // Cid returns the CID of the node referenced by the path. Remainder of the + // path is guaranteed to be within the node. + // + // Examples: + // If you have 3 linked objects: QmRoot -> A -> B: + // + // cidB := {"foo": {"bar": 42 }} + // cidA := {"B": {"/": cidB }} + // cidRoot := {"A": {"/": cidA }} + // + // And resolve paths: + // + // * "/ipfs/${cidRoot}" + // * Calling Cid() will return `cidRoot` + // * Calling Root() will return `cidRoot` + // * Calling Remainder() will return `` + // + // * "/ipfs/${cidRoot}/A" + // * Calling Cid() will return `cidA` + // * Calling Root() will return `cidRoot` + // * Calling Remainder() will return `` + // + // * "/ipfs/${cidRoot}/A/B/foo" + // * Calling Cid() will return `cidB` + // * Calling Root() will return `cidRoot` + // * Calling Remainder() will return `foo` + // + // * "/ipfs/${cidRoot}/A/B/foo/bar" + // * Calling Cid() will return `cidB` + // * Calling Root() will return `cidRoot` + // * Calling Remainder() will return `foo/bar` + Cid() cid.Cid + + // Root returns the CID of the root object of the path + // + // Example: + // If you have 3 linked objects: QmRoot -> A -> B, and resolve path + // "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot + // + // For more examples see the documentation of Cid() method + Root() cid.Cid + + // Remainder returns unresolved part of the path + // + // Example: + // If you have 2 linked objects: QmRoot -> A, where A is a CBOR node + // containing the following data: + // + // {"foo": {"bar": 42 }} + // + // When resolving "/ipld/QmRoot/A/foo/bar", Remainder will return "foo/bar" + // + // For more examples see the documentation of Cid() method + Remainder() string + + Path +} + +// path implements coreiface.Path +type path struct { + path string +} + +// resolvedPath implements coreiface.resolvedPath +type resolvedPath struct { + path + cid cid.Cid + root cid.Cid + remainder string +} + +// Join appends provided segments to the base path +func Join(base Path, a ...string) Path { + s := strings.Join(append([]string{base.String()}, a...), "/") + return &path{path: s} +} + +// IpfsPath creates new /ipfs path from the provided CID +func IpfsPath(c cid.Cid) ResolvedPath { + return &resolvedPath{ + path: path{"/ipfs/" + c.String()}, + cid: c, + root: c, + remainder: "", + } +} + +// IpldPath creates new /ipld path from the provided CID +func IpldPath(c cid.Cid) ResolvedPath { + return &resolvedPath{ + path: path{"/ipld/" + c.String()}, + cid: c, + root: c, + remainder: "", + } +} + +// ParsePath parses string path to a Path +func ParsePath(p string) Path { + if pp, err := ipfspath.ParsePath(p); err == nil { + p = pp.String() + } + + return &path{path: p} +} + +// NewResolvedPath creates new ResolvedPath. This function performs no checks +// and is intended to be used by resolver implementations. Incorrect inputs may +// cause panics. Handle with care. +func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) ResolvedPath { + return &resolvedPath{ + path: path{ipath.String()}, + cid: c, + root: root, + remainder: remainder, + } +} + +func (p *path) String() string { + return p.path +} + +func (p *path) Namespace() string { + ip, err := ipfspath.ParsePath(p.path) + if err != nil { + return "" + } + + if len(ip.Segments()) < 1 { + panic("path without namespace") // this shouldn't happen under any scenario + } + return ip.Segments()[0] +} + +func (p *path) Mutable() bool { + // TODO: MFS: check for /local + return p.Namespace() == "ipns" +} + +func (p *path) IsValid() error { + _, err := ipfspath.ParsePath(p.path) + return err +} + +func (p *resolvedPath) Cid() cid.Cid { + return p.cid +} + +func (p *resolvedPath) Root() cid.Cid { + return p.root +} + +func (p *resolvedPath) Remainder() string { + return p.remainder +} diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 6a7dab41377..736b2d68b91 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -2,14 +2,15 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" - options "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/options" ) // Pin holds information about pinned resource type Pin interface { // Path to the pinned object - Path() ResolvedPath + Path() path.ResolvedPath // Type of the pin Type() string @@ -27,7 +28,7 @@ type PinStatus interface { // BadPinNode is a node that has been marked as bad by Pin.Verify type BadPinNode interface { // Path is the path of the node - Path() ResolvedPath + Path() path.ResolvedPath // Err is the reason why the node has been marked as bad Err() error @@ -37,17 +38,17 @@ type BadPinNode interface { type PinAPI interface { // Add creates new pin, be default recursive - pinning the whole referenced // tree - Add(context.Context, Path, ...options.PinAddOption) error + Add(context.Context, path.Path, ...options.PinAddOption) error // Ls returns list of pinned objects on this node Ls(context.Context, ...options.PinLsOption) ([]Pin, error) // Rm removes pin for object specified by the path - Rm(context.Context, Path, ...options.PinRmOption) error + Rm(context.Context, path.Path, ...options.PinRmOption) error // Update changes one pin to another, skipping checks for matching paths in // the old tree - Update(ctx context.Context, from Path, to Path, opts ...options.PinUpdateOption) error + Update(ctx context.Context, from path.Path, to path.Path, opts ...options.PinUpdateOption) error // Verify verifies the integrity of pinned objects Verify(context.Context) (<-chan PinStatus, error) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 96319b4887f..59b49d5672e 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -2,6 +2,7 @@ package tests import ( "context" + "github.com/ipfs/interface-go-ipfs-core/path" "io/ioutil" "strings" "testing" @@ -110,7 +111,7 @@ func (tp *provider) TestBlockGet(t *testing.T) { t.Error("didn't get correct data back") } - p := coreiface.ParsePath("/ipfs/" + res.Path().Cid().String()) + p := path.ParsePath("/ipfs/" + res.Path().Cid().String()) rp, err := api.ResolvePath(ctx, p) if err != nil { diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index a17296d1d25..0abcee32f8d 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -2,8 +2,9 @@ package tests import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "math" - "path" + gopath "path" "strings" "testing" @@ -113,7 +114,7 @@ func (tp *provider) TestDagPath(t *testing.T) { t.Fatal(err) } - p := coreiface.ParsePath(path.Join(nd.Cid().String(), "lnk")) + p := path.ParsePath(gopath.Join(nd.Cid().String(), "lnk")) rp, err := api.ResolvePath(ctx, p) if err != nil { diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index c9e99a584ac..98ae6853ee6 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -2,9 +2,10 @@ package tests import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "io" "math/rand" - "path" + gopath "path" "testing" "time" @@ -30,18 +31,18 @@ func (tp *provider) TestName(t *testing.T) { var rnd = rand.New(rand.NewSource(0x62796532303137)) -func addTestObject(ctx context.Context, api coreiface.CoreAPI) (coreiface.Path, error) { +func addTestObject(ctx context.Context, api coreiface.CoreAPI) (path.Path, error) { return api.Unixfs().Add(ctx, files.NewReaderFile(&io.LimitedReader{R: rnd, N: 4092})) } -func appendPath(p coreiface.Path, sub string) coreiface.Path { - return coreiface.ParsePath(path.Join(p.String(), sub)) +func appendPath(p path.Path, sub string) path.Path { + return path.ParsePath(gopath.Join(p.String(), sub)) } func (tp *provider) TestPublishResolve(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - init := func() (coreiface.CoreAPI, coreiface.Path) { + init := func() (coreiface.CoreAPI, path.Path) { apis, err := tp.MakeAPISwarm(ctx, true, 5) if err != nil { t.Fatal(err) @@ -56,7 +57,6 @@ func (tp *provider) TestPublishResolve(t *testing.T) { } return api, p } - run := func(t *testing.T, ropts []opt.NameResolveOption) { t.Run("basic", func(t *testing.T) { api, p := init() diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index f5b0ee34897..685f469981c 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -2,11 +2,11 @@ package tests import ( "context" + "github.com/ipfs/interface-go-ipfs-core/path" "math" "strings" "testing" - coreiface "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/options" ipldcbor "github.com/ipfs/go-ipld-cbor" @@ -75,7 +75,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) { t.Fatal(err) } - rp1, err := api.ResolvePath(ctx, coreiface.ParsePath(nd.String()+"/foo/bar")) + rp1, err := api.ResolvePath(ctx, path.ParsePath(nd.String()+"/foo/bar")) if err != nil { t.Fatal(err) } @@ -106,7 +106,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { t.Fatal(err) } - rp1, err := api.ResolvePath(ctx, coreiface.ParsePath(nd.Cid().String())) + rp1, err := api.ResolvePath(ctx, path.ParsePath(nd.Cid().String())) if err != nil { t.Fatal(err) } @@ -137,7 +137,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { t.Fatal(err) } - _, err = api.ResolvePath(ctx, coreiface.ParsePath("/ipld/"+nd.Cid().String()+"/bar/baz")) + _, err = api.ResolvePath(ctx, path.ParsePath("/ipld/"+nd.Cid().String()+"/bar/baz")) if err == nil || !strings.Contains(err.Error(), "no such link found") { t.Fatalf("unexpected error: %s", err) } @@ -173,7 +173,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Fatal(err) } - rp, err := api.ResolvePath(ctx, coreiface.ParsePath("/ipld/"+nd.Cid().String()+"/foo")) + rp, err := api.ResolvePath(ctx, path.ParsePath("/ipld/"+nd.Cid().String()+"/foo")) if err != nil { t.Fatal(err) } @@ -188,9 +188,9 @@ func (tp *provider) TestPathRoot(t *testing.T) { } func (tp *provider) TestPathJoin(t *testing.T) { - p1 := coreiface.ParsePath("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") + p1 := path.ParsePath("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") - if coreiface.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { + if path.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { t.Error("unexpected path") } } diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index ff6f98e3589..344db65e200 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -2,6 +2,7 @@ package tests import ( "context" + "github.com/ipfs/interface-go-ipfs-core/path" "math" "strings" "testing" @@ -127,12 +128,12 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Fatal(err) } - err = api.Pin().Add(ctx, iface.IpldPath(nd2.Cid())) + err = api.Pin().Add(ctx, path.IpldPath(nd2.Cid())) if err != nil { t.Fatal(err) } - err = api.Pin().Add(ctx, iface.IpldPath(nd3.Cid()), opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, path.IpldPath(nd3.Cid()), opt.Pin.Recursive(false)) if err != nil { t.Fatal(err) } @@ -155,8 +156,8 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().String() != iface.IpldPath(nd3.Cid()).String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().String(), iface.IpfsPath(nd2.Cid()).String()) + if list[0].Path().String() != path.IpldPath(nd3.Cid()).String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpfsPath(nd2.Cid()).String()) } list, err = api.Pin().Ls(ctx, opt.Pin.Type.Recursive()) @@ -168,8 +169,8 @@ func (tp *provider) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().String() != iface.IpldPath(nd2.Cid()).String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().String(), iface.IpldPath(nd3.Cid()).String()) + if list[0].Path().String() != path.IpldPath(nd2.Cid()).String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpldPath(nd3.Cid()).String()) } list, err = api.Pin().Ls(ctx, opt.Pin.Type.Indirect()) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 15cb8abc83f..d2d9f85b854 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -5,6 +5,7 @@ import ( "context" "encoding/hex" "fmt" + "github.com/ipfs/interface-go-ipfs-core/path" "io" "io/ioutil" "math" @@ -101,12 +102,12 @@ func (tp *provider) TestAdd(t *testing.T) { t.Fatal(err) } - p := func(h string) coreiface.ResolvedPath { + p := func(h string) path.ResolvedPath { c, err := cid.Parse(h) if err != nil { t.Fatal(err) } - return coreiface.IpfsPath(c) + return path.IpfsPath(c) } rf, err := ioutil.TempFile(os.TempDir(), "unixfs-add-real") @@ -592,7 +593,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) { t.Fatal(err) } - emptyFilePath := coreiface.ParsePath(emptyFile) + emptyFilePath := path.ParsePath(emptyFile) r, err := api.Unixfs().Get(ctx, emptyFilePath) if err != nil { @@ -621,18 +622,18 @@ func (tp *provider) TestGetDir(t *testing.T) { if err != nil { t.Fatal(err) } - p := coreiface.IpfsPath(edir.Cid()) + p := path.IpfsPath(edir.Cid()) emptyDir, err := api.Object().New(ctx, options.Object.Type("unixfs-dir")) if err != nil { t.Fatal(err) } - if p.String() != coreiface.IpfsPath(emptyDir.Cid()).String() { + if p.String() != path.IpfsPath(emptyDir.Cid()).String() { t.Fatalf("expected path %s, got: %s", emptyDir.Cid(), p.String()) } - r, err := api.Unixfs().Get(ctx, coreiface.IpfsPath(emptyDir.Cid())) + r, err := api.Unixfs().Get(ctx, path.IpfsPath(emptyDir.Cid())) if err != nil { t.Fatal(err) } @@ -656,7 +657,7 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) { t.Fatal(err) } - _, err = api.Unixfs().Get(ctx, coreiface.IpfsPath(nd.Cid())) + _, err = api.Unixfs().Get(ctx, path.IpfsPath(nd.Cid())) if !strings.Contains(err.Error(), "proto: required field") { t.Fatalf("expected protobuf error, got: %s", err) } @@ -782,7 +783,7 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) { t.Fatal(err) } - links, err := api.Unixfs().Ls(ctx, coreiface.IpfsPath(emptyDir.Cid())) + links, err := api.Unixfs().Ls(ctx, path.IpfsPath(emptyDir.Cid())) if err != nil { t.Fatal(err) } @@ -811,7 +812,7 @@ func (tp *provider) TestLsNonUnixfs(t *testing.T) { t.Fatal(err) } - links, err := api.Unixfs().Ls(ctx, coreiface.IpfsPath(nd.Cid())) + links, err := api.Unixfs().Ls(ctx, path.IpfsPath(nd.Cid())) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index f9508f13852..0b27519f378 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -3,16 +3,17 @@ package iface import ( "context" "github.com/ipfs/interface-go-ipfs-core/options" + path "github.com/ipfs/interface-go-ipfs-core/path" - cid "github.com/ipfs/go-cid" - files "github.com/ipfs/go-ipfs-files" + "github.com/ipfs/go-cid" + "github.com/ipfs/go-ipfs-files" ) type AddEvent struct { Name string - Path ResolvedPath `json:",omitempty"` - Bytes int64 `json:",omitempty"` - Size string `json:",omitempty"` + Path path.ResolvedPath `json:",omitempty"` + Bytes int64 `json:",omitempty"` + Size string `json:",omitempty"` } // FileType is an enum of possible UnixFS file types. @@ -64,15 +65,15 @@ type UnixfsAPI interface { // Add imports the data from the reader into merkledag file // // TODO: a long useful comment on how to use this for many different scenarios - Add(context.Context, files.Node, ...options.UnixfsAddOption) (ResolvedPath, error) + Add(context.Context, files.Node, ...options.UnixfsAddOption) (path.ResolvedPath, error) // Get returns a read-only handle to a file tree referenced by a path // // Note that some implementations of this API may apply the specified context // to operations performed on the returned file - Get(context.Context, Path) (files.Node, error) + Get(context.Context, path.Path) (files.Node, error) // Ls returns the list of links in a directory. Links aren't guaranteed to be // returned in order - Ls(context.Context, Path, ...options.UnixfsLsOption) (<-chan DirEntry, error) + Ls(context.Context, path.Path, ...options.UnixfsLsOption) (<-chan DirEntry, error) } From 3669a774ffa2b3c545baf3f80f77c6d792295e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 26 Mar 2019 15:09:08 +0100 Subject: [PATCH 216/286] path: rename ParsePath and ResolvedPath This commit was moved from ipfs/interface-go-ipfs-core@21a72398d98125cae4fcef33cc80ed4a1f3be22c This commit was moved from ipfs/boxo@fbc9ab8769cbaac70a6459c33973c0d894e85126 --- core/coreiface/block.go | 2 +- core/coreiface/coreapi.go | 2 +- core/coreiface/object.go | 14 +++++++------- core/coreiface/path.go | 4 ---- core/coreiface/path/path.go | 16 ++++++++-------- core/coreiface/pin.go | 4 ++-- core/coreiface/tests/block.go | 2 +- core/coreiface/tests/dag.go | 2 +- core/coreiface/tests/name.go | 2 +- core/coreiface/tests/path.go | 10 +++++----- core/coreiface/tests/unixfs.go | 4 ++-- core/coreiface/unixfs.go | 8 ++++---- 12 files changed, 33 insertions(+), 37 deletions(-) delete mode 100644 core/coreiface/path.go diff --git a/core/coreiface/block.go b/core/coreiface/block.go index 9f0ad9cbb4b..b105b079df9 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -14,7 +14,7 @@ type BlockStat interface { Size() int // Path returns path to the block - Path() path.ResolvedPath + Path() path.Resolved } // BlockAPI specifies the interface to the block layer diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index bef3ce01fce..12cb166a884 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -44,7 +44,7 @@ type CoreAPI interface { PubSub() PubSubAPI // ResolvePath resolves the path using Unixfs resolver - ResolvePath(context.Context, path.Path) (path.ResolvedPath, error) + ResolvePath(context.Context, path.Path) (path.Resolved, error) // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 3e4b7e0876e..86536d42109 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -59,11 +59,11 @@ type ObjectChange struct { // Before holds the link path before the change. Note that when a link is // added, this will be nil. - Before path.ResolvedPath + Before path.Resolved // After holds the link path after the change. Note that when a link is // removed, this will be nil. - After path.ResolvedPath + After path.Resolved } // ObjectAPI specifies the interface to MerkleDAG and contains useful utilities @@ -73,7 +73,7 @@ type ObjectAPI interface { New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) // Put imports the data into merkledag - Put(context.Context, io.Reader, ...options.ObjectPutOption) (path.ResolvedPath, error) + Put(context.Context, io.Reader, ...options.ObjectPutOption) (path.Resolved, error) // Get returns the node for the path Get(context.Context, path.Path) (ipld.Node, error) @@ -90,16 +90,16 @@ type ObjectAPI interface { // AddLink adds a link under the specified path. child path can point to a // subdirectory within the patent which must be present (can be overridden // with WithCreate option). - AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...options.ObjectAddLinkOption) (path.ResolvedPath, error) + AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...options.ObjectAddLinkOption) (path.Resolved, error) // RmLink removes a link from the node - RmLink(ctx context.Context, base path.Path, link string) (path.ResolvedPath, error) + RmLink(ctx context.Context, base path.Path, link string) (path.Resolved, error) // AppendData appends data to the node - AppendData(context.Context, path.Path, io.Reader) (path.ResolvedPath, error) + AppendData(context.Context, path.Path, io.Reader) (path.Resolved, error) // SetData sets the data contained in the node - SetData(context.Context, path.Path, io.Reader) (path.ResolvedPath, error) + SetData(context.Context, path.Path, io.Reader) (path.Resolved, error) // Diff returns a set of changes needed to transform the first object into the // second. diff --git a/core/coreiface/path.go b/core/coreiface/path.go deleted file mode 100644 index 198651129c9..00000000000 --- a/core/coreiface/path.go +++ /dev/null @@ -1,4 +0,0 @@ -package iface - -//TODO: merge with ipfspath so we don't depend on it - diff --git a/core/coreiface/path/path.go b/core/coreiface/path/path.go index 414d454fa69..01b1673b1d1 100644 --- a/core/coreiface/path/path.go +++ b/core/coreiface/path/path.go @@ -39,9 +39,9 @@ type Path interface { IsValid() error } -// ResolvedPath is a path which was resolved to the last resolvable node. +// Resolved is a path which was resolved to the last resolvable node. // ResolvedPaths are guaranteed to return nil from `IsValid` -type ResolvedPath interface { +type Resolved interface { // Cid returns the CID of the node referenced by the path. Remainder of the // path is guaranteed to be within the node. // @@ -120,7 +120,7 @@ func Join(base Path, a ...string) Path { } // IpfsPath creates new /ipfs path from the provided CID -func IpfsPath(c cid.Cid) ResolvedPath { +func IpfsPath(c cid.Cid) Resolved { return &resolvedPath{ path: path{"/ipfs/" + c.String()}, cid: c, @@ -130,7 +130,7 @@ func IpfsPath(c cid.Cid) ResolvedPath { } // IpldPath creates new /ipld path from the provided CID -func IpldPath(c cid.Cid) ResolvedPath { +func IpldPath(c cid.Cid) Resolved { return &resolvedPath{ path: path{"/ipld/" + c.String()}, cid: c, @@ -139,8 +139,8 @@ func IpldPath(c cid.Cid) ResolvedPath { } } -// ParsePath parses string path to a Path -func ParsePath(p string) Path { +// New parses string path to a Path +func New(p string) Path { if pp, err := ipfspath.ParsePath(p); err == nil { p = pp.String() } @@ -148,10 +148,10 @@ func ParsePath(p string) Path { return &path{path: p} } -// NewResolvedPath creates new ResolvedPath. This function performs no checks +// NewResolvedPath creates new Resolved path. This function performs no checks // and is intended to be used by resolver implementations. Incorrect inputs may // cause panics. Handle with care. -func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) ResolvedPath { +func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) Resolved { return &resolvedPath{ path: path{ipath.String()}, cid: c, diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 736b2d68b91..7df2956f020 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -10,7 +10,7 @@ import ( // Pin holds information about pinned resource type Pin interface { // Path to the pinned object - Path() path.ResolvedPath + Path() path.Resolved // Type of the pin Type() string @@ -28,7 +28,7 @@ type PinStatus interface { // BadPinNode is a node that has been marked as bad by Pin.Verify type BadPinNode interface { // Path is the path of the node - Path() path.ResolvedPath + Path() path.Resolved // Err is the reason why the node has been marked as bad Err() error diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 59b49d5672e..961ac722d65 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -111,7 +111,7 @@ func (tp *provider) TestBlockGet(t *testing.T) { t.Error("didn't get correct data back") } - p := path.ParsePath("/ipfs/" + res.Path().Cid().String()) + p := path.New("/ipfs/" + res.Path().Cid().String()) rp, err := api.ResolvePath(ctx, p) if err != nil { diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 0abcee32f8d..fe92641f429 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -114,7 +114,7 @@ func (tp *provider) TestDagPath(t *testing.T) { t.Fatal(err) } - p := path.ParsePath(gopath.Join(nd.Cid().String(), "lnk")) + p := path.New(gopath.Join(nd.Cid().String(), "lnk")) rp, err := api.ResolvePath(ctx, p) if err != nil { diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 98ae6853ee6..efaf1d3ae14 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -36,7 +36,7 @@ func addTestObject(ctx context.Context, api coreiface.CoreAPI) (path.Path, error } func appendPath(p path.Path, sub string) path.Path { - return path.ParsePath(gopath.Join(p.String(), sub)) + return path.New(gopath.Join(p.String(), sub)) } func (tp *provider) TestPublishResolve(t *testing.T) { diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 685f469981c..4fd18bd2064 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -75,7 +75,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) { t.Fatal(err) } - rp1, err := api.ResolvePath(ctx, path.ParsePath(nd.String()+"/foo/bar")) + rp1, err := api.ResolvePath(ctx, path.New(nd.String()+"/foo/bar")) if err != nil { t.Fatal(err) } @@ -106,7 +106,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { t.Fatal(err) } - rp1, err := api.ResolvePath(ctx, path.ParsePath(nd.Cid().String())) + rp1, err := api.ResolvePath(ctx, path.New(nd.Cid().String())) if err != nil { t.Fatal(err) } @@ -137,7 +137,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { t.Fatal(err) } - _, err = api.ResolvePath(ctx, path.ParsePath("/ipld/"+nd.Cid().String()+"/bar/baz")) + _, err = api.ResolvePath(ctx, path.New("/ipld/"+nd.Cid().String()+"/bar/baz")) if err == nil || !strings.Contains(err.Error(), "no such link found") { t.Fatalf("unexpected error: %s", err) } @@ -173,7 +173,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { t.Fatal(err) } - rp, err := api.ResolvePath(ctx, path.ParsePath("/ipld/"+nd.Cid().String()+"/foo")) + rp, err := api.ResolvePath(ctx, path.New("/ipld/"+nd.Cid().String()+"/foo")) if err != nil { t.Fatal(err) } @@ -188,7 +188,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { } func (tp *provider) TestPathJoin(t *testing.T) { - p1 := path.ParsePath("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") + p1 := path.New("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") if path.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { t.Error("unexpected path") diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index d2d9f85b854..38fab7cd8be 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -102,7 +102,7 @@ func (tp *provider) TestAdd(t *testing.T) { t.Fatal(err) } - p := func(h string) path.ResolvedPath { + p := func(h string) path.Resolved { c, err := cid.Parse(h) if err != nil { t.Fatal(err) @@ -593,7 +593,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) { t.Fatal(err) } - emptyFilePath := path.ParsePath(emptyFile) + emptyFilePath := path.New(emptyFile) r, err := api.Unixfs().Get(ctx, emptyFilePath) if err != nil { diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 0b27519f378..686c402987a 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -11,9 +11,9 @@ import ( type AddEvent struct { Name string - Path path.ResolvedPath `json:",omitempty"` - Bytes int64 `json:",omitempty"` - Size string `json:",omitempty"` + Path path.Resolved `json:",omitempty"` + Bytes int64 `json:",omitempty"` + Size string `json:",omitempty"` } // FileType is an enum of possible UnixFS file types. @@ -65,7 +65,7 @@ type UnixfsAPI interface { // Add imports the data from the reader into merkledag file // // TODO: a long useful comment on how to use this for many different scenarios - Add(context.Context, files.Node, ...options.UnixfsAddOption) (path.ResolvedPath, error) + Add(context.Context, files.Node, ...options.UnixfsAddOption) (path.Resolved, error) // Get returns a read-only handle to a file tree referenced by a path // From eb58ebe446c0d2d3aad742719c65e8f693f7ce68 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 15 Apr 2019 21:58:51 -0700 Subject: [PATCH 217/286] fix: cleanup TestDhtProvide And fix for peer ID formatting changes. fixes https://github.com/ipfs/go-ipfs/pull/6222#issuecomment-483479039 This commit was moved from ipfs/interface-go-ipfs-core@29b26f5bcb322e936e67dfbb7b0a5264b7e23089 This commit was moved from ipfs/boxo@d493b701942234de0168890c2625082ff382e1b3 --- core/coreiface/tests/dht.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 1793cd7384c..5482b50b13c 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -130,17 +130,17 @@ func (tp *provider) TestDhtProvide(t *testing.T) { t.Fatal(err) } - provider := <-out + _, ok := <-out + + if ok { + t.Fatal("did not expect to find any providers") + } self0, err := apis[0].Key().Self(ctx) if err != nil { t.Fatal(err) } - if provider.ID.String() != "" { - t.Errorf("got wrong provider: %s != %s", provider.ID.String(), self0.ID().String()) - } - err = apis[0].Dht().Provide(ctx, p) if err != nil { t.Fatal(err) @@ -151,7 +151,7 @@ func (tp *provider) TestDhtProvide(t *testing.T) { t.Fatal(err) } - provider = <-out + provider := <-out if provider.ID.String() != self0.ID().String() { t.Errorf("got wrong provider: %s != %s", provider.ID.String(), self0.ID().String()) From ce49669839c31312bbcff89cda410c46a842a026 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 7 May 2019 00:57:21 -0700 Subject: [PATCH 218/286] switch to base32 cidv1 by default This commit was moved from ipfs/interface-go-ipfs-core@6287246646853656271cbd190acab071950d4060 This commit was moved from ipfs/boxo@763b3d8a00d19fd1ba9d5b5b8825cbd7a7f01d1e --- core/coreiface/tests/block.go | 4 ++-- core/coreiface/tests/dag.go | 6 +++--- core/coreiface/tests/unixfs.go | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 961ac722d65..34e47e90c84 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -61,7 +61,7 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != "zdpuAn4amuLWo8Widi5v6VQpuo2dnpnwbVE3oB6qqs7mDSeoa" { + if res.Path().Cid().String() != "bafyreiayl6g3gitr7ys7kyng7sjywlrgimdoymco3jiyab6rozecmoazne" { t.Errorf("got wrong cid: %s", res.Path().Cid().String()) } } @@ -79,7 +79,7 @@ func (tp *provider) TestBlockPutHash(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != "zBurKB9YZkcDf6xa53WBE8CFX4ydVqAyf9KPXBFZt5stJzEstaS8Hukkhu4gwpMtc1xHNDbzP7sPtQKyWsP3C8fbhkmrZ" { + if res.Path().Cid().String() != "bafyb2qgdh7w6dcq24u65xbtdoehyavegnpvxcqce7ttvs6ielgmwdfxrahmu37d33atik57x5y6s7d7qz32aasuwgirh3ocn6ywswqdifvu6e" { t.Errorf("got wrong cid: %s", res.Path().Cid().String()) } } diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index fe92641f429..0bb3aa487ed 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -58,7 +58,7 @@ func (tp *provider) TestPut(t *testing.T) { t.Fatal(err) } - if nd.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { + if nd.Cid().String() != "bafyreicnga62zhxnmnlt6ymq5hcbsg7gdhqdu6z4ehu3wpjhvqnflfy6nm" { t.Errorf("got wrong cid: %s", nd.Cid().String()) } } @@ -81,7 +81,7 @@ func (tp *provider) TestPutWithHash(t *testing.T) { t.Fatal(err) } - if nd.Cid().String() != "z5hRLNd2sv4z1c" { + if nd.Cid().String() != "bafyqabtfjbswy3dp" { t.Errorf("got wrong cid: %s", nd.Cid().String()) } } @@ -179,7 +179,7 @@ func (tp *provider) TestBatch(t *testing.T) { t.Fatal(err) } - if nd.Cid().String() != "zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv" { + if nd.Cid().String() != "bafyreicnga62zhxnmnlt6ymq5hcbsg7gdhqdu6z4ehu3wpjhvqnflfy6nm" { t.Errorf("got wrong cid: %s", nd.Cid().String()) } diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 38fab7cd8be..c810167e8c0 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -170,20 +170,20 @@ func (tp *provider) TestAdd(t *testing.T) { { name: "addCidV1", data: strFile(helloStr), - path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + path: "/ipfs/bafkreidi4zlleupgp2bvrpxyja5lbvi4mym7hz5bvhyoowby2qp7g2hxfa", opts: []options.UnixfsAddOption{options.Unixfs.CidVersion(1)}, }, { name: "addCidV1NoLeaves", data: strFile(helloStr), - path: "/ipfs/zdj7WY4GbN8NDbTW1dfCShAQNVovams2xhq9hVCx5vXcjvT8g", + path: "/ipfs/bafybeibhbcn7k7o2m6xsqkrlfiokod3nxwe47viteynhruh6uqx7hvkjfu", opts: []options.UnixfsAddOption{options.Unixfs.CidVersion(1), options.Unixfs.RawLeaves(false)}, }, // Non sha256 hash vs CID { name: "addCidSha3", data: strFile(helloStr), - path: "/ipfs/zb2wwnYtXBxpndNABjtYxWAPt3cwWNRnc11iT63fvkYV78iRb", + path: "/ipfs/bafkrmichjflejeh6aren53o7pig7zk3m3vxqcoc2i5dv326k3x6obh7jry", opts: []options.UnixfsAddOption{options.Unixfs.Hash(mh.SHA3_256)}, }, { @@ -196,25 +196,25 @@ func (tp *provider) TestAdd(t *testing.T) { { name: "addInline", data: strFile(helloStr), - path: "/ipfs/zaYomJdLndMku8P9LHngHB5w2CQ7NenLbv", + path: "/ipfs/bafyaafikcmeaeeqnnbswy3dpfqqho33snrsccgan", opts: []options.UnixfsAddOption{options.Unixfs.Inline(true)}, }, { name: "addInlineLimit", data: strFile(helloStr), - path: "/ipfs/zaYomJdLndMku8P9LHngHB5w2CQ7NenLbv", + path: "/ipfs/bafyaafikcmeaeeqnnbswy3dpfqqho33snrsccgan", opts: []options.UnixfsAddOption{options.Unixfs.InlineLimit(32), options.Unixfs.Inline(true)}, }, { name: "addInlineZero", data: strFile(""), - path: "/ipfs/z2yYDV", + path: "/ipfs/bafkqaaa", opts: []options.UnixfsAddOption{options.Unixfs.InlineLimit(0), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true)}, }, { //TODO: after coreapi add is used in `ipfs add`, consider making this default for inline name: "addInlineRaw", data: strFile(helloStr), - path: "/ipfs/zj7Gr8AcBreqGEfrnR5kPFe", + path: "/ipfs/bafkqadlimvwgy3zmeb3w64tmmqqq", opts: []options.UnixfsAddOption{options.Unixfs.InlineLimit(32), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true)}, }, // Chunker / Layout @@ -291,20 +291,20 @@ func (tp *provider) TestAdd(t *testing.T) { { name: "simpleNoCopy", data: realFile, - path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + path: "/ipfs/bafkreidi4zlleupgp2bvrpxyja5lbvi4mym7hz5bvhyoowby2qp7g2hxfa", opts: []options.UnixfsAddOption{options.Unixfs.Nocopy(true)}, }, { name: "noCopyNoRaw", data: realFile, - path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + path: "/ipfs/bafkreidi4zlleupgp2bvrpxyja5lbvi4mym7hz5bvhyoowby2qp7g2hxfa", opts: []options.UnixfsAddOption{options.Unixfs.Nocopy(true), options.Unixfs.RawLeaves(false)}, err: "nocopy option requires '--raw-leaves' to be enabled as well", }, { name: "noCopyNoPath", data: strFile(helloStr), - path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + path: "/ipfs/bafkreidi4zlleupgp2bvrpxyja5lbvi4mym7hz5bvhyoowby2qp7g2hxfa", opts: []options.UnixfsAddOption{options.Unixfs.Nocopy(true)}, err: helpers.ErrMissingFsRef.Error(), }, @@ -312,9 +312,9 @@ func (tp *provider) TestAdd(t *testing.T) { { name: "simpleAddEvent", data: strFile(helloStr), - path: "/ipfs/zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", + path: "/ipfs/bafkreidi4zlleupgp2bvrpxyja5lbvi4mym7hz5bvhyoowby2qp7g2hxfa", events: []coreiface.AddEvent{ - {Name: "zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd", Path: p("zb2rhdhmJjJZs9qkhQCpCQ7VREFkqWw3h1r8utjVvQugwHPFd"), Size: strconv.Itoa(len(helloStr))}, + {Name: "bafkreidi4zlleupgp2bvrpxyja5lbvi4mym7hz5bvhyoowby2qp7g2hxfa", Path: p("bafkreidi4zlleupgp2bvrpxyja5lbvi4mym7hz5bvhyoowby2qp7g2hxfa"), Size: strconv.Itoa(len(helloStr))}, }, opts: []options.UnixfsAddOption{options.Unixfs.RawLeaves(true)}, }, From 79958dc097b5b6399e4b4e0af859e711d0f6726e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 17 May 2019 18:57:15 +0200 Subject: [PATCH 219/286] tests: expose TestSuite This commit was moved from ipfs/interface-go-ipfs-core@6fe8577a835a24bf8a38de0d5ee9d1fe6ca9e913 This commit was moved from ipfs/boxo@3d72707f576f881c01bc5fc9ffb97ece3456c014 --- core/coreiface/tests/api.go | 22 ++++++++++++---------- core/coreiface/tests/block.go | 16 ++++++++-------- core/coreiface/tests/dag.go | 12 ++++++------ core/coreiface/tests/dht.go | 8 ++++---- core/coreiface/tests/key.go | 34 +++++++++++++++++----------------- core/coreiface/tests/name.go | 8 ++++---- core/coreiface/tests/object.go | 26 +++++++++++++------------- core/coreiface/tests/path.go | 14 +++++++------- core/coreiface/tests/pin.go | 8 ++++---- core/coreiface/tests/pubsub.go | 4 ++-- core/coreiface/tests/unixfs.go | 26 +++++++++++++------------- 11 files changed, 90 insertions(+), 88 deletions(-) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index 5e7c1f54159..1af3a83b37e 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -11,7 +11,7 @@ import ( var apiNotImplemented = errors.New("api not implemented") -func (tp *provider) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { +func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { api, err := tp.MakeAPISwarm(ctx, false, 1) if err != nil { return nil, err @@ -25,17 +25,19 @@ type Provider interface { MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) } -func (tp *provider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { - tp.apis <- 1 - go func() { - <-ctx.Done() - tp.apis <- -1 - }() +func (tp *TestSuite) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { + if tp.apis != nil { + tp.apis <- 1 + go func() { + <-ctx.Done() + tp.apis <- -1 + }() + } return tp.Provider.MakeAPISwarm(ctx, fullIdentity, n) } -type provider struct { +type TestSuite struct { Provider apis chan int @@ -55,7 +57,7 @@ func TestApi(p Provider) func(t *testing.T) { } }() - tp := &provider{Provider: p, apis: apis} + tp := &TestSuite{Provider: p, apis: apis} return func(t *testing.T) { t.Run("Block", tp.TestBlock) @@ -80,7 +82,7 @@ func TestApi(p Provider) func(t *testing.T) { } } -func (tp *provider) hasApi(t *testing.T, tf func(coreiface.CoreAPI) error) { +func (tp *TestSuite) hasApi(t *testing.T, tf func(coreiface.CoreAPI) error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 34e47e90c84..6b648f39466 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -13,7 +13,7 @@ import ( mh "github.com/multiformats/go-multihash" ) -func (tp *provider) TestBlock(t *testing.T) { +func (tp *TestSuite) TestBlock(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Block() == nil { return apiNotImplemented @@ -30,7 +30,7 @@ func (tp *provider) TestBlock(t *testing.T) { t.Run("TestBlockPin", tp.TestBlockPin) } -func (tp *provider) TestBlockPut(t *testing.T) { +func (tp *TestSuite) TestBlockPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -48,7 +48,7 @@ func (tp *provider) TestBlockPut(t *testing.T) { } } -func (tp *provider) TestBlockPutFormat(t *testing.T) { +func (tp *TestSuite) TestBlockPutFormat(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -66,7 +66,7 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) { } } -func (tp *provider) TestBlockPutHash(t *testing.T) { +func (tp *TestSuite) TestBlockPutHash(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -84,7 +84,7 @@ func (tp *provider) TestBlockPutHash(t *testing.T) { } } -func (tp *provider) TestBlockGet(t *testing.T) { +func (tp *TestSuite) TestBlockGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -122,7 +122,7 @@ func (tp *provider) TestBlockGet(t *testing.T) { } } -func (tp *provider) TestBlockRm(t *testing.T) { +func (tp *TestSuite) TestBlockRm(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -176,7 +176,7 @@ func (tp *provider) TestBlockRm(t *testing.T) { } } -func (tp *provider) TestBlockStat(t *testing.T) { +func (tp *TestSuite) TestBlockStat(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -203,7 +203,7 @@ func (tp *provider) TestBlockStat(t *testing.T) { } } -func (tp *provider) TestBlockPin(t *testing.T) { +func (tp *TestSuite) TestBlockPin(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 0bb3aa487ed..1ccd45d59b2 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -15,7 +15,7 @@ import ( mh "github.com/multiformats/go-multihash" ) -func (tp *provider) TestDag(t *testing.T) { +func (tp *TestSuite) TestDag(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Dag() == nil { return apiNotImplemented @@ -40,7 +40,7 @@ var ( } ) -func (tp *provider) TestPut(t *testing.T) { +func (tp *TestSuite) TestPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -63,7 +63,7 @@ func (tp *provider) TestPut(t *testing.T) { } } -func (tp *provider) TestPutWithHash(t *testing.T) { +func (tp *TestSuite) TestPutWithHash(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -86,7 +86,7 @@ func (tp *provider) TestPutWithHash(t *testing.T) { } } -func (tp *provider) TestDagPath(t *testing.T) { +func (tp *TestSuite) TestDagPath(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -131,7 +131,7 @@ func (tp *provider) TestDagPath(t *testing.T) { } } -func (tp *provider) TestTree(t *testing.T) { +func (tp *TestSuite) TestTree(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -166,7 +166,7 @@ func (tp *provider) TestTree(t *testing.T) { } } -func (tp *provider) TestBatch(t *testing.T) { +func (tp *TestSuite) TestBatch(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 5482b50b13c..33b4ff14c79 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -9,7 +9,7 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestDht(t *testing.T) { +func (tp *TestSuite) TestDht(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Dht() == nil { return apiNotImplemented @@ -22,7 +22,7 @@ func (tp *provider) TestDht(t *testing.T) { t.Run("TestDhtProvide", tp.TestDhtProvide) } -func (tp *provider) TestDhtFindPeer(t *testing.T) { +func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) @@ -75,7 +75,7 @@ func (tp *provider) TestDhtFindPeer(t *testing.T) { } } -func (tp *provider) TestDhtFindProviders(t *testing.T) { +func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) @@ -105,7 +105,7 @@ func (tp *provider) TestDhtFindProviders(t *testing.T) { } } -func (tp *provider) TestDhtProvide(t *testing.T) { +func (tp *TestSuite) TestDhtProvide(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index 7ff5f33300a..e3461f9718a 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -9,7 +9,7 @@ import ( opt "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestKey(t *testing.T) { +func (tp *TestSuite) TestKey(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Key() == nil { return apiNotImplemented @@ -35,7 +35,7 @@ func (tp *provider) TestKey(t *testing.T) { t.Run("TestRemove", tp.TestRemove) } -func (tp *provider) TestListSelf(t *testing.T) { +func (tp *TestSuite) TestListSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -69,7 +69,7 @@ func (tp *provider) TestListSelf(t *testing.T) { } } -func (tp *provider) TestRenameSelf(t *testing.T) { +func (tp *TestSuite) TestRenameSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -97,7 +97,7 @@ func (tp *provider) TestRenameSelf(t *testing.T) { } } -func (tp *provider) TestRemoveSelf(t *testing.T) { +func (tp *TestSuite) TestRemoveSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -116,7 +116,7 @@ func (tp *provider) TestRemoveSelf(t *testing.T) { } } -func (tp *provider) TestGenerate(t *testing.T) { +func (tp *TestSuite) TestGenerate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -139,7 +139,7 @@ func (tp *provider) TestGenerate(t *testing.T) { } } -func (tp *provider) TestGenerateSize(t *testing.T) { +func (tp *TestSuite) TestGenerateSize(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -162,7 +162,7 @@ func (tp *provider) TestGenerateSize(t *testing.T) { } } -func (tp *provider) TestGenerateType(t *testing.T) { +func (tp *TestSuite) TestGenerateType(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() t.Skip("disabled until libp2p/specs#111 is fixed") @@ -188,7 +188,7 @@ func (tp *provider) TestGenerateType(t *testing.T) { } } -func (tp *provider) TestGenerateExisting(t *testing.T) { +func (tp *TestSuite) TestGenerateExisting(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -221,7 +221,7 @@ func (tp *provider) TestGenerateExisting(t *testing.T) { } } -func (tp *provider) TestList(t *testing.T) { +func (tp *TestSuite) TestList(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -267,7 +267,7 @@ func (tp *provider) TestList(t *testing.T) { } } -func (tp *provider) TestRename(t *testing.T) { +func (tp *TestSuite) TestRename(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -296,7 +296,7 @@ func (tp *provider) TestRename(t *testing.T) { } } -func (tp *provider) TestRenameToSelf(t *testing.T) { +func (tp *TestSuite) TestRenameToSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -320,7 +320,7 @@ func (tp *provider) TestRenameToSelf(t *testing.T) { } } -func (tp *provider) TestRenameToSelfForce(t *testing.T) { +func (tp *TestSuite) TestRenameToSelfForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -344,7 +344,7 @@ func (tp *provider) TestRenameToSelfForce(t *testing.T) { } } -func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { +func (tp *TestSuite) TestRenameOverwriteNoForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -374,7 +374,7 @@ func (tp *provider) TestRenameOverwriteNoForce(t *testing.T) { } } -func (tp *provider) TestRenameOverwrite(t *testing.T) { +func (tp *TestSuite) TestRenameOverwrite(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -413,7 +413,7 @@ func (tp *provider) TestRenameOverwrite(t *testing.T) { } } -func (tp *provider) TestRenameSameNameNoForce(t *testing.T) { +func (tp *TestSuite) TestRenameSameNameNoForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -442,7 +442,7 @@ func (tp *provider) TestRenameSameNameNoForce(t *testing.T) { } } -func (tp *provider) TestRenameSameName(t *testing.T) { +func (tp *TestSuite) TestRenameSameName(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -471,7 +471,7 @@ func (tp *provider) TestRenameSameName(t *testing.T) { } } -func (tp *provider) TestRemove(t *testing.T) { +func (tp *TestSuite) TestRemove(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index efaf1d3ae14..31a5c14663f 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -16,7 +16,7 @@ import ( opt "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestName(t *testing.T) { +func (tp *TestSuite) TestName(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Name() == nil { return apiNotImplemented @@ -39,7 +39,7 @@ func appendPath(p path.Path, sub string) path.Path { return path.New(gopath.Join(p.String(), sub)) } -func (tp *provider) TestPublishResolve(t *testing.T) { +func (tp *TestSuite) TestPublishResolve(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() init := func() (coreiface.CoreAPI, path.Path) { @@ -188,7 +188,7 @@ func (tp *provider) TestPublishResolve(t *testing.T) { }) } -func (tp *provider) TestBasicPublishResolveKey(t *testing.T) { +func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(ctx, true, 5) @@ -230,7 +230,7 @@ func (tp *provider) TestBasicPublishResolveKey(t *testing.T) { } } -func (tp *provider) TestBasicPublishResolveTimeout(t *testing.T) { +func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { t.Skip("ValidTime doesn't appear to work at this time resolution") ctx, cancel := context.WithCancel(context.Background()) diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 8682a2edca6..2e066ca71b2 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -12,7 +12,7 @@ import ( opt "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestObject(t *testing.T) { +func (tp *TestSuite) TestObject(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Object() == nil { return apiNotImplemented @@ -34,7 +34,7 @@ func (tp *provider) TestObject(t *testing.T) { t.Run("TestDiffTest", tp.TestDiffTest) } -func (tp *provider) TestNew(t *testing.T) { +func (tp *TestSuite) TestNew(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -61,7 +61,7 @@ func (tp *provider) TestNew(t *testing.T) { } } -func (tp *provider) TestObjectPut(t *testing.T) { +func (tp *TestSuite) TestObjectPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -102,7 +102,7 @@ func (tp *provider) TestObjectPut(t *testing.T) { } } -func (tp *provider) TestObjectGet(t *testing.T) { +func (tp *TestSuite) TestObjectGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -125,7 +125,7 @@ func (tp *provider) TestObjectGet(t *testing.T) { } } -func (tp *provider) TestObjectData(t *testing.T) { +func (tp *TestSuite) TestObjectData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -153,7 +153,7 @@ func (tp *provider) TestObjectData(t *testing.T) { } } -func (tp *provider) TestObjectLinks(t *testing.T) { +func (tp *TestSuite) TestObjectLinks(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -189,7 +189,7 @@ func (tp *provider) TestObjectLinks(t *testing.T) { } } -func (tp *provider) TestObjectStat(t *testing.T) { +func (tp *TestSuite) TestObjectStat(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -237,7 +237,7 @@ func (tp *provider) TestObjectStat(t *testing.T) { } } -func (tp *provider) TestObjectAddLink(t *testing.T) { +func (tp *TestSuite) TestObjectAddLink(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -278,7 +278,7 @@ func (tp *provider) TestObjectAddLink(t *testing.T) { } } -func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { +func (tp *TestSuite) TestObjectAddLinkCreate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -327,7 +327,7 @@ func (tp *provider) TestObjectAddLinkCreate(t *testing.T) { } } -func (tp *provider) TestObjectRmLink(t *testing.T) { +func (tp *TestSuite) TestObjectRmLink(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -360,7 +360,7 @@ func (tp *provider) TestObjectRmLink(t *testing.T) { } } -func (tp *provider) TestObjectAddData(t *testing.T) { +func (tp *TestSuite) TestObjectAddData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -393,7 +393,7 @@ func (tp *provider) TestObjectAddData(t *testing.T) { } } -func (tp *provider) TestObjectSetData(t *testing.T) { +func (tp *TestSuite) TestObjectSetData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -426,7 +426,7 @@ func (tp *provider) TestObjectSetData(t *testing.T) { } } -func (tp *provider) TestDiffTest(t *testing.T) { +func (tp *TestSuite) TestDiffTest(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 4fd18bd2064..2d9497244c9 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -12,7 +12,7 @@ import ( ipldcbor "github.com/ipfs/go-ipld-cbor" ) -func (tp *provider) TestPath(t *testing.T) { +func (tp *TestSuite) TestPath(t *testing.T) { t.Run("TestMutablePath", tp.TestMutablePath) t.Run("TestPathRemainder", tp.TestPathRemainder) t.Run("TestEmptyPathRemainder", tp.TestEmptyPathRemainder) @@ -21,7 +21,7 @@ func (tp *provider) TestPath(t *testing.T) { t.Run("TestPathJoin", tp.TestPathJoin) } -func (tp *provider) TestMutablePath(t *testing.T) { +func (tp *TestSuite) TestMutablePath(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -54,7 +54,7 @@ func (tp *provider) TestMutablePath(t *testing.T) { } } -func (tp *provider) TestPathRemainder(t *testing.T) { +func (tp *TestSuite) TestPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -85,7 +85,7 @@ func (tp *provider) TestPathRemainder(t *testing.T) { } } -func (tp *provider) TestEmptyPathRemainder(t *testing.T) { +func (tp *TestSuite) TestEmptyPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -116,7 +116,7 @@ func (tp *provider) TestEmptyPathRemainder(t *testing.T) { } } -func (tp *provider) TestInvalidPathRemainder(t *testing.T) { +func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -143,7 +143,7 @@ func (tp *provider) TestInvalidPathRemainder(t *testing.T) { } } -func (tp *provider) TestPathRoot(t *testing.T) { +func (tp *TestSuite) TestPathRoot(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -187,7 +187,7 @@ func (tp *provider) TestPathRoot(t *testing.T) { } } -func (tp *provider) TestPathJoin(t *testing.T) { +func (tp *TestSuite) TestPathJoin(t *testing.T) { p1 := path.New("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") if path.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 344db65e200..9b28a682a18 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -14,7 +14,7 @@ import ( ipld "github.com/ipfs/go-ipld-format" ) -func (tp *provider) TestPin(t *testing.T) { +func (tp *TestSuite) TestPin(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Pin() == nil { return apiNotImplemented @@ -27,7 +27,7 @@ func (tp *provider) TestPin(t *testing.T) { t.Run("TestPinRecursive", tp.TestPinRecursive) } -func (tp *provider) TestPinAdd(t *testing.T) { +func (tp *TestSuite) TestPinAdd(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -46,7 +46,7 @@ func (tp *provider) TestPinAdd(t *testing.T) { } } -func (tp *provider) TestPinSimple(t *testing.T) { +func (tp *TestSuite) TestPinSimple(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -96,7 +96,7 @@ func (tp *provider) TestPinSimple(t *testing.T) { } } -func (tp *provider) TestPinRecursive(t *testing.T) { +func (tp *TestSuite) TestPinRecursive(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index 418fc4867c8..e66291572b2 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -9,7 +9,7 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" ) -func (tp *provider) TestPubSub(t *testing.T) { +func (tp *TestSuite) TestPubSub(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.PubSub() == nil { return apiNotImplemented @@ -20,7 +20,7 @@ func (tp *provider) TestPubSub(t *testing.T) { t.Run("TestBasicPubSub", tp.TestBasicPubSub) } -func (tp *provider) TestBasicPubSub(t *testing.T) { +func (tp *TestSuite) TestBasicPubSub(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index c810167e8c0..47ce505c82d 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -28,7 +28,7 @@ import ( mh "github.com/multiformats/go-multihash" ) -func (tp *provider) TestUnixfs(t *testing.T) { +func (tp *TestSuite) TestUnixfs(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Unixfs() == nil { return apiNotImplemented @@ -94,7 +94,7 @@ func wrapped(names ...string) func(f files.Node) files.Node { } } -func (tp *provider) TestAdd(t *testing.T) { +func (tp *TestSuite) TestAdd(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -528,7 +528,7 @@ func (tp *provider) TestAdd(t *testing.T) { } } -func (tp *provider) TestAddPinned(t *testing.T) { +func (tp *TestSuite) TestAddPinned(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -554,7 +554,7 @@ func (tp *provider) TestAddPinned(t *testing.T) { } } -func (tp *provider) TestAddHashOnly(t *testing.T) { +func (tp *TestSuite) TestAddHashOnly(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -580,7 +580,7 @@ func (tp *provider) TestAddHashOnly(t *testing.T) { } } -func (tp *provider) TestGetEmptyFile(t *testing.T) { +func (tp *TestSuite) TestGetEmptyFile(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -610,7 +610,7 @@ func (tp *provider) TestGetEmptyFile(t *testing.T) { } } -func (tp *provider) TestGetDir(t *testing.T) { +func (tp *TestSuite) TestGetDir(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -643,7 +643,7 @@ func (tp *provider) TestGetDir(t *testing.T) { } } -func (tp *provider) TestGetNonUnixfs(t *testing.T) { +func (tp *TestSuite) TestGetNonUnixfs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -663,7 +663,7 @@ func (tp *provider) TestGetNonUnixfs(t *testing.T) { } } -func (tp *provider) TestLs(t *testing.T) { +func (tp *TestSuite) TestLs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -723,7 +723,7 @@ func (tp *provider) TestLs(t *testing.T) { } } -func (tp *provider) TestEntriesExpired(t *testing.T) { +func (tp *TestSuite) TestEntriesExpired(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -765,7 +765,7 @@ func (tp *provider) TestEntriesExpired(t *testing.T) { } } -func (tp *provider) TestLsEmptyDir(t *testing.T) { +func (tp *TestSuite) TestLsEmptyDir(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -794,7 +794,7 @@ func (tp *provider) TestLsEmptyDir(t *testing.T) { } // TODO(lgierth) this should test properly, with len(links) > 0 -func (tp *provider) TestLsNonUnixfs(t *testing.T) { +func (tp *TestSuite) TestLsNonUnixfs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -853,7 +853,7 @@ func (f *closeTestF) Close() error { return nil } -func (tp *provider) TestAddCloses(t *testing.T) { +func (tp *TestSuite) TestAddCloses(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -891,7 +891,7 @@ func (tp *provider) TestAddCloses(t *testing.T) { } } -func (tp *provider) TestGetSeek(t *testing.T) { +func (tp *TestSuite) TestGetSeek(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) From 1f4d8c7243039855f5c62f043168815d057777f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Tue, 28 May 2019 17:09:34 +0100 Subject: [PATCH 220/286] migrate to go-libp2p-core. This commit was moved from ipfs/interface-go-ipfs-core@2cc0c497f2b0b14a4ac22989a3861c1a2b0038c4 This commit was moved from ipfs/boxo@1f2b5ca04f4cb9d5fe9b11d4c58edb91bab8b2a1 --- core/coreiface/dht.go | 7 +++---- core/coreiface/key.go | 2 +- core/coreiface/pubsub.go | 2 +- core/coreiface/swarm.go | 12 ++++++------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 0cb7893ef34..5f49e74a356 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -6,8 +6,7 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" - "github.com/libp2p/go-libp2p-peer" - pstore "github.com/libp2p/go-libp2p-peerstore" + "github.com/libp2p/go-libp2p-core/peer" ) // DhtAPI specifies the interface to the DHT @@ -16,11 +15,11 @@ import ( type DhtAPI interface { // FindPeer queries the DHT for all of the multiaddresses associated with a // Peer ID - FindPeer(context.Context, peer.ID) (pstore.PeerInfo, error) + FindPeer(context.Context, peer.ID) (peer.AddrInfo, error) // FindProviders finds peers in the DHT who can provide a specific value // given a key. - FindProviders(context.Context, path.Path, ...options.DhtFindProvidersOption) (<-chan pstore.PeerInfo, error) + FindProviders(context.Context, path.Path, ...options.DhtFindProvidersOption) (<-chan peer.AddrInfo, error) // Provide announces to the network that you are providing given values Provide(context.Context, path.Path, ...options.DhtProvideOption) error diff --git a/core/coreiface/key.go b/core/coreiface/key.go index e7fb3f44274..db729b3b417 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -6,7 +6,7 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" - "github.com/libp2p/go-libp2p-peer" + "github.com/libp2p/go-libp2p-core/peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index 212e7722536..d9826551d49 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -6,7 +6,7 @@ import ( options "github.com/ipfs/interface-go-ipfs-core/options" - peer "github.com/libp2p/go-libp2p-peer" + "github.com/libp2p/go-libp2p-core/peer" ) // PubSubSubscription is an active PubSub subscription diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index 2e00ecbd311..d7b25d5e87a 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,10 +5,10 @@ import ( "errors" "time" - net "github.com/libp2p/go-libp2p-net" - "github.com/libp2p/go-libp2p-peer" - pstore "github.com/libp2p/go-libp2p-peerstore" - "github.com/libp2p/go-libp2p-protocol" + "github.com/libp2p/go-libp2p-core/network" + "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p-core/protocol" + ma "github.com/multiformats/go-multiaddr" ) @@ -26,7 +26,7 @@ type ConnectionInfo interface { Address() ma.Multiaddr // Direction returns which way the connection was established - Direction() net.Direction + Direction() network.Direction // Latency returns last known round trip time to the peer Latency() (time.Duration, error) @@ -38,7 +38,7 @@ type ConnectionInfo interface { // SwarmAPI specifies the interface to libp2p swarm type SwarmAPI interface { // Connect to a given peer - Connect(context.Context, pstore.PeerInfo) error + Connect(context.Context, peer.AddrInfo) error // Disconnect from a given address Disconnect(context.Context, ma.Multiaddr) error From fafbedb658bbc4e4f317c8c8395794f3617647ba Mon Sep 17 00:00:00 2001 From: Cole Brown Date: Fri, 2 Aug 2019 21:09:17 -0400 Subject: [PATCH 221/286] Bump go-libp2p-core, up test key size to 2048 This commit was moved from ipfs/interface-go-ipfs-core@6ba366dd626d3b605a67d7ade24b3065bc4d9694 This commit was moved from ipfs/boxo@98cec339880e00290049245fc50acf6fc2874701 --- core/coreiface/tests/key.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index e3461f9718a..265a8f06082 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -147,7 +147,7 @@ func (tp *TestSuite) TestGenerateSize(t *testing.T) { t.Fatal(err) } - k, err := api.Key().Generate(ctx, "foo", opt.Key.Size(1024)) + k, err := api.Key().Generate(ctx, "foo", opt.Key.Size(2048)) if err != nil { t.Fatal(err) return From 09a4311db7804b6d511ce99e65029bdb283b2c4d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 23 Aug 2019 16:22:22 -0700 Subject: [PATCH 222/286] test: fix put with hash test We just changed ID/"id" to IDENTITY/"identity" to match the multicodec table and avoid confusion with peer IDs, CIDs, etc. Unfortunately, this breaks the `--hash=id` flag. Luckily, I'm pretty sure nobody's actually using this. As putting a block with an identity hash is useless. If they are users, we can go about adding in backwards compatibility hacks later. This commit was moved from ipfs/interface-go-ipfs-core@6ebdbe7ef3eadc7f832592abb3b1b151d9b4febf This commit was moved from ipfs/boxo@3b9a723861fa7b8069ac6a0c698f83a8b6e82237 --- core/coreiface/tests/dag.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 1ccd45d59b2..2f68bbf05eb 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -71,7 +71,7 @@ func (tp *TestSuite) TestPutWithHash(t *testing.T) { t.Fatal(err) } - nd, err := ipldcbor.FromJSON(strings.NewReader(`"Hello"`), mh.ID, -1) + nd, err := ipldcbor.FromJSON(strings.NewReader(`"Hello"`), mh.SHA3_256, -1) if err != nil { t.Fatal(err) } @@ -81,7 +81,7 @@ func (tp *TestSuite) TestPutWithHash(t *testing.T) { t.Fatal(err) } - if nd.Cid().String() != "bafyqabtfjbswy3dp" { + if nd.Cid().String() != "bafyrmifu7haikttpqqgc5ewvmp76z3z4ebp7h2ph4memw7dq4nt6btmxny" { t.Errorf("got wrong cid: %s", nd.Cid().String()) } } From 5168b591dc343f345b0074bcbee870888a7e001d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 10 Sep 2019 18:23:14 -0700 Subject: [PATCH 223/286] test: test ReadAt if implemented (I plan on adding support to the http client, at least) This commit was moved from ipfs/interface-go-ipfs-core@ae838686170af209e0a9b29aa1a59b64346b5de1 This commit was moved from ipfs/boxo@a8c5ec606246224d3f0dfadfc627a9f90d9b53df --- core/coreiface/tests/unixfs.go | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 47ce505c82d..aac7fa92fb8 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -48,6 +48,7 @@ func (tp *TestSuite) TestUnixfs(t *testing.T) { t.Run("TestLsNonUnixfs", tp.TestLsNonUnixfs) t.Run("TestAddCloses", tp.TestAddCloses) t.Run("TestGetSeek", tp.TestGetSeek) + t.Run("TestGetReadAt", tp.TestGetReadAt) } // `echo -n 'hello, world!' | ipfs add` @@ -996,3 +997,84 @@ func (tp *TestSuite) TestGetSeek(t *testing.T) { test(dataSize-50, io.SeekStart, 100, 50, true) test(-5, io.SeekEnd, 100, 5, true) } + +func (tp *TestSuite) TestGetReadAt(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + dataSize := int64(100000) + tf := files.NewReaderFile(io.LimitReader(rand.New(rand.NewSource(1403768328)), dataSize)) + + p, err := api.Unixfs().Add(ctx, tf, options.Unixfs.Chunker("size-100")) + if err != nil { + t.Fatal(err) + } + + r, err := api.Unixfs().Get(ctx, p) + if err != nil { + t.Fatal(err) + } + + f, ok := r.(interface { + files.File + io.ReaderAt + }) + if !ok { + t.Skip("ReaderAt not implemented") + } + + orig := make([]byte, dataSize) + if _, err := io.ReadFull(f, orig); err != nil { + t.Fatal(err) + } + f.Close() + + origR := bytes.NewReader(orig) + + r, err = api.Unixfs().Get(ctx, p) + if err != nil { + t.Fatal(err) + } + + test := func(offset int64, read int, expect int64, shouldEof bool) { + t.Run(fmt.Sprintf("readat%d-r%d-%d", offset, read, expect), func(t *testing.T) { + origBuf := make([]byte, read) + origRead, err := origR.ReadAt(origBuf, offset) + if err != nil && err != io.EOF { + t.Fatalf("orig: %s", err) + } + buf := make([]byte, read) + r, err := f.ReadAt(buf, offset) + if shouldEof { + if err != io.EOF { + t.Fatal("expected EOF, got: ", err) + } + } else if err != nil { + t.Fatal("got: ", err) + } + + if int64(r) != expect { + t.Fatal("read wrong amount of data") + } + if r != origRead { + t.Fatal("read different amount of data than bytes.Reader") + } + if !bytes.Equal(buf, origBuf) { + fmt.Fprintf(os.Stderr, "original:\n%s\n", hex.Dump(origBuf)) + fmt.Fprintf(os.Stderr, "got:\n%s\n", hex.Dump(buf)) + t.Fatal("data didn't match") + } + }) + } + + test(3, 10, 10, false) + test(13, 10, 10, false) + test(513, 10, 10, false) + test(350, 100, 100, false) + test(0, int(dataSize), dataSize, false) + test(dataSize-50, 100, 50, true) +} From 58df273d66f263915aad240a414df15ac538a0e2 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 27 Sep 2019 16:21:44 -0700 Subject: [PATCH 224/286] fix(test): fix a flaky pubsub test This commit was moved from ipfs/interface-go-ipfs-core@00de46e290cf0a47bb78a9e8aa264f4b6ce941cd This commit was moved from ipfs/boxo@125f06e6af82e7502de7596d9cfb5a3b560df4e5 --- core/coreiface/tests/pubsub.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index e66291572b2..36353f83609 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -34,13 +34,20 @@ func (tp *TestSuite) TestBasicPubSub(t *testing.T) { t.Fatal(err) } + done := make(chan struct{}) go func() { + defer close(done) + ticker := time.NewTicker(100 * time.Millisecond) defer ticker.Stop() for { err := apis[1].PubSub().Publish(ctx, "testch", []byte("hello world")) - if err != nil { + switch err { + case nil: + case context.Canceled: + return + default: t.Error(err) cancel() return @@ -53,6 +60,13 @@ func (tp *TestSuite) TestBasicPubSub(t *testing.T) { } }() + // Wait for the sender to finish before we return. + // Otherwise, we can get random errors as publish fails. + defer func() { + cancel() + <-done + }() + m, err := sub.Next(ctx) if err != nil { t.Fatal(err) From c23fa6e2f1f8732794fcb227ce109a5d04f5ed0f Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Fri, 11 Oct 2019 11:14:39 -0400 Subject: [PATCH 225/286] test(pinning): add pin ls tests for indirect pin traversal and pin type precedence This commit was moved from ipfs/interface-go-ipfs-core@cd7be61c71d8169a47604247588b258699f45b5d This commit was moved from ipfs/boxo@30eb9c7c432be938b40951a4c98b8cfbe67899cc --- core/coreiface/tests/pin.go | 269 +++++++++++++++++++++++++++++++++++- 1 file changed, 268 insertions(+), 1 deletion(-) diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 9b28a682a18..7e574fa0df6 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -2,14 +2,15 @@ package tests import ( "context" - "github.com/ipfs/interface-go-ipfs-core/path" "math" "strings" "testing" "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/path" + "github.com/ipfs/go-cid" ipldcbor "github.com/ipfs/go-ipld-cbor" ipld "github.com/ipfs/go-ipld-format" ) @@ -25,6 +26,8 @@ func (tp *TestSuite) TestPin(t *testing.T) { t.Run("TestPinAdd", tp.TestPinAdd) t.Run("TestPinSimple", tp.TestPinSimple) t.Run("TestPinRecursive", tp.TestPinRecursive) + t.Run("TestPinLsIndirect", tp.TestPinLsIndirect) + t.Run("TestPinLsPrecedence", tp.TestPinLsPrecedence) } func (tp *TestSuite) TestPinAdd(t *testing.T) { @@ -238,3 +241,267 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { } */ } + +// TestPinLsIndirect verifies that indirect nodes are listed by pin ls even if a parent node is directly pinned +func (tp *TestSuite) TestPinLsIndirect(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "foo") + + err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid())) + if err != nil { + t.Fatal(err) + } + + err = api.Pin().Add(ctx, path.IpldPath(parent.Cid()), opt.Pin.Recursive(false)) + if err != nil { + t.Fatal(err) + } + + assertPinTypes(t, ctx, api, []cidContainer{grandparent}, []cidContainer{parent}, []cidContainer{leaf}) +} + +// TestPinLsPrecedence verifies the precedence of pins (recursive > direct > indirect) +func (tp *TestSuite) TestPinLsPrecedence(t *testing.T) { + // Testing precedence of recursive, direct and indirect pins + // Results should be recursive > indirect, direct > indirect, and recursive > direct + + t.Run("TestPinLsPredenceRecursiveIndirect", tp.TestPinLsPredenceRecursiveIndirect) + t.Run("TestPinLsPrecedenceDirectIndirect", tp.TestPinLsPrecedenceDirectIndirect) + t.Run("TestPinLsPrecedenceRecursiveDirect", tp.TestPinLsPrecedenceRecursiveDirect) +} + +func (tp *TestSuite) TestPinLsPredenceRecursiveIndirect(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + // Test recursive > indirect + leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "recursive > indirect") + + err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid())) + if err != nil { + t.Fatal(err) + } + + err = api.Pin().Add(ctx, path.IpldPath(parent.Cid())) + if err != nil { + t.Fatal(err) + } + + assertPinTypes(t, ctx, api, []cidContainer{grandparent, parent}, []cidContainer{}, []cidContainer{leaf}) +} + +func (tp *TestSuite) TestPinLsPrecedenceDirectIndirect(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + // Test direct > indirect + leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "direct > indirect") + + err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid())) + if err != nil { + t.Fatal(err) + } + + err = api.Pin().Add(ctx, path.IpldPath(parent.Cid()), opt.Pin.Recursive(false)) + if err != nil { + t.Fatal(err) + } + + assertPinTypes(t, ctx, api, []cidContainer{grandparent}, []cidContainer{parent}, []cidContainer{leaf}) +} + +func (tp *TestSuite) TestPinLsPrecedenceRecursiveDirect(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + // Test recursive > direct + leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "recursive + direct = error") + + err = api.Pin().Add(ctx, path.IpldPath(parent.Cid())) + if err != nil { + t.Fatal(err) + } + + err = api.Pin().Add(ctx, path.IpldPath(parent.Cid()), opt.Pin.Recursive(false)) + if err == nil { + t.Fatal("expected error directly pinning a recursively pinned node") + } + + assertPinTypes(t, ctx, api, []cidContainer{parent}, []cidContainer{}, []cidContainer{leaf}) + + err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid()), opt.Pin.Recursive(false)) + if err != nil { + t.Fatal(err) + } + + err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid())) + if err != nil { + t.Fatal(err) + } + + assertPinTypes(t, ctx, api, []cidContainer{grandparent, parent}, []cidContainer{}, []cidContainer{leaf}) +} + +type cidContainer interface { + Cid() cid.Cid +} + +func getThreeChainedNodes(t *testing.T, ctx context.Context, api iface.CoreAPI, leafData string) (cidContainer, cidContainer, cidContainer) { + leaf, err := api.Unixfs().Add(ctx, strFile(leafData)()) + if err != nil { + t.Fatal(err) + } + + parent, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+leaf.Cid().String()+`"}}`), math.MaxUint64, -1) + if err != nil { + t.Fatal(err) + } + + grandparent, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+parent.Cid().String()+`"}}`), math.MaxUint64, -1) + if err != nil { + t.Fatal(err) + } + + if err := api.Dag().AddMany(ctx, []ipld.Node{parent, grandparent}); err != nil { + t.Fatal(err) + } + + return leaf, parent, grandparent +} + +func assertPinTypes(t *testing.T, ctx context.Context, api iface.CoreAPI, recusive, direct, indirect []cidContainer) { + assertPinLsAllConsistency(t, ctx, api) + + list, err := api.Pin().Ls(ctx, opt.Pin.Type.Recursive()) + if err != nil { + t.Fatal(err) + } + + assertPinCids(t, list, recusive...) + + list, err = api.Pin().Ls(ctx, opt.Pin.Type.Direct()) + if err != nil { + t.Fatal(err) + } + + assertPinCids(t, list, direct...) + + list, err = api.Pin().Ls(ctx, opt.Pin.Type.Indirect()) + if err != nil { + t.Fatal(err) + } + + assertPinCids(t, list, indirect...) +} + +// assertPinCids verifies that the pins match the expected cids +func assertPinCids(t *testing.T, pins []iface.Pin, cids ...cidContainer) { + t.Helper() + + if expected, actual := len(cids), len(pins); expected != actual { + t.Fatalf("expected pin list to have len %d, was %d", expected, actual) + } + + cSet := cid.NewSet() + for _, c := range cids { + cSet.Add(c.Cid()) + } + + valid := true + for _, p := range pins { + c := p.Path().Cid() + if cSet.Has(c) { + cSet.Remove(c) + } else { + valid = false + break + } + } + + valid = valid && cSet.Len() == 0 + + if !valid { + pinStrs := make([]string, len(pins)) + for i, p := range pins { + pinStrs[i] = p.Path().Cid().String() + } + pathStrs := make([]string, len(cids)) + for i, c := range cids { + pathStrs[i] = c.Cid().String() + } + t.Fatalf("expected: %s \nactual: %s", strings.Join(pathStrs, ", "), strings.Join(pinStrs, ", ")) + } +} + +// assertPinLsAllConsistency verifies that listing all pins gives the same result as listing the pin types individually +func assertPinLsAllConsistency(t *testing.T, ctx context.Context, api iface.CoreAPI) { + t.Helper() + allPins, err := api.Pin().Ls(ctx) + if err != nil { + t.Fatal(err) + } + + type pinTypeProps struct { + *cid.Set + opt.PinLsOption + } + + all, recursive, direct, indirect := cid.NewSet(), cid.NewSet(), cid.NewSet(), cid.NewSet() + typeMap := map[string]*pinTypeProps{ + "recursive": {recursive, opt.Pin.Type.Recursive()}, + "direct": {direct, opt.Pin.Type.Direct()}, + "indirect": {indirect, opt.Pin.Type.Indirect()}, + } + + for _, p := range allPins { + if !all.Visit(p.Path().Cid()) { + t.Fatalf("pin ls returned the same cid multiple times") + } + + typeStr := p.Type() + if typeSet, ok := typeMap[p.Type()]; ok { + typeSet.Add(p.Path().Cid()) + } else { + t.Fatalf("unknown pin type: %s", typeStr) + } + } + + for typeStr, pinProps := range typeMap { + pins, err := api.Pin().Ls(ctx, pinProps.PinLsOption) + if err != nil { + t.Fatal(err) + } + + if expected, actual := len(pins), pinProps.Set.Len(); expected != actual { + t.Fatalf("pin ls all has %d pins of type %s, but pin ls for the type has %d", expected, typeStr, actual) + } + + for _, p := range pins { + if pinType := p.Type(); pinType != typeStr { + t.Fatalf("returned wrong pin type: expected %s, got %s", typeStr, pinType) + } + + if c := p.Path().Cid(); !pinProps.Has(c) { + t.Fatalf("%s expected to be in pin ls all as type %s", c.String(), typeStr) + } + } + } +} From e3b5686710f471a15d736c62ef2f6e66bbbec8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Wed, 27 Nov 2019 21:40:22 +0100 Subject: [PATCH 226/286] feat: make the CoreAPI expose a streaming pin interface This commit was moved from ipfs/interface-go-ipfs-core@f976af7ba62d0209b53aeef72fb102c4387d3f00 This commit was moved from ipfs/boxo@6eb5c9791b91da125d269d84b201d0acc8e7657a --- core/coreiface/pin.go | 5 ++++- core/coreiface/tests/block.go | 2 +- core/coreiface/tests/pin.go | 39 ++++++++++++++++++++++++---------- core/coreiface/tests/unixfs.go | 2 +- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 7df2956f020..27f9355d39a 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -14,6 +14,9 @@ type Pin interface { // Type of the pin Type() string + + // if not nil, an error happened. Everything else should be ignored. + Err() error } // PinStatus holds information about pin health @@ -41,7 +44,7 @@ type PinAPI interface { Add(context.Context, path.Path, ...options.PinAddOption) error // Ls returns list of pinned objects on this node - Ls(context.Context, ...options.PinLsOption) ([]Pin, error) + Ls(context.Context, ...options.PinLsOption) (<-chan Pin, error) // Rm removes pin for object specified by the path Rm(context.Context, path.Path, ...options.PinRmOption) error diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 6b648f39466..2048dd4c264 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -225,7 +225,7 @@ func (tp *TestSuite) TestBlockPin(t *testing.T) { t.Fatal(err) } - pins, err := api.Pin().Ls(ctx) + pins, err := accPins(api.Pin().Ls(ctx)) if err != nil { return } diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 7e574fa0df6..a968490d338 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -67,7 +67,7 @@ func (tp *TestSuite) TestPinSimple(t *testing.T) { t.Fatal(err) } - list, err := api.Pin().Ls(ctx) + list, err := accPins(api.Pin().Ls(ctx)) if err != nil { t.Fatal(err) } @@ -89,7 +89,7 @@ func (tp *TestSuite) TestPinSimple(t *testing.T) { t.Fatal(err) } - list, err = api.Pin().Ls(ctx) + list, err = accPins(api.Pin().Ls(ctx)) if err != nil { t.Fatal(err) } @@ -141,7 +141,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Fatal(err) } - list, err := api.Pin().Ls(ctx) + list, err := accPins(api.Pin().Ls(ctx)) if err != nil { t.Fatal(err) } @@ -150,7 +150,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - list, err = api.Pin().Ls(ctx, opt.Pin.Type.Direct()) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Direct())) if err != nil { t.Fatal(err) } @@ -163,7 +163,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpfsPath(nd2.Cid()).String()) } - list, err = api.Pin().Ls(ctx, opt.Pin.Type.Recursive()) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Recursive())) if err != nil { t.Fatal(err) } @@ -176,7 +176,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpldPath(nd3.Cid()).String()) } - list, err = api.Pin().Ls(ctx, opt.Pin.Type.Indirect()) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Indirect())) if err != nil { t.Fatal(err) } @@ -390,21 +390,21 @@ func getThreeChainedNodes(t *testing.T, ctx context.Context, api iface.CoreAPI, func assertPinTypes(t *testing.T, ctx context.Context, api iface.CoreAPI, recusive, direct, indirect []cidContainer) { assertPinLsAllConsistency(t, ctx, api) - list, err := api.Pin().Ls(ctx, opt.Pin.Type.Recursive()) + list, err := accPins(api.Pin().Ls(ctx, opt.Pin.Type.Recursive())) if err != nil { t.Fatal(err) } assertPinCids(t, list, recusive...) - list, err = api.Pin().Ls(ctx, opt.Pin.Type.Direct()) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Direct())) if err != nil { t.Fatal(err) } assertPinCids(t, list, direct...) - list, err = api.Pin().Ls(ctx, opt.Pin.Type.Indirect()) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Indirect())) if err != nil { t.Fatal(err) } @@ -454,7 +454,7 @@ func assertPinCids(t *testing.T, pins []iface.Pin, cids ...cidContainer) { // assertPinLsAllConsistency verifies that listing all pins gives the same result as listing the pin types individually func assertPinLsAllConsistency(t *testing.T, ctx context.Context, api iface.CoreAPI) { t.Helper() - allPins, err := api.Pin().Ls(ctx) + allPins, err := accPins(api.Pin().Ls(ctx)) if err != nil { t.Fatal(err) } @@ -485,7 +485,7 @@ func assertPinLsAllConsistency(t *testing.T, ctx context.Context, api iface.Core } for typeStr, pinProps := range typeMap { - pins, err := api.Pin().Ls(ctx, pinProps.PinLsOption) + pins, err := accPins(api.Pin().Ls(ctx, pinProps.PinLsOption)) if err != nil { t.Fatal(err) } @@ -505,3 +505,20 @@ func assertPinLsAllConsistency(t *testing.T, ctx context.Context, api iface.Core } } } + +func accPins(pins <-chan iface.Pin, err error) ([]iface.Pin, error) { + if err != nil { + return nil, err + } + + var result []iface.Pin + + for pin := range pins { + if pin.Err() != nil { + return nil, pin.Err() + } + result = append(result, pin) + } + + return result, nil +} diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index aac7fa92fb8..1ed80e8733e 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -542,7 +542,7 @@ func (tp *TestSuite) TestAddPinned(t *testing.T) { t.Fatal(err) } - pins, err := api.Pin().Ls(ctx) + pins, err := accPins(api.Pin().Ls(ctx)) if err != nil { t.Fatal(err) } From 8eff544241ee85a27617c0146dcaaae8054e4b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Fri, 29 Nov 2019 22:21:29 +0100 Subject: [PATCH 227/286] fix some tests This commit was moved from ipfs/interface-go-ipfs-core@48dcedecd468c06e3321b4217b51f67180d07eec This commit was moved from ipfs/boxo@689e92b560ca2404db9edd1e8b65cd1a5e929881 --- core/coreiface/tests/block.go | 2 +- core/coreiface/tests/pin.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 2048dd4c264..51c099bd080 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -227,7 +227,7 @@ func (tp *TestSuite) TestBlockPin(t *testing.T) { pins, err := accPins(api.Pin().Ls(ctx)) if err != nil { - return + t.Skip(err) } if len(pins) != 1 { t.Fatal("expected 1 pin") diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index a968490d338..58e8120842e 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -160,7 +160,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { } if list[0].Path().String() != path.IpldPath(nd3.Cid()).String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpfsPath(nd2.Cid()).String()) + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpfsPath(nd3.Cid()).String()) } list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Recursive())) @@ -173,7 +173,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { } if list[0].Path().String() != path.IpldPath(nd2.Cid()).String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpldPath(nd3.Cid()).String()) + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpldPath(nd2.Cid()).String()) } list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Indirect())) @@ -186,7 +186,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { } if list[0].Path().Cid().String() != p0.Cid().String() { - t.Error("unexpected path") + t.Errorf("unexpected path, %s != %s", list[0].Path().Cid().String(), p0.Cid().String()) } res, err := api.Pin().Verify(ctx) From e5059d9e1de51229ce49b275665903d9511adffb Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 2 Dec 2019 15:04:28 -0500 Subject: [PATCH 228/286] fix(tests): put valid blocks This commit was moved from ipfs/interface-go-ipfs-core@16127b291793c593b78fb2909bbaf106612ffc30 This commit was moved from ipfs/boxo@b1c5044d1541aa39ed8e6fff8f47c71bf012a7eb --- core/coreiface/tests/block.go | 52 ++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 51c099bd080..09a36b5fe90 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -1,18 +1,34 @@ package tests import ( + "bytes" "context" - "github.com/ipfs/interface-go-ipfs-core/path" + "io" "io/ioutil" "strings" "testing" coreiface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/path" mh "github.com/multiformats/go-multihash" ) +var ( + pbCid = "QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN" + cborCid = "bafyreicnga62zhxnmnlt6ymq5hcbsg7gdhqdu6z4ehu3wpjhvqnflfy6nm" + cborKCid = "bafyr2qgsohbwdlk7ajmmbb4lhoytmest4wdbe5xnexfvtxeatuyqqmwv3fgxp3pmhpc27gwey2cct56gloqefoqwcf3yqiqzsaqb7p4jefhcw" +) + +func pbBlock() io.Reader { + return bytes.NewReader([]byte{10, 12, 8, 2, 18, 6, 104, 101, 108, 108, 111, 10, 24, 6}) +} + +func cborBlock() io.Reader { + return bytes.NewReader([]byte{101, 72, 101, 108, 108, 111}) +} + func (tp *TestSuite) TestBlock(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Block() == nil { @@ -38,12 +54,12 @@ func (tp *TestSuite) TestBlockPut(t *testing.T) { t.Fatal(err) } - res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) + res, err := api.Block().Put(ctx, pbBlock()) if err != nil { t.Fatal(err) } - if res.Path().Cid().String() != "QmPyo15ynbVrSTVdJL9th7JysHaAbXt9dM9tXk1bMHbRtk" { + if res.Path().Cid().String() != pbCid { t.Errorf("got wrong cid: %s", res.Path().Cid().String()) } } @@ -56,12 +72,12 @@ func (tp *TestSuite) TestBlockPutFormat(t *testing.T) { t.Fatal(err) } - res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Format("cbor")) + res, err := api.Block().Put(ctx, cborBlock(), opt.Block.Format("cbor")) if err != nil { t.Fatal(err) } - if res.Path().Cid().String() != "bafyreiayl6g3gitr7ys7kyng7sjywlrgimdoymco3jiyab6rozecmoazne" { + if res.Path().Cid().String() != cborCid { t.Errorf("got wrong cid: %s", res.Path().Cid().String()) } } @@ -74,12 +90,17 @@ func (tp *TestSuite) TestBlockPutHash(t *testing.T) { t.Fatal(err) } - res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Hash(mh.KECCAK_512, -1)) + res, err := api.Block().Put( + ctx, + cborBlock(), + opt.Block.Hash(mh.KECCAK_512, -1), + opt.Block.Format("cbor"), + ) if err != nil { t.Fatal(err) } - if res.Path().Cid().String() != "bafyb2qgdh7w6dcq24u65xbtdoehyavegnpvxcqce7ttvs6ielgmwdfxrahmu37d33atik57x5y6s7d7qz32aasuwgirh3ocn6ywswqdifvu6e" { + if res.Path().Cid().String() != cborKCid { t.Errorf("got wrong cid: %s", res.Path().Cid().String()) } } @@ -92,7 +113,7 @@ func (tp *TestSuite) TestBlockGet(t *testing.T) { t.Fatal(err) } - res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Hash(mh.KECCAK_512, -1)) + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Format("raw")) if err != nil { t.Fatal(err) } @@ -130,7 +151,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) { t.Fatal(err) } - res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Format("raw")) if err != nil { t.Fatal(err) } @@ -184,7 +205,7 @@ func (tp *TestSuite) TestBlockStat(t *testing.T) { t.Fatal(err) } - res, err := api.Block().Put(ctx, strings.NewReader(`Hello`)) + res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Format("raw")) if err != nil { t.Fatal(err) } @@ -211,7 +232,7 @@ func (tp *TestSuite) TestBlockPin(t *testing.T) { t.Fatal(err) } - _, err = api.Block().Put(ctx, strings.NewReader(`Hello`)) + _, err = api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Format("raw")) if err != nil { t.Fatal(err) } @@ -220,14 +241,19 @@ func (tp *TestSuite) TestBlockPin(t *testing.T) { t.Fatal("expected 0 pins") } - res, err := api.Block().Put(ctx, strings.NewReader(`Hello`), opt.Block.Pin(true)) + res, err := api.Block().Put( + ctx, + strings.NewReader(`Hello`), + opt.Block.Pin(true), + opt.Block.Format("raw"), + ) if err != nil { t.Fatal(err) } pins, err := accPins(api.Pin().Ls(ctx)) if err != nil { - t.Skip(err) + t.Fatal(err) } if len(pins) != 1 { t.Fatal("expected 1 pin") From 80a898dd552426b37593889eaa68b870f4c0cfe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Wed, 22 Jan 2020 17:11:19 +0100 Subject: [PATCH 229/286] test: fail early on err to avoid an unrelated panic This commit was moved from ipfs/interface-go-ipfs-core@df21c57e0f09b481b02f09cf3da20d17d25414e9 This commit was moved from ipfs/boxo@7a2fc1b8165e4079351f62ed4eec6a3fd9bd0aac --- core/coreiface/tests/block.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 6b648f39466..3777d22599c 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -156,7 +156,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) { _, err = api.Block().Get(ctx, res.Path()) if err == nil { - t.Error("expected err to exist") + t.Fatal("expected err to exist") } if !strings.Contains(err.Error(), "blockservice: key not found") { t.Errorf("unexpected error; %s", err.Error()) @@ -164,7 +164,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) { err = api.Block().Rm(ctx, res.Path()) if err == nil { - t.Error("expected err to exist") + t.Fatal("expected err to exist") } if !strings.Contains(err.Error(), "blockstore: block not found") { t.Errorf("unexpected error; %s", err.Error()) From b52034068c6f306f3d111b3dfce9427535127e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Fri, 29 Nov 2019 22:33:13 +0100 Subject: [PATCH 230/286] pin: add a IsPinned method This commit was moved from ipfs/interface-go-ipfs-core@c82db2ef2270a228185aaba6b08ecd7157a7ebee This commit was moved from ipfs/boxo@e84cc0569818ce3b28ff7ea27b5077fe17232163 --- core/coreiface/options/pin.go | 184 +++++++++++++++++++++++++++------- core/coreiface/pin.go | 4 + core/coreiface/tests/pin.go | 95 ++++++++++++++++-- 3 files changed, 237 insertions(+), 46 deletions(-) diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index 6b211bb73bc..231f0d11a85 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -1,13 +1,23 @@ package options +import "fmt" + type PinAddSettings struct { Recursive bool } +type TypeSettings struct { + Type string +} + type PinLsSettings struct { Type string } +type PinIsPinnedSettings struct { + WithType string +} + // PinRmSettings represents the settings of pin rm command type PinRmSettings struct { Recursive bool @@ -17,13 +27,19 @@ type PinUpdateSettings struct { Unpin bool } +// PinAddOption pin add option func type PinAddOption func(*PinAddSettings) error +// PinLsOption pin ls option func +type PinLsOption func(*PinLsSettings) error + +// PinIsPinnedOption pin isPinned option func +type PinIsPinnedOption func(*PinIsPinnedSettings) error + // PinRmOption pin rm option func type PinRmOption func(*PinRmSettings) error -// PinLsOption pin ls option func -type PinLsOption func(*PinLsSettings) error +// PinUpdateOption pin update option func type PinUpdateOption func(*PinUpdateSettings) error func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { @@ -41,14 +57,14 @@ func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { return options, nil } -// PinRmOptions pin rm options -func PinRmOptions(opts ...PinRmOption) (*PinRmSettings, error) { - options := &PinRmSettings{ - Recursive: true, +func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { + options := &PinLsSettings{ + Type: "all", } for _, opt := range opts { - if err := opt(options); err != nil { + err := opt(options) + if err != nil { return nil, err } } @@ -56,9 +72,9 @@ func PinRmOptions(opts ...PinRmOption) (*PinRmSettings, error) { return options, nil } -func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { - options := &PinLsSettings{ - Type: "all", +func PinIsPinnedOptions(opts ...PinIsPinnedOption) (*PinIsPinnedSettings, error) { + options := &PinIsPinnedSettings{ + WithType: "all", } for _, opt := range opts { @@ -71,6 +87,21 @@ func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { return options, nil } +// PinRmOptions pin rm options +func PinRmOptions(opts ...PinRmOption) (*PinRmSettings, error) { + options := &PinRmSettings{ + Recursive: true, + } + + for _, opt := range opts { + if err := opt(options); err != nil { + return nil, err + } + } + + return options, nil +} + func PinUpdateOptions(opts ...PinUpdateOption) (*PinUpdateSettings, error) { options := &PinUpdateSettings{ Unpin: true, @@ -86,36 +117,131 @@ func PinUpdateOptions(opts ...PinUpdateOption) (*PinUpdateSettings, error) { return options, nil } -type pinType struct{} - type pinOpts struct { - Type pinType + Ls pinLsOpts + IsPinned pinIsPinnedOpts } var Pin pinOpts +type pinLsOpts struct{} + // All is an option for Pin.Ls which will make it return all pins. It is // the default -func (pinType) All() PinLsOption { - return Pin.pinType("all") +func (pinLsOpts) All() PinLsOption { + return Pin.Ls.pinType("all") } // Recursive is an option for Pin.Ls which will make it only return recursive // pins -func (pinType) Recursive() PinLsOption { - return Pin.pinType("recursive") +func (pinLsOpts) Recursive() PinLsOption { + return Pin.Ls.pinType("recursive") } // Direct is an option for Pin.Ls which will make it only return direct (non // recursive) pins -func (pinType) Direct() PinLsOption { - return Pin.pinType("direct") +func (pinLsOpts) Direct() PinLsOption { + return Pin.Ls.pinType("direct") } // Indirect is an option for Pin.Ls which will make it only return indirect pins // (objects referenced by other recursively pinned objects) -func (pinType) Indirect() PinLsOption { - return Pin.pinType("indirect") +func (pinLsOpts) Indirect() PinLsOption { + return Pin.Ls.pinType("indirect") +} + +// Type is an option for Pin.Ls which will make it only return pins of the given +// type. +// +// Supported values: +// * "direct" - directly pinned objects +// * "recursive" - roots of recursive pins +// * "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// * "all" - all pinned objects (default) +func (pinLsOpts) Type(typeStr string) (PinLsOption, error) { + switch typeStr { + case "all", "direct", "indirect", "recursive": + return Pin.Ls.pinType(typeStr), nil + default: + return nil, fmt.Errorf("invalid type '%s', must be one of {direct, indirect, recursive, all}", typeStr) + } +} + +// pinType is an option for Pin.Ls which allows to specify which pin types should +// be returned +// +// Supported values: +// * "direct" - directly pinned objects +// * "recursive" - roots of recursive pins +// * "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// * "all" - all pinned objects (default) +func (pinLsOpts) pinType(t string) PinLsOption { + return func(settings *PinLsSettings) error { + settings.Type = t + return nil + } +} + +type pinIsPinnedOpts struct{} + +// All is an option for Pin.IsPinned which will make it search in all type of pins. +// It is the default +func (pinIsPinnedOpts) All() PinIsPinnedOption { + return Pin.IsPinned.pinType("all") +} + +// Recursive is an option for Pin.IsPinned which will make it only search in +// recursive pins +func (pinIsPinnedOpts) Recursive() PinIsPinnedOption { + return Pin.IsPinned.pinType("recursive") +} + +// Direct is an option for Pin.IsPinned which will make it only search in direct +// (non recursive) pins +func (pinIsPinnedOpts) Direct() PinIsPinnedOption { + return Pin.IsPinned.pinType("direct") +} + +// Indirect is an option for Pin.IsPinned which will make it only search indirect +// pins (objects referenced by other recursively pinned objects) +func (pinIsPinnedOpts) Indirect() PinIsPinnedOption { + return Pin.IsPinned.pinType("indirect") +} + +// Type is an option for Pin.IsPinned which will make it only search pins of the given +// type. +// +// Supported values: +// * "direct" - directly pinned objects +// * "recursive" - roots of recursive pins +// * "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// * "all" - all pinned objects (default) +func (pinIsPinnedOpts) Type(typeStr string) (PinIsPinnedOption, error) { + switch typeStr { + case "all", "direct", "indirect", "recursive": + return Pin.IsPinned.pinType(typeStr), nil + default: + return nil, fmt.Errorf("invalid type '%s', must be one of {direct, indirect, recursive, all}", typeStr) + } +} + +// pinType is an option for Pin.IsPinned which allows to specify which pin type the given +// pin is expected to be, speeding up the research. +// +// Supported values: +// * "direct" - directly pinned objects +// * "recursive" - roots of recursive pins +// * "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// * "all" - all pinned objects (default) +func (pinIsPinnedOpts) pinType(t string) PinIsPinnedOption { + return func(settings *PinIsPinnedSettings) error { + settings.WithType = t + return nil + } } // Recursive is an option for Pin.Add which specifies whether to pin an entire @@ -137,22 +263,6 @@ func (pinOpts) RmRecursive(recursive bool) PinRmOption { } } -// Type is an option for Pin.Ls which allows to specify which pin types should -// be returned -// -// Supported values: -// * "direct" - directly pinned objects -// * "recursive" - roots of recursive pins -// * "indirect" - indirectly pinned objects (referenced by recursively pinned -// objects) -// * "all" - all pinned objects (default) -func (pinOpts) pinType(t string) PinLsOption { - return func(settings *PinLsSettings) error { - settings.Type = t - return nil - } -} - // Unpin is an option for Pin.Update which specifies whether to remove the old pin. // Default is true. func (pinOpts) Unpin(unpin bool) PinUpdateOption { diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 27f9355d39a..4c1788c682a 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -46,6 +46,10 @@ type PinAPI interface { // Ls returns list of pinned objects on this node Ls(context.Context, ...options.PinLsOption) (<-chan Pin, error) + // IsPinned returns whether or not the given cid is pinned + // and an explanation of why its pinned + IsPinned(context.Context, path.Path, ...options.PinIsPinnedOption) (string, bool, error) + // Rm removes pin for object specified by the path Rm(context.Context, path.Path, ...options.PinRmOption) error diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 58e8120842e..e16d6460bd3 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -28,6 +28,7 @@ func (tp *TestSuite) TestPin(t *testing.T) { t.Run("TestPinRecursive", tp.TestPinRecursive) t.Run("TestPinLsIndirect", tp.TestPinLsIndirect) t.Run("TestPinLsPrecedence", tp.TestPinLsPrecedence) + t.Run("TestPinIsPinned", tp.TestPinIsPinned) } func (tp *TestSuite) TestPinAdd(t *testing.T) { @@ -84,6 +85,8 @@ func (tp *TestSuite) TestPinSimple(t *testing.T) { t.Error("unexpected pin type") } + assertIsPinned(t, ctx, api, p, "recursive") + err = api.Pin().Rm(ctx, p) if err != nil { t.Fatal(err) @@ -150,7 +153,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Direct())) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Ls.Direct())) if err != nil { t.Fatal(err) } @@ -163,7 +166,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpfsPath(nd3.Cid()).String()) } - list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Recursive())) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Ls.Recursive())) if err != nil { t.Fatal(err) } @@ -176,7 +179,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpldPath(nd2.Cid()).String()) } - list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Indirect())) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Ls.Indirect())) if err != nil { t.Fatal(err) } @@ -360,6 +363,39 @@ func (tp *TestSuite) TestPinLsPrecedenceRecursiveDirect(t *testing.T) { assertPinTypes(t, ctx, api, []cidContainer{grandparent, parent}, []cidContainer{}, []cidContainer{leaf}) } +func (tp *TestSuite) TestPinIsPinned(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "foofoo") + + assertNotPinned(t, ctx, api, path.IpldPath(grandparent.Cid())) + assertNotPinned(t, ctx, api, path.IpldPath(parent.Cid())) + assertNotPinned(t, ctx, api, path.IpldPath(leaf.Cid())) + + err = api.Pin().Add(ctx, path.IpldPath(parent.Cid()), opt.Pin.Recursive(true)) + if err != nil { + t.Fatal(err) + } + + assertNotPinned(t, ctx, api, path.IpldPath(grandparent.Cid())) + assertIsPinned(t, ctx, api, path.IpldPath(parent.Cid()), "recursive") + assertIsPinned(t, ctx, api, path.IpldPath(leaf.Cid()), "indirect") + + err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid()), opt.Pin.Recursive(false)) + if err != nil { + t.Fatal(err) + } + + assertIsPinned(t, ctx, api, path.IpldPath(grandparent.Cid()), "direct") + assertIsPinned(t, ctx, api, path.IpldPath(parent.Cid()), "recursive") + assertIsPinned(t, ctx, api, path.IpldPath(leaf.Cid()), "indirect") +} + type cidContainer interface { Cid() cid.Cid } @@ -390,21 +426,21 @@ func getThreeChainedNodes(t *testing.T, ctx context.Context, api iface.CoreAPI, func assertPinTypes(t *testing.T, ctx context.Context, api iface.CoreAPI, recusive, direct, indirect []cidContainer) { assertPinLsAllConsistency(t, ctx, api) - list, err := accPins(api.Pin().Ls(ctx, opt.Pin.Type.Recursive())) + list, err := accPins(api.Pin().Ls(ctx, opt.Pin.Ls.Recursive())) if err != nil { t.Fatal(err) } assertPinCids(t, list, recusive...) - list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Direct())) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Ls.Direct())) if err != nil { t.Fatal(err) } assertPinCids(t, list, direct...) - list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Type.Indirect())) + list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Ls.Indirect())) if err != nil { t.Fatal(err) } @@ -466,9 +502,9 @@ func assertPinLsAllConsistency(t *testing.T, ctx context.Context, api iface.Core all, recursive, direct, indirect := cid.NewSet(), cid.NewSet(), cid.NewSet(), cid.NewSet() typeMap := map[string]*pinTypeProps{ - "recursive": {recursive, opt.Pin.Type.Recursive()}, - "direct": {direct, opt.Pin.Type.Direct()}, - "indirect": {indirect, opt.Pin.Type.Indirect()}, + "recursive": {recursive, opt.Pin.Ls.Recursive()}, + "direct": {direct, opt.Pin.Ls.Direct()}, + "indirect": {indirect, opt.Pin.Ls.Indirect()}, } for _, p := range allPins { @@ -506,6 +542,47 @@ func assertPinLsAllConsistency(t *testing.T, ctx context.Context, api iface.Core } } +func assertIsPinned(t *testing.T, ctx context.Context, api iface.CoreAPI, p path.Path, typeStr string) { + t.Helper() + withType, err := opt.Pin.IsPinned.Type(typeStr) + if err != nil { + panic("unhandled pin type") + } + + whyPinned, pinned, err := api.Pin().IsPinned(ctx, p, withType) + if err != nil { + t.Fatal(err) + } + + if !pinned { + t.Fatalf("%s expected to be pinned with type %s", p, typeStr) + } + + switch typeStr { + case "recursive", "direct": + if typeStr != whyPinned { + t.Fatalf("reason for pinning expected to be %s for %s, got %s", typeStr, p, whyPinned) + } + case "indirect": + if whyPinned == "" { + t.Fatalf("expected to have a pin reason for %s", p) + } + } +} + +func assertNotPinned(t *testing.T, ctx context.Context, api iface.CoreAPI, p path.Path) { + t.Helper() + + _, pinned, err := api.Pin().IsPinned(ctx, p) + if err != nil { + t.Fatal(err) + } + + if pinned { + t.Fatalf("%s expected to not be pinned", p) + } +} + func accPins(pins <-chan iface.Pin, err error) ([]iface.Pin, error) { if err != nil { return nil, err From 7f07bf09966647107c25bbe8e60be1803c7496fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Mon, 30 Mar 2020 16:20:15 +0200 Subject: [PATCH 231/286] pin: better doc, small cleaning This commit was moved from ipfs/interface-go-ipfs-core@478caf05ab8fd3b33ae80f8792be2cb7c7a92b45 This commit was moved from ipfs/boxo@bffa011f0a0f01646bcecbc003552941ca31860b --- core/coreiface/options/pin.go | 32 +++++++++++++++++++++----------- core/coreiface/tests/pin.go | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index 231f0d11a85..5014a2d2b17 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -2,46 +2,48 @@ package options import "fmt" +// PinAddSettings represent the settings for PinAPI.Add type PinAddSettings struct { Recursive bool } -type TypeSettings struct { - Type string -} - +// PinLsSettings represent the settings for PinAPI.Ls type PinLsSettings struct { Type string } +// PinIsPinnedSettings represent the settings for PinAPI.IsPinned type PinIsPinnedSettings struct { WithType string } -// PinRmSettings represents the settings of pin rm command +// PinRmSettings represents the settings for PinAPI.Rm type PinRmSettings struct { Recursive bool } +// PinUpdateSettings represent the settings for PinAPI.Update type PinUpdateSettings struct { Unpin bool } -// PinAddOption pin add option func +// PinAddOption is the signature of an option for PinAPI.Add type PinAddOption func(*PinAddSettings) error -// PinLsOption pin ls option func +// PinLsOption is the signature of an option for PinAPI.Ls type PinLsOption func(*PinLsSettings) error -// PinIsPinnedOption pin isPinned option func +// PinIsPinnedOption is the signature of an option for PinAPI.IsPinned type PinIsPinnedOption func(*PinIsPinnedSettings) error -// PinRmOption pin rm option func +// PinRmOption is the signature of an option for PinAPI.Rm type PinRmOption func(*PinRmSettings) error -// PinUpdateOption pin update option func +// PinUpdateOption is the signature of an option for PinAPI.Update type PinUpdateOption func(*PinUpdateSettings) error +// PinAddOptions compile a series of PinAddOption into a ready to use +// PinAddSettings and set the default values. func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { options := &PinAddSettings{ Recursive: true, @@ -57,6 +59,8 @@ func PinAddOptions(opts ...PinAddOption) (*PinAddSettings, error) { return options, nil } +// PinLsOptions compile a series of PinLsOption into a ready to use +// PinLsSettings and set the default values. func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { options := &PinLsSettings{ Type: "all", @@ -72,6 +76,8 @@ func PinLsOptions(opts ...PinLsOption) (*PinLsSettings, error) { return options, nil } +// PinIsPinnedOptions compile a series of PinIsPinnedOption into a ready to use +// PinIsPinnedSettings and set the default values. func PinIsPinnedOptions(opts ...PinIsPinnedOption) (*PinIsPinnedSettings, error) { options := &PinIsPinnedSettings{ WithType: "all", @@ -87,7 +93,8 @@ func PinIsPinnedOptions(opts ...PinIsPinnedOption) (*PinIsPinnedSettings, error) return options, nil } -// PinRmOptions pin rm options +// PinRmOptions compile a series of PinRmOption into a ready to use +// PinRmSettings and set the default values. func PinRmOptions(opts ...PinRmOption) (*PinRmSettings, error) { options := &PinRmSettings{ Recursive: true, @@ -102,6 +109,8 @@ func PinRmOptions(opts ...PinRmOption) (*PinRmSettings, error) { return options, nil } +// PinUpdateOptions compile a series of PinUpdateOption into a ready to use +// PinUpdateSettings and set the default values. func PinUpdateOptions(opts ...PinUpdateOption) (*PinUpdateSettings, error) { options := &PinUpdateSettings{ Unpin: true, @@ -122,6 +131,7 @@ type pinOpts struct { IsPinned pinIsPinnedOpts } +// Pin provide an access to all the options for the Pin API. var Pin pinOpts type pinLsOpts struct{} diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index e16d6460bd3..476bbea6be4 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -546,7 +546,7 @@ func assertIsPinned(t *testing.T, ctx context.Context, api iface.CoreAPI, p path t.Helper() withType, err := opt.Pin.IsPinned.Type(typeStr) if err != nil { - panic("unhandled pin type") + t.Fatal("unhandled pin type") } whyPinned, pinned, err := api.Pin().IsPinned(ctx, p, withType) From 3a48c527193cc7688f488da875bb065459a12809 Mon Sep 17 00:00:00 2001 From: Will Scott Date: Tue, 21 Apr 2020 08:40:13 -0700 Subject: [PATCH 232/286] extra time for dht spin-up This commit was moved from ipfs/interface-go-ipfs-core@9160e645322d5779c687e0e60cbec5a5932d5c27 This commit was moved from ipfs/boxo@0ed0b6f39d3ab3b20bd6dd2232de03a9513b139c --- core/coreiface/tests/dht.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 33b4ff14c79..a957d66d71c 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -4,8 +4,9 @@ import ( "context" "io" "testing" + "time" - "github.com/ipfs/interface-go-ipfs-core" + iface "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/options" ) @@ -43,6 +44,8 @@ func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { t.Fatal("unexpected number of local addrs") } + time.Sleep(3 * time.Second) + pi, err := apis[2].Dht().FindPeer(ctx, self0.ID()) if err != nil { t.Fatal(err) @@ -88,6 +91,8 @@ func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { t.Fatal(err) } + time.Sleep(3 * time.Second) + out, err := apis[2].Dht().FindProviders(ctx, p, options.Dht.NumProviders(1)) if err != nil { t.Fatal(err) @@ -125,6 +130,8 @@ func (tp *TestSuite) TestDhtProvide(t *testing.T) { p := s.Path() + time.Sleep(3 * time.Second) + out, err := apis[2].Dht().FindProviders(ctx, p, options.Dht.NumProviders(1)) if err != nil { t.Fatal(err) From 2517d0b9d49911add8b923a48030e4f7cbf0a0b9 Mon Sep 17 00:00:00 2001 From: Petar Maymounkov Date: Wed, 22 Jul 2020 09:05:14 -0700 Subject: [PATCH 233/286] add id and key formatting utils; format keys as b36cid by default; update tests This commit was moved from ipfs/interface-go-ipfs-core@c604c5b0338c075046d7ddf0b60c5927500607d3 This commit was moved from ipfs/boxo@7bcd64373825dfda1ef91c9d9157a5328928cc09 --- core/coreiface/idfmt.go | 19 ++++++++++++++ core/coreiface/tests/key.go | 49 +++++++++++++++++++++++------------- core/coreiface/tests/name.go | 30 +++++++++++----------- 3 files changed, 66 insertions(+), 32 deletions(-) create mode 100644 core/coreiface/idfmt.go diff --git a/core/coreiface/idfmt.go b/core/coreiface/idfmt.go new file mode 100644 index 00000000000..1ba79e6023d --- /dev/null +++ b/core/coreiface/idfmt.go @@ -0,0 +1,19 @@ +package iface + +import ( + peer "github.com/libp2p/go-libp2p-core/peer" + mbase "github.com/multiformats/go-multibase" +) + +func FormatKeyID(id peer.ID) string { + if s, err := peer.ToCid(id).StringOfBase(mbase.Base36); err != nil { + panic(err) + } else { + return s + } +} + +// FormatKey formats the given IPNS key in a canonical way. +func FormatKey(key Key) string { + return FormatKeyID(key.ID()) +} diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index 265a8f06082..c3cd8626fa7 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -5,8 +5,11 @@ import ( "strings" "testing" - "github.com/ipfs/interface-go-ipfs-core" + cid "github.com/ipfs/go-cid" + coreiface "github.com/ipfs/interface-go-ipfs-core" + iface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" + mbase "github.com/multiformats/go-multibase" ) func (tp *TestSuite) TestKey(t *testing.T) { @@ -64,8 +67,8 @@ func (tp *TestSuite) TestListSelf(t *testing.T) { t.Errorf("expected the key to be called 'self', got '%s'", keys[0].Name()) } - if keys[0].Path().String() != "/ipns/"+self.ID().Pretty() { - t.Errorf("expected the key to have path '/ipns/%s', got '%s'", self.ID().Pretty(), keys[0].Path().String()) + if keys[0].Path().String() != "/ipns/"+coreiface.FormatKeyID(self.ID()) { + t.Errorf("expected the key to have path '/ipns/%s', got '%s'", coreiface.FormatKeyID(self.ID()), keys[0].Path().String()) } } @@ -134,9 +137,30 @@ func (tp *TestSuite) TestGenerate(t *testing.T) { t.Errorf("expected the key to be called 'foo', got '%s'", k.Name()) } - if !strings.HasPrefix(k.Path().String(), "/ipns/Qm") { - t.Errorf("expected the key to be prefixed with '/ipns/Qm', got '%s'", k.Path().String()) + verifyIPNSPath(t, k.Path().String()) +} + +func verifyIPNSPath(t *testing.T, p string) bool { + t.Helper() + if !strings.HasPrefix(p, "/ipns/") { + t.Errorf("path %q does not look like an IPNS path", p) + return false + } + k := p[len("/ipns/"):] + c, err := cid.Decode(k) + if err != nil { + t.Errorf("failed to decode IPNS key %q (%v)", k, err) + return false + } + b36, err := c.StringOfBase(mbase.Base36) + if err != nil { + t.Fatalf("cid cannot format itself in b36") + return false + } + if b36 != k { + t.Errorf("IPNS key is not base36") } + return true } func (tp *TestSuite) TestGenerateSize(t *testing.T) { @@ -157,9 +181,7 @@ func (tp *TestSuite) TestGenerateSize(t *testing.T) { t.Errorf("expected the key to be called 'foo', got '%s'", k.Name()) } - if !strings.HasPrefix(k.Path().String(), "/ipns/Qm") { - t.Errorf("expected the key to be prefixed with '/ipns/Qm', got '%s'", k.Path().String()) - } + verifyIPNSPath(t, k.Path().String()) } func (tp *TestSuite) TestGenerateType(t *testing.T) { @@ -256,15 +278,8 @@ func (tp *TestSuite) TestList(t *testing.T) { return } - if !strings.HasPrefix(l[0].Path().String(), "/ipns/Qm") { - t.Fatalf("expected key 0 to be prefixed with '/ipns/Qm', got '%s'", l[0].Name()) - return - } - - if !strings.HasPrefix(l[1].Path().String(), "/ipns/Qm") { - t.Fatalf("expected key 1 to be prefixed with '/ipns/Qm', got '%s'", l[1].Name()) - return - } + verifyIPNSPath(t, l[0].Path().String()) + verifyIPNSPath(t, l[1].Path().String()) } func (tp *TestSuite) TestRename(t *testing.T) { diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 31a5c14663f..021c1bb975a 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -2,15 +2,15 @@ package tests import ( "context" - path "github.com/ipfs/interface-go-ipfs-core/path" "io" "math/rand" gopath "path" "testing" "time" - "github.com/ipfs/go-ipfs-files" - ipath "github.com/ipfs/go-path" + path "github.com/ipfs/interface-go-ipfs-core/path" + + files "github.com/ipfs/go-ipfs-files" coreiface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" @@ -70,8 +70,8 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { t.Fatal(err) } - if e.Name() != self.ID().Pretty() { - t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + if e.Name() != coreiface.FormatKeyID(self.ID()) { + t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) } if e.Value().String() != p.String() { @@ -100,8 +100,8 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { t.Fatal(err) } - if e.Name() != self.ID().Pretty() { - t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + if e.Name() != coreiface.FormatKeyID(self.ID()) { + t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) } if e.Value().String() != p.String()+"/test" { @@ -130,8 +130,8 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { t.Fatal(err) } - if e.Name() != self.ID().Pretty() { - t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + if e.Name() != coreiface.FormatKeyID(self.ID()) { + t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) } if e.Value().String() != p.String() { @@ -160,8 +160,8 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { t.Fatal(err) } - if e.Name() != self.ID().Pretty() { - t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + if e.Name() != coreiface.FormatKeyID(self.ID()) { + t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) } if e.Value().String() != p.String()+"/a" { @@ -212,8 +212,8 @@ func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) { t.Fatal(err) } - if ipath.Join([]string{"/ipns", e.Name()}) != k.Path().String() { - t.Errorf("expected e.Name to equal '%s', got '%s'", e.Name(), k.Path().String()) + if e.Name() != coreiface.FormatKey(k) { + t.Errorf("expected e.Name to equal %s, got '%s'", e.Name(), coreiface.FormatKey(k)) } if e.Value().String() != p.String() { @@ -255,8 +255,8 @@ func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { t.Fatal(err) } - if e.Name() != self.ID().Pretty() { - t.Errorf("expected e.Name to equal '%s', got '%s'", self.ID().Pretty(), e.Name()) + if e.Name() != coreiface.FormatKeyID(self.ID()) { + t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) } if e.Value().String() != p.String() { From fb0a7edf12a24be1b80fc5a487c183e70048062a Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 2 Jun 2021 09:11:14 -0700 Subject: [PATCH 234/286] fix staticcheck This commit was moved from ipfs/interface-go-ipfs-core@08bd316e61238880f341d7061c518c2a62830bd9 This commit was moved from ipfs/boxo@5df09f84256c8b490f356c161c96b49d3a46bfd0 --- core/coreiface/tests/api.go | 2 +- core/coreiface/tests/block.go | 2 +- core/coreiface/tests/dag.go | 2 +- core/coreiface/tests/dht.go | 2 +- core/coreiface/tests/key.go | 12 ++++++------ core/coreiface/tests/name.go | 2 +- core/coreiface/tests/object.go | 2 +- core/coreiface/tests/pin.go | 2 +- core/coreiface/tests/pubsub.go | 2 +- core/coreiface/tests/unixfs.go | 5 ++--- 10 files changed, 16 insertions(+), 17 deletions(-) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index 1af3a83b37e..0801b3ca7f0 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -9,7 +9,7 @@ import ( coreiface "github.com/ipfs/interface-go-ipfs-core" ) -var apiNotImplemented = errors.New("api not implemented") +var errAPINotImplemented = errors.New("api not implemented") func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { api, err := tp.MakeAPISwarm(ctx, false, 1) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 1f725254752..7dbfa4df040 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -32,7 +32,7 @@ func cborBlock() io.Reader { func (tp *TestSuite) TestBlock(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Block() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 2f68bbf05eb..6f9d9659e18 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -18,7 +18,7 @@ import ( func (tp *TestSuite) TestDag(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Dag() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index a957d66d71c..c2e6d690fcd 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -13,7 +13,7 @@ import ( func (tp *TestSuite) TestDht(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Dht() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index c3cd8626fa7..47f278f9727 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -5,8 +5,7 @@ import ( "strings" "testing" - cid "github.com/ipfs/go-cid" - coreiface "github.com/ipfs/interface-go-ipfs-core" + "github.com/ipfs/go-cid" iface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" mbase "github.com/multiformats/go-multibase" @@ -15,7 +14,7 @@ import ( func (tp *TestSuite) TestKey(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Key() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) @@ -67,8 +66,8 @@ func (tp *TestSuite) TestListSelf(t *testing.T) { t.Errorf("expected the key to be called 'self', got '%s'", keys[0].Name()) } - if keys[0].Path().String() != "/ipns/"+coreiface.FormatKeyID(self.ID()) { - t.Errorf("expected the key to have path '/ipns/%s', got '%s'", coreiface.FormatKeyID(self.ID()), keys[0].Path().String()) + if keys[0].Path().String() != "/ipns/"+iface.FormatKeyID(self.ID()) { + t.Errorf("expected the key to have path '/ipns/%s', got '%s'", iface.FormatKeyID(self.ID()), keys[0].Path().String()) } } @@ -185,9 +184,10 @@ func (tp *TestSuite) TestGenerateSize(t *testing.T) { } func (tp *TestSuite) TestGenerateType(t *testing.T) { + t.Skip("disabled until libp2p/specs#111 is fixed") + ctx, cancel := context.WithCancel(context.Background()) defer cancel() - t.Skip("disabled until libp2p/specs#111 is fixed") api, err := tp.makeAPI(ctx) if err != nil { diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 021c1bb975a..2a8b4d76afb 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -19,7 +19,7 @@ import ( func (tp *TestSuite) TestName(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Name() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 2e066ca71b2..e8ab1a7f4b9 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -15,7 +15,7 @@ import ( func (tp *TestSuite) TestObject(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Object() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 476bbea6be4..d378d1015c6 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -18,7 +18,7 @@ import ( func (tp *TestSuite) TestPin(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.Pin() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index 36353f83609..f8339f22834 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -12,7 +12,7 @@ import ( func (tp *TestSuite) TestPubSub(t *testing.T) { tp.hasApi(t, func(api iface.CoreAPI) error { if api.PubSub() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 1ed80e8733e..4273386aaaa 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -31,7 +31,7 @@ import ( func (tp *TestSuite) TestUnixfs(t *testing.T) { tp.hasApi(t, func(api coreiface.CoreAPI) error { if api.Unixfs() == nil { - return apiNotImplemented + return errAPINotImplemented } return nil }) @@ -1035,8 +1035,7 @@ func (tp *TestSuite) TestGetReadAt(t *testing.T) { origR := bytes.NewReader(orig) - r, err = api.Unixfs().Get(ctx, p) - if err != nil { + if _, err := api.Unixfs().Get(ctx, p); err != nil { t.Fatal(err) } From 58c9824ce49e83378d63d6c3a1aa9ed2f2417a5b Mon Sep 17 00:00:00 2001 From: Hannah Howard Date: Thu, 12 Aug 2021 09:35:49 -0700 Subject: [PATCH 235/286] IPLD In IPFS: Target Merge Branch (#67) * update go-path and error message * add node api for prime interactions * use go-unixfsnode * update against fetcher Co-authored-by: acruikshank This commit was moved from ipfs/interface-go-ipfs-core@49cdff8024e607072e57a7f7556e9875d2aa0412 This commit was moved from ipfs/boxo@8f0db8f18428127afb5e6c114ada8c751d5116de --- core/coreiface/coreapi.go | 1 + core/coreiface/tests/path.go | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 12cb166a884..aacda045937 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -4,6 +4,7 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 2d9497244c9..5a249fabfda 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -2,11 +2,14 @@ package tests import ( "context" - "github.com/ipfs/interface-go-ipfs-core/path" + "errors" "math" "strings" "testing" + "github.com/ipfs/go-path/resolver" + "github.com/ipfs/interface-go-ipfs-core/path" + "github.com/ipfs/interface-go-ipfs-core/options" ipldcbor "github.com/ipfs/go-ipld-cbor" @@ -138,7 +141,7 @@ func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) { } _, err = api.ResolvePath(ctx, path.New("/ipld/"+nd.Cid().String()+"/bar/baz")) - if err == nil || !strings.Contains(err.Error(), "no such link found") { + if err == nil || !errors.As(err, &resolver.ErrNoLink{}) { t.Fatalf("unexpected error: %s", err) } } From f909368aa097438d3ae19dc4c8f3b0512b79e540 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 17 Aug 2021 13:10:26 -0700 Subject: [PATCH 236/286] fix: check errors by string Unfortunately, we return errors over the HTTP API and lose the type. This commit was moved from ipfs/interface-go-ipfs-core@98e72571bc4514239cbe7bba4321ab5da4194366 This commit was moved from ipfs/boxo@b722930c08cda76a887769564a94055f41268c38 --- core/coreiface/tests/path.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 5a249fabfda..f6d05372e83 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -2,12 +2,10 @@ package tests import ( "context" - "errors" "math" "strings" "testing" - "github.com/ipfs/go-path/resolver" "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" @@ -141,7 +139,7 @@ func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) { } _, err = api.ResolvePath(ctx, path.New("/ipld/"+nd.Cid().String()+"/bar/baz")) - if err == nil || !errors.As(err, &resolver.ErrNoLink{}) { + if err == nil || !strings.Contains(err.Error(), `no link named "bar"`) { t.Fatalf("unexpected error: %s", err) } } From 49e2b34be58f7132851388652ec1da250bf13c20 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 2 Mar 2022 16:44:11 +0100 Subject: [PATCH 237/286] Update tests to use ipld.IsNotFound to check for notfound errors This commit was moved from ipfs/interface-go-ipfs-core@01ee9419a28353cab04979f0791133df9869f30a This commit was moved from ipfs/boxo@2263eca4a44789edb3c0d244c961c12bcb1585ad --- core/coreiface/tests/block.go | 5 +++-- core/coreiface/tests/unixfs.go | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 7dbfa4df040..8d0243e7ee1 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + ipld "github.com/ipfs/go-ipld-format" coreiface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" "github.com/ipfs/interface-go-ipfs-core/path" @@ -179,7 +180,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) { if err == nil { t.Fatal("expected err to exist") } - if !strings.Contains(err.Error(), "blockservice: key not found") { + if !ipld.IsNotFound(err) { t.Errorf("unexpected error; %s", err.Error()) } @@ -187,7 +188,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) { if err == nil { t.Fatal("expected err to exist") } - if !strings.Contains(err.Error(), "blockstore: block not found") { + if !strings.Contains(err.Error(), "not found") { t.Errorf("unexpected error; %s", err.Error()) } diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 4273386aaaa..f47d34d0a50 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -5,7 +5,6 @@ import ( "context" "encoding/hex" "fmt" - "github.com/ipfs/interface-go-ipfs-core/path" "io" "io/ioutil" "math" @@ -16,12 +15,15 @@ import ( "sync" "testing" + "github.com/ipfs/interface-go-ipfs-core/path" + coreiface "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/options" "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipfs-files" + files "github.com/ipfs/go-ipfs-files" cbor "github.com/ipfs/go-ipld-cbor" + ipld "github.com/ipfs/go-ipld-format" mdag "github.com/ipfs/go-merkledag" "github.com/ipfs/go-unixfs" "github.com/ipfs/go-unixfs/importer/helpers" @@ -576,7 +578,7 @@ func (tp *TestSuite) TestAddHashOnly(t *testing.T) { if err == nil { t.Fatal("expected an error") } - if !strings.Contains(err.Error(), "blockservice: key not found") { + if !ipld.IsNotFound(err) { t.Errorf("unxepected error: %s", err.Error()) } } From 29d037909ba8e25f5a62b240ac2b09c1d6591b03 Mon Sep 17 00:00:00 2001 From: godcong Date: Fri, 25 Mar 2022 22:32:10 +0800 Subject: [PATCH 238/286] fix: document error (#74) This commit was moved from ipfs/interface-go-ipfs-core@e9a299166898903a08f98e766aa23f452170496a This commit was moved from ipfs/boxo@f9d0ad972ce79a1fca890370606d585cf49416fe --- core/coreiface/coreapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index aacda045937..894ffb31876 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -32,7 +32,7 @@ type CoreAPI interface { // Pin returns an implementation of Pin API Pin() PinAPI - // ObjectAPI returns an implementation of Object API + // Object returns an implementation of Object API Object() ObjectAPI // Dht returns an implementation of Dht API From 9120e3f1f96ec178225cabaac3aba45942f93895 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 31 Mar 2022 23:55:17 +0200 Subject: [PATCH 239/286] fix: use IPLD.ErrNotFound instead of string comparison in tests This commit was moved from ipfs/interface-go-ipfs-core@03f4e9cca18f0882ae13f718d4b3e18ef1f361ca This commit was moved from ipfs/boxo@548e3d4298370c022c6e79dbe5614d8c80ea90b9 --- core/coreiface/tests/block.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 8d0243e7ee1..87fa90b6504 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -188,7 +188,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) { if err == nil { t.Fatal("expected err to exist") } - if !strings.Contains(err.Error(), "not found") { + if !ipld.IsNotFound(err) { t.Errorf("unexpected error; %s", err.Error()) } From caa42b563414150604234fbe9b7588b240187aaa Mon Sep 17 00:00:00 2001 From: Lucas Molas Date: Thu, 21 Apr 2022 12:41:58 -0300 Subject: [PATCH 240/286] refactor(block): CIDv1 and BlockPutSettings CidPrefix (#80) * feat(block options): add store codec * refactor: BlockPutSettings.CidPrefix Removes duplicated fields and replaces them with cid.Prefix Codec, MhType and MhLength were already in prefix, and we already return prefix. A lot of duplicated values and code responsible for syncing them did not really need to exist. * test: CIDv1 raw and dag-pb cases * chore: release 0.7.0 Co-authored-by: Marcin Rataj This commit was moved from ipfs/interface-go-ipfs-core@a3374d99028d96a1ef262b81acb385690eb36f97 This commit was moved from ipfs/boxo@aca3a1839f42a590b5fa7ce30e743232c9336023 --- core/coreiface/options/block.go | 134 ++++++++++++++++++++------------ core/coreiface/tests/block.go | 103 ++++++++++++++++++++++-- 2 files changed, 181 insertions(+), 56 deletions(-) diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 043dfdea462..130648682f9 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -2,15 +2,15 @@ package options import ( "fmt" + cid "github.com/ipfs/go-cid" + mc "github.com/multiformats/go-multicodec" mh "github.com/multiformats/go-multihash" ) type BlockPutSettings struct { - Codec string - MhType uint64 - MhLength int - Pin bool + CidPrefix cid.Prefix + Pin bool } type BlockRmSettings struct { @@ -20,53 +20,29 @@ type BlockRmSettings struct { type BlockPutOption func(*BlockPutSettings) error type BlockRmOption func(*BlockRmSettings) error -func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, cid.Prefix, error) { +func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, error) { + var cidPrefix cid.Prefix + + // Baseline is CIDv1 raw sha2-255-32 (can be tweaked later via opts) + cidPrefix.Version = 1 + cidPrefix.Codec = uint64(mc.Raw) + cidPrefix.MhType = mh.SHA2_256 + cidPrefix.MhLength = -1 // -1 means len is to be calculated during mh.Sum() + options := &BlockPutSettings{ - Codec: "", - MhType: mh.SHA2_256, - MhLength: -1, - Pin: false, + CidPrefix: cidPrefix, + Pin: false, } + // Apply any overrides for _, opt := range opts { err := opt(options) if err != nil { - return nil, cid.Prefix{}, err - } - } - - var pref cid.Prefix - pref.Version = 1 - - if options.Codec == "" { - if options.MhType != mh.SHA2_256 || (options.MhLength != -1 && options.MhLength != 32) { - options.Codec = "protobuf" - } else { - options.Codec = "v0" - } - } - - if options.Codec == "v0" && options.MhType == mh.SHA2_256 { - pref.Version = 0 - } - - formatval, ok := cid.Codecs[options.Codec] - if !ok { - return nil, cid.Prefix{}, fmt.Errorf("unrecognized format: %s", options.Codec) - } - - if options.Codec == "v0" { - if options.MhType != mh.SHA2_256 || (options.MhLength != -1 && options.MhLength != 32) { - return nil, cid.Prefix{}, fmt.Errorf("only sha2-255-32 is allowed with CIDv0") + return nil, err } } - pref.Codec = formatval - - pref.MhType = options.MhType - pref.MhLength = options.MhLength - - return options, pref, nil + return options, nil } func BlockRmOptions(opts ...BlockRmOption) (*BlockRmSettings, error) { @@ -87,13 +63,75 @@ type blockOpts struct{} var Block blockOpts -// Format is an option for Block.Put which specifies the multicodec to use to -// serialize the object. Default is "v0" -func (blockOpts) Format(codec string) BlockPutOption { +// CidCodec is the modern option for Block.Put which specifies the multicodec to use +// in the CID returned by the Block.Put operation. +// It uses correct codes from go-multicodec and replaces the old Format now with CIDv1 as the default. +func (blockOpts) CidCodec(codecName string) BlockPutOption { + return func(settings *BlockPutSettings) error { + if codecName == "" { + return nil + } + code, err := codeFromName(codecName) + if err != nil { + return err + } + settings.CidPrefix.Codec = uint64(code) + return nil + } +} + +// Map string to code from go-multicodec +func codeFromName(codecName string) (mc.Code, error) { + var cidCodec mc.Code + err := cidCodec.Set(codecName) + return cidCodec, err +} + +// Format is a legacy option for Block.Put which specifies the multicodec to +// use to serialize the object. +// Provided for backward-compatibility only. Use CidCodec instead. +func (blockOpts) Format(format string) BlockPutOption { return func(settings *BlockPutSettings) error { - settings.Codec = codec + if format == "" { + return nil + } + // Opt-in CIDv0 support for backward-compatibility + if format == "v0" { + settings.CidPrefix.Version = 0 + } + + // Fixup a legacy (invalid) names for dag-pb (0x70) + if format == "v0" || format == "protobuf" { + format = "dag-pb" + } + + // Fixup invalid name for dag-cbor (0x71) + if format == "cbor" { + format = "dag-cbor" + } + + // Set code based on name passed as "format" + code, err := codeFromName(format) + if err != nil { + return err + } + settings.CidPrefix.Codec = uint64(code) + + // If CIDv0, ensure all parameters are compatible + // (in theory go-cid would validate this anyway, but we want to provide better errors) + pref := settings.CidPrefix + if pref.Version == 0 { + if pref.Codec != uint64(mc.DagPb) { + return fmt.Errorf("only dag-pb is allowed with CIDv0") + } + if pref.MhType != mh.SHA2_256 || (pref.MhLength != -1 && pref.MhLength != 32) { + return fmt.Errorf("only sha2-255-32 is allowed with CIDv0") + } + } + return nil } + } // Hash is an option for Block.Put which specifies the multihash settings to use @@ -101,8 +139,8 @@ func (blockOpts) Format(codec string) BlockPutOption { // If mhLen is set to -1, default length for the hash will be used func (blockOpts) Hash(mhType uint64, mhLen int) BlockPutOption { return func(settings *BlockPutSettings) error { - settings.MhType = mhType - settings.MhLength = mhLen + settings.CidPrefix.MhType = mhType + settings.CidPrefix.MhLength = mhLen return nil } } diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 87fa90b6504..916e52dd3a4 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -17,15 +17,19 @@ import ( ) var ( - pbCid = "QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN" - cborCid = "bafyreicnga62zhxnmnlt6ymq5hcbsg7gdhqdu6z4ehu3wpjhvqnflfy6nm" - cborKCid = "bafyr2qgsohbwdlk7ajmmbb4lhoytmest4wdbe5xnexfvtxeatuyqqmwv3fgxp3pmhpc27gwey2cct56gloqefoqwcf3yqiqzsaqb7p4jefhcw" + pbCidV0 = "QmZULkCELmmk5XNfCgTnCyFgAVxBRBXyDHGGMVoLFLiXEN" // dag-pb + pbCid = "bafybeiffndsajwhk3lwjewwdxqntmjm4b5wxaaanokonsggenkbw6slwk4" // dag-pb + rawCid = "bafkreiffndsajwhk3lwjewwdxqntmjm4b5wxaaanokonsggenkbw6slwk4" // raw bytes + cborCid = "bafyreicnga62zhxnmnlt6ymq5hcbsg7gdhqdu6z4ehu3wpjhvqnflfy6nm" // dag-cbor + cborKCid = "bafyr2qgsohbwdlk7ajmmbb4lhoytmest4wdbe5xnexfvtxeatuyqqmwv3fgxp3pmhpc27gwey2cct56gloqefoqwcf3yqiqzsaqb7p4jefhcw" // dag-cbor keccak-512 ) +// dag-pb func pbBlock() io.Reader { return bytes.NewReader([]byte{10, 12, 8, 2, 18, 6, 104, 101, 108, 108, 111, 10, 24, 6}) } +// dag-cbor func cborBlock() io.Reader { return bytes.NewReader([]byte{101, 72, 101, 108, 108, 111}) } @@ -38,8 +42,12 @@ func (tp *TestSuite) TestBlock(t *testing.T) { return nil }) - t.Run("TestBlockPut", tp.TestBlockPut) - t.Run("TestBlockPutFormat", tp.TestBlockPutFormat) + t.Run("TestBlockPut (get raw CIDv1)", tp.TestBlockPut) + t.Run("TestBlockPutCidCodec: dag-pb", tp.TestBlockPutCidCodecDagPb) + t.Run("TestBlockPutCidCodec: dag-cbor", tp.TestBlockPutCidCodecDagCbor) + t.Run("TestBlockPutFormat (legacy): cbor → dag-cbor", tp.TestBlockPutFormatDagCbor) + t.Run("TestBlockPutFormat (legacy): protobuf → dag-pb", tp.TestBlockPutFormatDagPb) + t.Run("TestBlockPutFormat (legacy): v0 → CIDv0", tp.TestBlockPutFormatV0) t.Run("TestBlockPutHash", tp.TestBlockPutHash) t.Run("TestBlockGet", tp.TestBlockGet) t.Run("TestBlockRm", tp.TestBlockRm) @@ -47,6 +55,7 @@ func (tp *TestSuite) TestBlock(t *testing.T) { t.Run("TestBlockPin", tp.TestBlockPin) } +// when no opts are passed, produced CID has 'raw' codec func (tp *TestSuite) TestBlockPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -60,12 +69,14 @@ func (tp *TestSuite) TestBlockPut(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != pbCid { + if res.Path().Cid().String() != rawCid { t.Errorf("got wrong cid: %s", res.Path().Cid().String()) } } -func (tp *TestSuite) TestBlockPutFormat(t *testing.T) { +// Format is deprecated, it used invalid codec names. +// Confirm 'cbor' gets fixed to 'dag-cbor' +func (tp *TestSuite) TestBlockPutFormatDagCbor(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() api, err := tp.makeAPI(ctx) @@ -83,6 +94,82 @@ func (tp *TestSuite) TestBlockPutFormat(t *testing.T) { } } +// Format is deprecated, it used invalid codec names. +// Confirm 'protobuf' got fixed to 'dag-pb' +func (tp *TestSuite) TestBlockPutFormatDagPb(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + res, err := api.Block().Put(ctx, pbBlock(), opt.Block.Format("protobuf")) + if err != nil { + t.Fatal(err) + } + + if res.Path().Cid().String() != pbCid { + t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + } +} + +// Format is deprecated, it used invalid codec names. +// Confirm fake codec 'v0' got fixed to CIDv0 (with implicit dag-pb codec) +func (tp *TestSuite) TestBlockPutFormatV0(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + res, err := api.Block().Put(ctx, pbBlock(), opt.Block.Format("v0")) + if err != nil { + t.Fatal(err) + } + + if res.Path().Cid().String() != pbCidV0 { + t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + } +} + +func (tp *TestSuite) TestBlockPutCidCodecDagCbor(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + res, err := api.Block().Put(ctx, cborBlock(), opt.Block.CidCodec("dag-cbor")) + if err != nil { + t.Fatal(err) + } + + if res.Path().Cid().String() != cborCid { + t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + } +} + +func (tp *TestSuite) TestBlockPutCidCodecDagPb(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + api, err := tp.makeAPI(ctx) + if err != nil { + t.Fatal(err) + } + + res, err := api.Block().Put(ctx, pbBlock(), opt.Block.CidCodec("dag-pb")) + if err != nil { + t.Fatal(err) + } + + if res.Path().Cid().String() != pbCid { + t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + } +} + func (tp *TestSuite) TestBlockPutHash(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -95,7 +182,7 @@ func (tp *TestSuite) TestBlockPutHash(t *testing.T) { ctx, cborBlock(), opt.Block.Hash(mh.KECCAK_512, -1), - opt.Block.Format("cbor"), + opt.Block.CidCodec("dag-cbor"), ) if err != nil { t.Fatal(err) From f2614d979edfef6bb4ee6c3465aa3636c9f95850 Mon Sep 17 00:00:00 2001 From: web3-bot <81333946+web3-bot@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:07:58 +0200 Subject: [PATCH 241/286] sync: update CI config files (#87) This commit was moved from ipfs/interface-go-ipfs-core@de3410bbe2bbdbf50e090a06eda0f741cad5381c This commit was moved from ipfs/boxo@ea6ac8cb6aa02f6cd88cb141f3f077e206277829 --- core/coreiface/block.go | 3 ++- core/coreiface/dht.go | 1 + core/coreiface/key.go | 1 + core/coreiface/name.go | 1 + core/coreiface/object.go | 3 ++- core/coreiface/options/key.go | 2 +- core/coreiface/options/name.go | 1 - core/coreiface/options/pin.go | 40 +++++++++++++++++----------------- core/coreiface/path/path.go | 2 +- core/coreiface/pin.go | 1 + core/coreiface/tests/block.go | 5 ++--- core/coreiface/tests/dag.go | 3 ++- core/coreiface/tests/object.go | 10 ++++----- core/coreiface/tests/pin.go | 2 +- core/coreiface/tests/pubsub.go | 2 +- core/coreiface/tests/unixfs.go | 9 ++++---- core/coreiface/unixfs.go | 3 ++- 17 files changed, 47 insertions(+), 42 deletions(-) diff --git a/core/coreiface/block.go b/core/coreiface/block.go index b105b079df9..49ffe75d723 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -2,9 +2,10 @@ package iface import ( "context" - path "github.com/ipfs/interface-go-ipfs-core/path" "io" + path "github.com/ipfs/interface-go-ipfs-core/path" + "github.com/ipfs/interface-go-ipfs-core/options" ) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 5f49e74a356..81a20ee2b63 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -2,6 +2,7 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" diff --git a/core/coreiface/key.go b/core/coreiface/key.go index db729b3b417..96725566565 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -2,6 +2,7 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" diff --git a/core/coreiface/name.go b/core/coreiface/name.go index 3dc9f687838..d2725e028b3 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -3,6 +3,7 @@ package iface import ( "context" "errors" + path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 86536d42109..733dc2beef8 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -2,9 +2,10 @@ package iface import ( "context" - path "github.com/ipfs/interface-go-ipfs-core/path" "io" + path "github.com/ipfs/interface-go-ipfs-core/path" + "github.com/ipfs/interface-go-ipfs-core/options" "github.com/ipfs/go-cid" diff --git a/core/coreiface/options/key.go b/core/coreiface/options/key.go index 80beea35299..4bc53a65fef 100644 --- a/core/coreiface/options/key.go +++ b/core/coreiface/options/key.go @@ -69,7 +69,7 @@ func (keyOpts) Type(algorithm string) KeyGenerateOption { // generated. Default is -1 // // value of -1 means 'use default size for key type': -// * 2048 for RSA +// - 2048 for RSA func (keyOpts) Size(size int) KeyGenerateOption { return func(settings *KeyGenerateSettings) error { settings.Size = size diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index 59aaf2ca360..aa808286325 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -113,7 +113,6 @@ func (nameOpts) Cache(cache bool) NameResolveOption { } } -// func (nameOpts) ResolveOption(opt ropts.ResolveOpt) NameResolveOption { return func(settings *NameResolveSettings) error { settings.ResolveOpts = append(settings.ResolveOpts, opt) diff --git a/core/coreiface/options/pin.go b/core/coreiface/options/pin.go index 5014a2d2b17..75c2b8a2634 100644 --- a/core/coreiface/options/pin.go +++ b/core/coreiface/options/pin.go @@ -164,11 +164,11 @@ func (pinLsOpts) Indirect() PinLsOption { // type. // // Supported values: -// * "direct" - directly pinned objects -// * "recursive" - roots of recursive pins -// * "indirect" - indirectly pinned objects (referenced by recursively pinned -// objects) -// * "all" - all pinned objects (default) +// - "direct" - directly pinned objects +// - "recursive" - roots of recursive pins +// - "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// - "all" - all pinned objects (default) func (pinLsOpts) Type(typeStr string) (PinLsOption, error) { switch typeStr { case "all", "direct", "indirect", "recursive": @@ -182,11 +182,11 @@ func (pinLsOpts) Type(typeStr string) (PinLsOption, error) { // be returned // // Supported values: -// * "direct" - directly pinned objects -// * "recursive" - roots of recursive pins -// * "indirect" - indirectly pinned objects (referenced by recursively pinned -// objects) -// * "all" - all pinned objects (default) +// - "direct" - directly pinned objects +// - "recursive" - roots of recursive pins +// - "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// - "all" - all pinned objects (default) func (pinLsOpts) pinType(t string) PinLsOption { return func(settings *PinLsSettings) error { settings.Type = t @@ -224,11 +224,11 @@ func (pinIsPinnedOpts) Indirect() PinIsPinnedOption { // type. // // Supported values: -// * "direct" - directly pinned objects -// * "recursive" - roots of recursive pins -// * "indirect" - indirectly pinned objects (referenced by recursively pinned -// objects) -// * "all" - all pinned objects (default) +// - "direct" - directly pinned objects +// - "recursive" - roots of recursive pins +// - "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// - "all" - all pinned objects (default) func (pinIsPinnedOpts) Type(typeStr string) (PinIsPinnedOption, error) { switch typeStr { case "all", "direct", "indirect", "recursive": @@ -242,11 +242,11 @@ func (pinIsPinnedOpts) Type(typeStr string) (PinIsPinnedOption, error) { // pin is expected to be, speeding up the research. // // Supported values: -// * "direct" - directly pinned objects -// * "recursive" - roots of recursive pins -// * "indirect" - indirectly pinned objects (referenced by recursively pinned -// objects) -// * "all" - all pinned objects (default) +// - "direct" - directly pinned objects +// - "recursive" - roots of recursive pins +// - "indirect" - indirectly pinned objects (referenced by recursively pinned +// objects) +// - "all" - all pinned objects (default) func (pinIsPinnedOpts) pinType(t string) PinIsPinnedOption { return func(settings *PinIsPinnedSettings) error { settings.WithType = t diff --git a/core/coreiface/path/path.go b/core/coreiface/path/path.go index 01b1673b1d1..e2562936d4d 100644 --- a/core/coreiface/path/path.go +++ b/core/coreiface/path/path.go @@ -15,7 +15,7 @@ import ( // * /ipfs - Immutable unixfs path (files) // * /ipld - Immutable ipld path (data) // * /ipns - Mutable names. Usually resolves to one of the immutable paths -//TODO: /local (MFS) +// TODO: /local (MFS) type Path interface { // String returns the path as a string. String() string diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 4c1788c682a..6205a9b2092 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -2,6 +2,7 @@ package iface import ( "context" + path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 916e52dd3a4..a8196991641 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "io" - "io/ioutil" "strings" "testing" @@ -211,7 +210,7 @@ func (tp *TestSuite) TestBlockGet(t *testing.T) { t.Fatal(err) } - d, err := ioutil.ReadAll(r) + d, err := io.ReadAll(r) if err != nil { t.Fatal(err) } @@ -249,7 +248,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) { t.Fatal(err) } - d, err := ioutil.ReadAll(r) + d, err := io.ReadAll(r) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index 6f9d9659e18..5ea0d3eb123 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -2,12 +2,13 @@ package tests import ( "context" - path "github.com/ipfs/interface-go-ipfs-core/path" "math" gopath "path" "strings" "testing" + path "github.com/ipfs/interface-go-ipfs-core/path" + coreiface "github.com/ipfs/interface-go-ipfs-core" ipldcbor "github.com/ipfs/go-ipld-cbor" diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index e8ab1a7f4b9..c3437853c58 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -4,11 +4,11 @@ import ( "bytes" "context" "encoding/hex" - "io/ioutil" + "io" "strings" "testing" - "github.com/ipfs/interface-go-ipfs-core" + iface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" ) @@ -143,7 +143,7 @@ func (tp *TestSuite) TestObjectData(t *testing.T) { t.Fatal(err) } - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { t.Fatal(err) } @@ -383,7 +383,7 @@ func (tp *TestSuite) TestObjectAddData(t *testing.T) { t.Fatal(err) } - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { t.Fatal(err) } @@ -416,7 +416,7 @@ func (tp *TestSuite) TestObjectSetData(t *testing.T) { t.Fatal(err) } - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index d378d1015c6..ad1a0fdd21c 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/ipfs/interface-go-ipfs-core" + iface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" "github.com/ipfs/interface-go-ipfs-core/path" diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index f8339f22834..18da2103d1a 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/ipfs/interface-go-ipfs-core" + iface "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/options" ) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index f47d34d0a50..05226dbbf02 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -6,7 +6,6 @@ import ( "encoding/hex" "fmt" "io" - "io/ioutil" "math" "math/rand" "os" @@ -113,7 +112,7 @@ func (tp *TestSuite) TestAdd(t *testing.T) { return path.IpfsPath(c) } - rf, err := ioutil.TempFile(os.TempDir(), "unixfs-add-real") + rf, err := os.CreateTemp(os.TempDir(), "unixfs-add-real") if err != nil { t.Fatal(err) } @@ -134,7 +133,7 @@ func (tp *TestSuite) TestAdd(t *testing.T) { defer os.Remove(rfp) realFile := func() files.Node { - n, err := files.NewReaderPathFile(rfp, ioutil.NopCloser(strings.NewReader(helloStr)), stat) + n, err := files.NewReaderPathFile(rfp, io.NopCloser(strings.NewReader(helloStr)), stat) if err != nil { t.Fatal(err) } @@ -474,12 +473,12 @@ func (tp *TestSuite) TestAdd(t *testing.T) { defer orig.Close() defer got.Close() - do, err := ioutil.ReadAll(orig.(files.File)) + do, err := io.ReadAll(orig.(files.File)) if err != nil { t.Fatal(err) } - dg, err := ioutil.ReadAll(got.(files.File)) + dg, err := io.ReadAll(got.(files.File)) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 686c402987a..c398b672232 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -2,11 +2,12 @@ package iface import ( "context" + "github.com/ipfs/interface-go-ipfs-core/options" path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipfs-files" + files "github.com/ipfs/go-ipfs-files" ) type AddEvent struct { From 46577b15b76c8c9666f4112d034463076cd2604e Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Mon, 21 Nov 2022 09:38:01 +1300 Subject: [PATCH 242/286] chore: update go-libp2p to v0.23.4 This commit was moved from ipfs/interface-go-ipfs-core@96e9f233339ef16c3f1be4db6ced89ff82accfbb This commit was moved from ipfs/boxo@90ca296f80108f2fd10943895a8df31e28967850 --- core/coreiface/dht.go | 4 ++-- core/coreiface/idfmt.go | 2 +- core/coreiface/key.go | 4 ++-- core/coreiface/pubsub.go | 4 ++-- core/coreiface/swarm.go | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 81a20ee2b63..73bf483056d 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -3,11 +3,11 @@ package iface import ( "context" - path "github.com/ipfs/interface-go-ipfs-core/path" + "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" ) // DhtAPI specifies the interface to the DHT diff --git a/core/coreiface/idfmt.go b/core/coreiface/idfmt.go index 1ba79e6023d..80fd0f822f4 100644 --- a/core/coreiface/idfmt.go +++ b/core/coreiface/idfmt.go @@ -1,7 +1,7 @@ package iface import ( - peer "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" mbase "github.com/multiformats/go-multibase" ) diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 96725566565..b0e739cb836 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -3,11 +3,11 @@ package iface import ( "context" - path "github.com/ipfs/interface-go-ipfs-core/path" + "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/interface-go-ipfs-core/options" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" ) // Key specifies the interface to Keys in KeyAPI Keystore diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index d9826551d49..427256251e5 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -4,9 +4,9 @@ import ( "context" "io" - options "github.com/ipfs/interface-go-ipfs-core/options" + "github.com/ipfs/interface-go-ipfs-core/options" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" ) // PubSubSubscription is an active PubSub subscription diff --git a/core/coreiface/swarm.go b/core/coreiface/swarm.go index d7b25d5e87a..9aa5466ba46 100644 --- a/core/coreiface/swarm.go +++ b/core/coreiface/swarm.go @@ -5,9 +5,9 @@ import ( "errors" "time" - "github.com/libp2p/go-libp2p-core/network" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/libp2p/go-libp2p-core/protocol" + "github.com/libp2p/go-libp2p/core/network" + "github.com/libp2p/go-libp2p/core/peer" + "github.com/libp2p/go-libp2p/core/protocol" ma "github.com/multiformats/go-multiaddr" ) From d2edb2ea7859d83a501c455ae054350c3622b83b Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 12 Dec 2022 21:09:45 +0100 Subject: [PATCH 243/286] feat: add UseCumulativeSize UnixfsLs option (#95) This commit was moved from ipfs/interface-go-ipfs-core@b1299abda0c69529c7efa02d5efb9f8905fdd4fe This commit was moved from ipfs/boxo@ff2eb2bff265f34012cca335447987da546ecee2 --- core/coreiface/options/unixfs.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index 3fd96f772c8..cd15991e27a 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -39,7 +39,8 @@ type UnixfsAddSettings struct { } type UnixfsLsSettings struct { - ResolveChildren bool + ResolveChildren bool + UseCumulativeSize bool } type UnixfsAddOption func(*UnixfsAddSettings) error @@ -283,3 +284,10 @@ func (unixfsOpts) ResolveChildren(resolve bool) UnixfsLsOption { return nil } } + +func (unixfsOpts) UseCumulativeSize(use bool) UnixfsLsOption { + return func(settings *UnixfsLsSettings) error { + settings.UseCumulativeSize = use + return nil + } +} From 587075204dfbd96441b4d787646b87a878ad30c9 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 12 Jan 2023 11:45:13 +0100 Subject: [PATCH 244/286] chore: migrate files (#97) This commit was moved from ipfs/interface-go-ipfs-core@f7b346b76c5724489877c511754f0f11923d3214 This commit was moved from ipfs/boxo@01de18ff3f4ccd639e02226048fda8a8f140941c --- core/coreiface/tests/name.go | 2 +- core/coreiface/tests/unixfs.go | 2 +- core/coreiface/unixfs.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 2a8b4d76afb..2e648babaa3 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -10,7 +10,7 @@ import ( path "github.com/ipfs/interface-go-ipfs-core/path" - files "github.com/ipfs/go-ipfs-files" + "github.com/ipfs/go-libipfs/files" coreiface "github.com/ipfs/interface-go-ipfs-core" opt "github.com/ipfs/interface-go-ipfs-core/options" diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 05226dbbf02..121d3db6933 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -20,9 +20,9 @@ import ( "github.com/ipfs/interface-go-ipfs-core/options" "github.com/ipfs/go-cid" - files "github.com/ipfs/go-ipfs-files" cbor "github.com/ipfs/go-ipld-cbor" ipld "github.com/ipfs/go-ipld-format" + "github.com/ipfs/go-libipfs/files" mdag "github.com/ipfs/go-merkledag" "github.com/ipfs/go-unixfs" "github.com/ipfs/go-unixfs/importer/helpers" diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index c398b672232..3b21a8e2387 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -7,7 +7,7 @@ import ( path "github.com/ipfs/interface-go-ipfs-core/path" "github.com/ipfs/go-cid" - files "github.com/ipfs/go-ipfs-files" + "github.com/ipfs/go-libipfs/files" ) type AddEvent struct { From b3cc938630bc7607f86afed9ba4c1cdfda07e828 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 24 Jan 2023 23:44:55 +0100 Subject: [PATCH 245/286] feat: add namesys publish options (#94) * feat: add namesys publish options * feat: export DefaultIPNSRecordEOL * feat: export DefaultIPNSRecordTTL This commit was moved from ipfs/interface-go-ipfs-core@468dea4bb45aec6ddce2a6225334dcc062d6e752 This commit was moved from ipfs/boxo@bcb9190c2bdbc0ad4823a1b1785fb87ec8014723 --- core/coreiface/options/namesys/opts.go | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/core/coreiface/options/namesys/opts.go b/core/coreiface/options/namesys/opts.go index ee2bd5ac2a4..0cd1ba7781f 100644 --- a/core/coreiface/options/namesys/opts.go +++ b/core/coreiface/options/namesys/opts.go @@ -13,6 +13,15 @@ const ( // trust resolution to eventually complete and can't put an upper // limit on how many steps it will take. UnlimitedDepth = 0 + + // DefaultIPNSRecordTTL specifies the time that the record can be cached + // before checking if its validity again. + DefaultIPNSRecordTTL = time.Minute + + // DefaultIPNSRecordEOL specifies the time that the network will cache IPNS + // records after being published. Records should be re-published before this + // interval expires. We use the same default expiration as the DHT. + DefaultIPNSRecordEOL = 48 * time.Hour ) // ResolveOpts specifies options for resolving an IPNS path @@ -72,3 +81,43 @@ func ProcessOpts(opts []ResolveOpt) ResolveOpts { } return rsopts } + +// PublishOptions specifies options for publishing an IPNS record. +type PublishOptions struct { + EOL time.Time + TTL time.Duration +} + +// DefaultPublishOptions returns the default options for publishing an IPNS record. +func DefaultPublishOptions() PublishOptions { + return PublishOptions{ + EOL: time.Now().Add(DefaultIPNSRecordEOL), + TTL: DefaultIPNSRecordTTL, + } +} + +// PublishOption is used to set an option for PublishOpts. +type PublishOption func(*PublishOptions) + +// PublishWithEOL sets an EOL. +func PublishWithEOL(eol time.Time) PublishOption { + return func(o *PublishOptions) { + o.EOL = eol + } +} + +// PublishWithEOL sets a TTL. +func PublishWithTTL(ttl time.Duration) PublishOption { + return func(o *PublishOptions) { + o.TTL = ttl + } +} + +// ProcessPublishOptions converts an array of PublishOpt into a PublishOpts object. +func ProcessPublishOptions(opts []PublishOption) PublishOptions { + rsopts := DefaultPublishOptions() + for _, option := range opts { + option(&rsopts) + } + return rsopts +} From 132206b573c44164a6571a551cf1b2c3acbcb438 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 14 Nov 2022 17:18:43 +0100 Subject: [PATCH 246/286] feat: add RoutingAPI to CoreAPI This commit was moved from ipfs/interface-go-ipfs-core@177d25ba92ed67ab4916cb13827321c389961de0 This commit was moved from ipfs/boxo@b3ab88834562c689b5eadfed2e08e732fea4392a --- core/coreiface/coreapi.go | 3 +++ core/coreiface/routing.go | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 core/coreiface/routing.go diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 894ffb31876..722c00a0f58 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -44,6 +44,9 @@ type CoreAPI interface { // PubSub returns an implementation of PubSub API PubSub() PubSubAPI + // Routing returns an implementation of Routing API + Routing() RoutingAPI + // ResolvePath resolves the path using Unixfs resolver ResolvePath(context.Context, path.Path) (path.Resolved, error) diff --git a/core/coreiface/routing.go b/core/coreiface/routing.go new file mode 100644 index 00000000000..a28ceb9e775 --- /dev/null +++ b/core/coreiface/routing.go @@ -0,0 +1,14 @@ +package iface + +import ( + "context" +) + +// RoutingAPI specifies the interface to the routing layer. +type RoutingAPI interface { + // Get retrieves the best value for a given key + Get(context.Context, string) ([]byte, error) + + // Put sets a value for a given key + Put(ctx context.Context, key string, value []byte) error +} From 3f7c35bdb9239717c6e7f807e4effb6302842562 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 8 Feb 2023 08:37:20 +0100 Subject: [PATCH 247/286] test: basic routing interface test This commit was moved from ipfs/interface-go-ipfs-core@d069f41be1eea938a4bbaa16dae953eed24bc945 This commit was moved from ipfs/boxo@48f8c69a903b1e66f8725f6b5ce9741b8e88c5a1 --- core/coreiface/tests/api.go | 1 + core/coreiface/tests/routing.go | 92 +++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 core/coreiface/tests/routing.go diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index 0801b3ca7f0..ec1f63ae6ba 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -69,6 +69,7 @@ func TestApi(p Provider) func(t *testing.T) { t.Run("Path", tp.TestPath) t.Run("Pin", tp.TestPin) t.Run("PubSub", tp.TestPubSub) + t.Run("Routing", tp.TestRouting) t.Run("Unixfs", tp.TestUnixfs) apis <- -1 diff --git a/core/coreiface/tests/routing.go b/core/coreiface/tests/routing.go new file mode 100644 index 00000000000..14e0d2e66e9 --- /dev/null +++ b/core/coreiface/tests/routing.go @@ -0,0 +1,92 @@ +package tests + +import ( + "context" + "testing" + "time" + + "github.com/gogo/protobuf/proto" + ipns_pb "github.com/ipfs/go-ipns/pb" + iface "github.com/ipfs/interface-go-ipfs-core" +) + +func (tp *TestSuite) TestRouting(t *testing.T) { + tp.hasApi(t, func(api iface.CoreAPI) error { + if api.Routing() == nil { + return errAPINotImplemented + } + return nil + }) + + t.Run("TestRoutingGet", tp.TestRoutingGet) + t.Run("TestRoutingPut", tp.TestRoutingPut) +} + +func (tp *TestSuite) testRoutingPublishKey(t *testing.T, ctx context.Context, api iface.CoreAPI) iface.IpnsEntry { + p, err := addTestObject(ctx, api) + if err != nil { + t.Fatal(err) + } + + entry, err := api.Name().Publish(ctx, p) + if err != nil { + t.Fatal(err) + } + + time.Sleep(3 * time.Second) + return entry +} + +func (tp *TestSuite) TestRoutingGet(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + apis, err := tp.MakeAPISwarm(ctx, true, 2) + if err != nil { + t.Fatal(err) + } + + // Node 1: publishes an IPNS name + ipnsEntry := tp.testRoutingPublishKey(t, ctx, apis[0]) + + // Node 2: retrieves the best value for the IPNS name. + data, err := apis[1].Routing().Get(ctx, "/ipns/"+ipnsEntry.Name()) + if err != nil { + t.Fatal(err) + } + + // Checks if values match. + var entry ipns_pb.IpnsEntry + err = proto.Unmarshal(data, &entry) + if err != nil { + t.Fatal(err) + } + + if string(entry.GetValue()) != ipnsEntry.Value().String() { + t.Fatalf("routing key has wrong value, expected %s, got %s", ipnsEntry.Value().String(), string(entry.GetValue())) + } +} + +func (tp *TestSuite) TestRoutingPut(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + apis, err := tp.MakeAPISwarm(ctx, true, 1) + if err != nil { + t.Fatal(err) + } + + // Create and publish IPNS entry. + ipnsEntry := tp.testRoutingPublishKey(t, ctx, apis[0]) + + // Get valid routing value. + data, err := apis[0].Routing().Get(ctx, "/ipns/"+ipnsEntry.Name()) + if err != nil { + t.Fatal(err) + } + + // Put routing value. + err = apis[0].Routing().Put(ctx, "/ipns/"+ipnsEntry.Name(), data) + if err != nil { + t.Fatal(err) + } +} From 3b6647ffdc86bfe219a52ccb9b48d4f4608d5bb7 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Fri, 10 Feb 2023 03:25:12 +0100 Subject: [PATCH 248/286] test: use two nodes in publish This spin up online nodes instead of offline ones. This commit was moved from ipfs/interface-go-ipfs-core@a8d2741bbe08a6ba54cf4a4e229eff6978be1b77 This commit was moved from ipfs/boxo@54d20f01739e73f7c770db8f2dc0be1c2185ce20 --- core/coreiface/tests/routing.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/coreiface/tests/routing.go b/core/coreiface/tests/routing.go index 14e0d2e66e9..64287487e27 100644 --- a/core/coreiface/tests/routing.go +++ b/core/coreiface/tests/routing.go @@ -70,7 +70,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) { func (tp *TestSuite) TestRoutingPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 1) + apis, err := tp.MakeAPISwarm(ctx, true, 2) if err != nil { t.Fatal(err) } @@ -85,7 +85,7 @@ func (tp *TestSuite) TestRoutingPut(t *testing.T) { } // Put routing value. - err = apis[0].Routing().Put(ctx, "/ipns/"+ipnsEntry.Name(), data) + err = apis[1].Routing().Put(ctx, "/ipns/"+ipnsEntry.Name(), data) if err != nil { t.Fatal(err) } From 1b154e24568ab4970740bc49e9364c748dc05738 Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Wed, 3 May 2023 12:59:07 +0200 Subject: [PATCH 249/286] feat(routing): allow-offline with routing put (#278) This commit was moved from ipfs/boxo@8059f183d86648f69ad562546b4797bc148c0984 --- core/coreiface/options/routing.go | 35 +++++++++++++++++++++++++ core/coreiface/routing.go | 4 ++- core/coreiface/tests/api.go | 37 +++++++++++++++++--------- core/coreiface/tests/dht.go | 6 ++--- core/coreiface/tests/name.go | 6 ++--- core/coreiface/tests/pubsub.go | 2 +- core/coreiface/tests/routing.go | 43 ++++++++++++++++++++++++++++--- 7 files changed, 109 insertions(+), 24 deletions(-) create mode 100644 core/coreiface/options/routing.go diff --git a/core/coreiface/options/routing.go b/core/coreiface/options/routing.go new file mode 100644 index 00000000000..d66d44a0dbd --- /dev/null +++ b/core/coreiface/options/routing.go @@ -0,0 +1,35 @@ +package options + +type RoutingPutSettings struct { + AllowOffline bool +} + +type RoutingPutOption func(*RoutingPutSettings) error + +func RoutingPutOptions(opts ...RoutingPutOption) (*RoutingPutSettings, error) { + options := &RoutingPutSettings{ + AllowOffline: false, + } + + for _, opt := range opts { + err := opt(options) + if err != nil { + return nil, err + } + } + + return options, nil +} + +type putOpts struct{} + +var Put putOpts + +// AllowOffline is an option for Routing.Put which specifies whether to allow +// publishing when the node is offline. Default value is false +func (putOpts) AllowOffline(allow bool) RoutingPutOption { + return func(settings *RoutingPutSettings) error { + settings.AllowOffline = allow + return nil + } +} diff --git a/core/coreiface/routing.go b/core/coreiface/routing.go index a28ceb9e775..5099c3de079 100644 --- a/core/coreiface/routing.go +++ b/core/coreiface/routing.go @@ -2,6 +2,8 @@ package iface import ( "context" + + "github.com/ipfs/boxo/coreiface/options" ) // RoutingAPI specifies the interface to the routing layer. @@ -10,5 +12,5 @@ type RoutingAPI interface { Get(context.Context, string) ([]byte, error) // Put sets a value for a given key - Put(ctx context.Context, key string, value []byte) error + Put(ctx context.Context, key string, value []byte, opts ...options.RoutingPutOption) error } diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index 497ef9d2763..f30990512c0 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -11,21 +11,12 @@ import ( var errAPINotImplemented = errors.New("api not implemented") -func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { - api, err := tp.MakeAPISwarm(ctx, false, 1) - if err != nil { - return nil, err - } - - return api[0], nil -} - type Provider interface { // Make creates n nodes. fullIdentity set to false can be ignored - MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) + MakeAPISwarm(ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error) } -func (tp *TestSuite) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) ([]coreiface.CoreAPI, error) { +func (tp *TestSuite) makeAPISwarm(ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error) { if tp.apis != nil { tp.apis <- 1 go func() { @@ -34,7 +25,29 @@ func (tp *TestSuite) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) }() } - return tp.Provider.MakeAPISwarm(ctx, fullIdentity, n) + return tp.Provider.MakeAPISwarm(ctx, fullIdentity, online, n) +} + +func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { + api, err := tp.makeAPISwarm(ctx, false, false, 1) + if err != nil { + return nil, err + } + + return api[0], nil +} + +func (tp *TestSuite) makeAPIWithIdentityAndOffline(ctx context.Context) (coreiface.CoreAPI, error) { + api, err := tp.makeAPISwarm(ctx, true, false, 1) + if err != nil { + return nil, err + } + + return api[0], nil +} + +func (tp *TestSuite) MakeAPISwarm(ctx context.Context, n int) ([]coreiface.CoreAPI, error) { + return tp.makeAPISwarm(ctx, true, true, n) } type TestSuite struct { diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index fb3f6d1a00c..61f9fd68770 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -26,7 +26,7 @@ func (tp *TestSuite) TestDht(t *testing.T) { func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } @@ -81,7 +81,7 @@ func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } @@ -113,7 +113,7 @@ func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { func (tp *TestSuite) TestDhtProvide(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index a67876cbaf6..a669e0c02dc 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -43,7 +43,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() init := func() (coreiface.CoreAPI, path.Path) { - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) return nil, nil @@ -191,7 +191,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } @@ -235,7 +235,7 @@ func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 5) + apis, err := tp.MakeAPISwarm(ctx, 5) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index 446e0771a82..24a8ac3090b 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -24,7 +24,7 @@ func (tp *TestSuite) TestBasicPubSub(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 2) + apis, err := tp.MakeAPISwarm(ctx, 2) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/routing.go b/core/coreiface/tests/routing.go index e1d8d10604e..bf314cafe74 100644 --- a/core/coreiface/tests/routing.go +++ b/core/coreiface/tests/routing.go @@ -7,6 +7,7 @@ import ( "github.com/gogo/protobuf/proto" iface "github.com/ipfs/boxo/coreiface" + "github.com/ipfs/boxo/coreiface/options" ipns_pb "github.com/ipfs/boxo/ipns/pb" ) @@ -20,15 +21,16 @@ func (tp *TestSuite) TestRouting(t *testing.T) { t.Run("TestRoutingGet", tp.TestRoutingGet) t.Run("TestRoutingPut", tp.TestRoutingPut) + t.Run("TestRoutingPutOffline", tp.TestRoutingPutOffline) } -func (tp *TestSuite) testRoutingPublishKey(t *testing.T, ctx context.Context, api iface.CoreAPI) iface.IpnsEntry { +func (tp *TestSuite) testRoutingPublishKey(t *testing.T, ctx context.Context, api iface.CoreAPI, opts ...options.NamePublishOption) iface.IpnsEntry { p, err := addTestObject(ctx, api) if err != nil { t.Fatal(err) } - entry, err := api.Name().Publish(ctx, p) + entry, err := api.Name().Publish(ctx, p, opts...) if err != nil { t.Fatal(err) } @@ -41,7 +43,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 2) + apis, err := tp.MakeAPISwarm(ctx, 2) if err != nil { t.Fatal(err) } @@ -70,7 +72,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) { func (tp *TestSuite) TestRoutingPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, true, 2) + apis, err := tp.MakeAPISwarm(ctx, 2) if err != nil { t.Fatal(err) } @@ -90,3 +92,36 @@ func (tp *TestSuite) TestRoutingPut(t *testing.T) { t.Fatal(err) } } + +func (tp *TestSuite) TestRoutingPutOffline(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + // init a swarm & publish an IPNS entry to get a valid payload + apis, err := tp.MakeAPISwarm(ctx, 2) + if err != nil { + t.Fatal(err) + } + + ipnsEntry := tp.testRoutingPublishKey(t, ctx, apis[0], options.Name.AllowOffline(true)) + data, err := apis[0].Routing().Get(ctx, "/ipns/"+ipnsEntry.Name()) + if err != nil { + t.Fatal(err) + } + + // init our offline node and try to put the payload + api, err := tp.makeAPIWithIdentityAndOffline(ctx) + if err != nil { + t.Fatal(err) + } + + err = api.Routing().Put(ctx, "/ipns/"+ipnsEntry.Name(), data) + if err == nil { + t.Fatal("this operation should fail because we are offline") + } + + err = api.Routing().Put(ctx, "/ipns/"+ipnsEntry.Name(), data, options.Put.AllowOffline(true)) + if err != nil { + t.Fatal(err) + } +} From 18143e2bb38a00b778b4eefc7a31077cf556b480 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 30 May 2023 19:08:53 +0200 Subject: [PATCH 250/286] coreiface: add a testing.T argument to the provider This is usefull because it allows the Provider to use t.Cleanup for cleaning up the nodes. This commit was moved from ipfs/boxo@c23df3837fbe224259a60e8eed9d77e2656f2dce --- core/coreiface/tests/api.go | 20 ++++++++++---------- core/coreiface/tests/block.go | 22 +++++++++++----------- core/coreiface/tests/dag.go | 10 +++++----- core/coreiface/tests/dht.go | 6 +++--- core/coreiface/tests/key.go | 32 ++++++++++++++++---------------- core/coreiface/tests/name.go | 6 +++--- core/coreiface/tests/object.go | 24 ++++++++++++------------ core/coreiface/tests/path.go | 10 +++++----- core/coreiface/tests/pin.go | 16 ++++++++-------- core/coreiface/tests/pubsub.go | 2 +- core/coreiface/tests/routing.go | 8 ++++---- core/coreiface/tests/unixfs.go | 26 +++++++++++++------------- 12 files changed, 91 insertions(+), 91 deletions(-) diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index f30990512c0..a66e2abeb29 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -13,10 +13,10 @@ var errAPINotImplemented = errors.New("api not implemented") type Provider interface { // Make creates n nodes. fullIdentity set to false can be ignored - MakeAPISwarm(ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error) + MakeAPISwarm(t *testing.T, ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error) } -func (tp *TestSuite) makeAPISwarm(ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error) { +func (tp *TestSuite) makeAPISwarm(t *testing.T, ctx context.Context, fullIdentity bool, online bool, n int) ([]coreiface.CoreAPI, error) { if tp.apis != nil { tp.apis <- 1 go func() { @@ -25,11 +25,11 @@ func (tp *TestSuite) makeAPISwarm(ctx context.Context, fullIdentity bool, online }() } - return tp.Provider.MakeAPISwarm(ctx, fullIdentity, online, n) + return tp.Provider.MakeAPISwarm(t, ctx, fullIdentity, online, n) } -func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { - api, err := tp.makeAPISwarm(ctx, false, false, 1) +func (tp *TestSuite) makeAPI(t *testing.T, ctx context.Context) (coreiface.CoreAPI, error) { + api, err := tp.makeAPISwarm(t, ctx, false, false, 1) if err != nil { return nil, err } @@ -37,8 +37,8 @@ func (tp *TestSuite) makeAPI(ctx context.Context) (coreiface.CoreAPI, error) { return api[0], nil } -func (tp *TestSuite) makeAPIWithIdentityAndOffline(ctx context.Context) (coreiface.CoreAPI, error) { - api, err := tp.makeAPISwarm(ctx, true, false, 1) +func (tp *TestSuite) makeAPIWithIdentityAndOffline(t *testing.T, ctx context.Context) (coreiface.CoreAPI, error) { + api, err := tp.makeAPISwarm(t, ctx, true, false, 1) if err != nil { return nil, err } @@ -46,8 +46,8 @@ func (tp *TestSuite) makeAPIWithIdentityAndOffline(ctx context.Context) (coreifa return api[0], nil } -func (tp *TestSuite) MakeAPISwarm(ctx context.Context, n int) ([]coreiface.CoreAPI, error) { - return tp.makeAPISwarm(ctx, true, true, n) +func (tp *TestSuite) MakeAPISwarm(t *testing.T, ctx context.Context, n int) ([]coreiface.CoreAPI, error) { + return tp.makeAPISwarm(t, ctx, true, true, n) } type TestSuite struct { @@ -99,7 +99,7 @@ func TestApi(p Provider) func(t *testing.T) { func (tp *TestSuite) hasApi(t *testing.T, tf func(coreiface.CoreAPI) error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index c884f3e8238..5dcb16e4f59 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -58,7 +58,7 @@ func (tp *TestSuite) TestBlock(t *testing.T) { func (tp *TestSuite) TestBlockPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -78,7 +78,7 @@ func (tp *TestSuite) TestBlockPut(t *testing.T) { func (tp *TestSuite) TestBlockPutFormatDagCbor(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -98,7 +98,7 @@ func (tp *TestSuite) TestBlockPutFormatDagCbor(t *testing.T) { func (tp *TestSuite) TestBlockPutFormatDagPb(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -118,7 +118,7 @@ func (tp *TestSuite) TestBlockPutFormatDagPb(t *testing.T) { func (tp *TestSuite) TestBlockPutFormatV0(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -136,7 +136,7 @@ func (tp *TestSuite) TestBlockPutFormatV0(t *testing.T) { func (tp *TestSuite) TestBlockPutCidCodecDagCbor(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -154,7 +154,7 @@ func (tp *TestSuite) TestBlockPutCidCodecDagCbor(t *testing.T) { func (tp *TestSuite) TestBlockPutCidCodecDagPb(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -172,7 +172,7 @@ func (tp *TestSuite) TestBlockPutCidCodecDagPb(t *testing.T) { func (tp *TestSuite) TestBlockPutHash(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -195,7 +195,7 @@ func (tp *TestSuite) TestBlockPutHash(t *testing.T) { func (tp *TestSuite) TestBlockGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -233,7 +233,7 @@ func (tp *TestSuite) TestBlockGet(t *testing.T) { func (tp *TestSuite) TestBlockRm(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -287,7 +287,7 @@ func (tp *TestSuite) TestBlockRm(t *testing.T) { func (tp *TestSuite) TestBlockStat(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -314,7 +314,7 @@ func (tp *TestSuite) TestBlockStat(t *testing.T) { func (tp *TestSuite) TestBlockPin(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index b4118e2cc93..ba74031f963 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -44,7 +44,7 @@ var ( func (tp *TestSuite) TestPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -67,7 +67,7 @@ func (tp *TestSuite) TestPut(t *testing.T) { func (tp *TestSuite) TestPutWithHash(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -90,7 +90,7 @@ func (tp *TestSuite) TestPutWithHash(t *testing.T) { func (tp *TestSuite) TestDagPath(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -135,7 +135,7 @@ func (tp *TestSuite) TestDagPath(t *testing.T) { func (tp *TestSuite) TestTree(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -170,7 +170,7 @@ func (tp *TestSuite) TestTree(t *testing.T) { func (tp *TestSuite) TestBatch(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 61f9fd68770..3b3ac1d61e3 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -26,7 +26,7 @@ func (tp *TestSuite) TestDht(t *testing.T) { func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, 5) + apis, err := tp.MakeAPISwarm(t, ctx, 5) if err != nil { t.Fatal(err) } @@ -81,7 +81,7 @@ func (tp *TestSuite) TestDhtFindPeer(t *testing.T) { func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, 5) + apis, err := tp.MakeAPISwarm(t, ctx, 5) if err != nil { t.Fatal(err) } @@ -113,7 +113,7 @@ func (tp *TestSuite) TestDhtFindProviders(t *testing.T) { func (tp *TestSuite) TestDhtProvide(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, 5) + apis, err := tp.MakeAPISwarm(t, ctx, 5) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index 3a38c07ae5c..0b755380e2d 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -40,7 +40,7 @@ func (tp *TestSuite) TestKey(t *testing.T) { func (tp *TestSuite) TestListSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) return @@ -74,7 +74,7 @@ func (tp *TestSuite) TestListSelf(t *testing.T) { func (tp *TestSuite) TestRenameSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) return @@ -102,7 +102,7 @@ func (tp *TestSuite) TestRenameSelf(t *testing.T) { func (tp *TestSuite) TestRemoveSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) return @@ -121,7 +121,7 @@ func (tp *TestSuite) TestRemoveSelf(t *testing.T) { func (tp *TestSuite) TestGenerate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -165,7 +165,7 @@ func verifyIPNSPath(t *testing.T, p string) bool { func (tp *TestSuite) TestGenerateSize(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -189,7 +189,7 @@ func (tp *TestSuite) TestGenerateType(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -213,7 +213,7 @@ func (tp *TestSuite) TestGenerateType(t *testing.T) { func (tp *TestSuite) TestGenerateExisting(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -246,7 +246,7 @@ func (tp *TestSuite) TestGenerateExisting(t *testing.T) { func (tp *TestSuite) TestList(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -285,7 +285,7 @@ func (tp *TestSuite) TestList(t *testing.T) { func (tp *TestSuite) TestRename(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -314,7 +314,7 @@ func (tp *TestSuite) TestRename(t *testing.T) { func (tp *TestSuite) TestRenameToSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -338,7 +338,7 @@ func (tp *TestSuite) TestRenameToSelf(t *testing.T) { func (tp *TestSuite) TestRenameToSelfForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -362,7 +362,7 @@ func (tp *TestSuite) TestRenameToSelfForce(t *testing.T) { func (tp *TestSuite) TestRenameOverwriteNoForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -392,7 +392,7 @@ func (tp *TestSuite) TestRenameOverwriteNoForce(t *testing.T) { func (tp *TestSuite) TestRenameOverwrite(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -431,7 +431,7 @@ func (tp *TestSuite) TestRenameOverwrite(t *testing.T) { func (tp *TestSuite) TestRenameSameNameNoForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -460,7 +460,7 @@ func (tp *TestSuite) TestRenameSameNameNoForce(t *testing.T) { func (tp *TestSuite) TestRenameSameName(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -489,7 +489,7 @@ func (tp *TestSuite) TestRenameSameName(t *testing.T) { func (tp *TestSuite) TestRemove(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index a669e0c02dc..8fa733567bd 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -43,7 +43,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() init := func() (coreiface.CoreAPI, path.Path) { - apis, err := tp.MakeAPISwarm(ctx, 5) + apis, err := tp.MakeAPISwarm(t, ctx, 5) if err != nil { t.Fatal(err) return nil, nil @@ -191,7 +191,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, 5) + apis, err := tp.MakeAPISwarm(t, ctx, 5) if err != nil { t.Fatal(err) } @@ -235,7 +235,7 @@ func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, 5) + apis, err := tp.MakeAPISwarm(t, ctx, 5) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 8e8f52b3d4c..77061b699f1 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -37,7 +37,7 @@ func (tp *TestSuite) TestObject(t *testing.T) { func (tp *TestSuite) TestNew(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -64,7 +64,7 @@ func (tp *TestSuite) TestNew(t *testing.T) { func (tp *TestSuite) TestObjectPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -105,7 +105,7 @@ func (tp *TestSuite) TestObjectPut(t *testing.T) { func (tp *TestSuite) TestObjectGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -128,7 +128,7 @@ func (tp *TestSuite) TestObjectGet(t *testing.T) { func (tp *TestSuite) TestObjectData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -156,7 +156,7 @@ func (tp *TestSuite) TestObjectData(t *testing.T) { func (tp *TestSuite) TestObjectLinks(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -192,7 +192,7 @@ func (tp *TestSuite) TestObjectLinks(t *testing.T) { func (tp *TestSuite) TestObjectStat(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -240,7 +240,7 @@ func (tp *TestSuite) TestObjectStat(t *testing.T) { func (tp *TestSuite) TestObjectAddLink(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -281,7 +281,7 @@ func (tp *TestSuite) TestObjectAddLink(t *testing.T) { func (tp *TestSuite) TestObjectAddLinkCreate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -330,7 +330,7 @@ func (tp *TestSuite) TestObjectAddLinkCreate(t *testing.T) { func (tp *TestSuite) TestObjectRmLink(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -363,7 +363,7 @@ func (tp *TestSuite) TestObjectRmLink(t *testing.T) { func (tp *TestSuite) TestObjectAddData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -396,7 +396,7 @@ func (tp *TestSuite) TestObjectAddData(t *testing.T) { func (tp *TestSuite) TestObjectSetData(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -429,7 +429,7 @@ func (tp *TestSuite) TestObjectSetData(t *testing.T) { func (tp *TestSuite) TestDiffTest(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 321c79d6e83..06f3aa1f808 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -25,7 +25,7 @@ func (tp *TestSuite) TestPath(t *testing.T) { func (tp *TestSuite) TestMutablePath(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -58,7 +58,7 @@ func (tp *TestSuite) TestMutablePath(t *testing.T) { func (tp *TestSuite) TestPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -89,7 +89,7 @@ func (tp *TestSuite) TestPathRemainder(t *testing.T) { func (tp *TestSuite) TestEmptyPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -120,7 +120,7 @@ func (tp *TestSuite) TestEmptyPathRemainder(t *testing.T) { func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -147,7 +147,7 @@ func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) { func (tp *TestSuite) TestPathRoot(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index ac90d097ee5..bbf60299470 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -34,7 +34,7 @@ func (tp *TestSuite) TestPin(t *testing.T) { func (tp *TestSuite) TestPinAdd(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -53,7 +53,7 @@ func (tp *TestSuite) TestPinAdd(t *testing.T) { func (tp *TestSuite) TestPinSimple(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -105,7 +105,7 @@ func (tp *TestSuite) TestPinSimple(t *testing.T) { func (tp *TestSuite) TestPinRecursive(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -249,7 +249,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { func (tp *TestSuite) TestPinLsIndirect(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -282,7 +282,7 @@ func (tp *TestSuite) TestPinLsPrecedence(t *testing.T) { func (tp *TestSuite) TestPinLsPredenceRecursiveIndirect(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -306,7 +306,7 @@ func (tp *TestSuite) TestPinLsPredenceRecursiveIndirect(t *testing.T) { func (tp *TestSuite) TestPinLsPrecedenceDirectIndirect(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -330,7 +330,7 @@ func (tp *TestSuite) TestPinLsPrecedenceDirectIndirect(t *testing.T) { func (tp *TestSuite) TestPinLsPrecedenceRecursiveDirect(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -366,7 +366,7 @@ func (tp *TestSuite) TestPinLsPrecedenceRecursiveDirect(t *testing.T) { func (tp *TestSuite) TestPinIsPinned(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index 24a8ac3090b..8cbc6a3ebf4 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -24,7 +24,7 @@ func (tp *TestSuite) TestBasicPubSub(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, 2) + apis, err := tp.MakeAPISwarm(t, ctx, 2) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/routing.go b/core/coreiface/tests/routing.go index bf314cafe74..6fca1a0033b 100644 --- a/core/coreiface/tests/routing.go +++ b/core/coreiface/tests/routing.go @@ -43,7 +43,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, 2) + apis, err := tp.MakeAPISwarm(t, ctx, 2) if err != nil { t.Fatal(err) } @@ -72,7 +72,7 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) { func (tp *TestSuite) TestRoutingPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - apis, err := tp.MakeAPISwarm(ctx, 2) + apis, err := tp.MakeAPISwarm(t, ctx, 2) if err != nil { t.Fatal(err) } @@ -98,7 +98,7 @@ func (tp *TestSuite) TestRoutingPutOffline(t *testing.T) { defer cancel() // init a swarm & publish an IPNS entry to get a valid payload - apis, err := tp.MakeAPISwarm(ctx, 2) + apis, err := tp.MakeAPISwarm(t, ctx, 2) if err != nil { t.Fatal(err) } @@ -110,7 +110,7 @@ func (tp *TestSuite) TestRoutingPutOffline(t *testing.T) { } // init our offline node and try to put the payload - api, err := tp.makeAPIWithIdentityAndOffline(ctx) + api, err := tp.makeAPIWithIdentityAndOffline(t, ctx) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index cca42bb2805..2842b47bc5a 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -99,7 +99,7 @@ func wrapped(names ...string) func(f files.Node) files.Node { func (tp *TestSuite) TestAdd(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -533,7 +533,7 @@ func (tp *TestSuite) TestAdd(t *testing.T) { func (tp *TestSuite) TestAddPinned(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -559,7 +559,7 @@ func (tp *TestSuite) TestAddPinned(t *testing.T) { func (tp *TestSuite) TestAddHashOnly(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -585,7 +585,7 @@ func (tp *TestSuite) TestAddHashOnly(t *testing.T) { func (tp *TestSuite) TestGetEmptyFile(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -615,7 +615,7 @@ func (tp *TestSuite) TestGetEmptyFile(t *testing.T) { func (tp *TestSuite) TestGetDir(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -648,7 +648,7 @@ func (tp *TestSuite) TestGetDir(t *testing.T) { func (tp *TestSuite) TestGetNonUnixfs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -668,7 +668,7 @@ func (tp *TestSuite) TestGetNonUnixfs(t *testing.T) { func (tp *TestSuite) TestLs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -728,7 +728,7 @@ func (tp *TestSuite) TestLs(t *testing.T) { func (tp *TestSuite) TestEntriesExpired(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -770,7 +770,7 @@ func (tp *TestSuite) TestEntriesExpired(t *testing.T) { func (tp *TestSuite) TestLsEmptyDir(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -799,7 +799,7 @@ func (tp *TestSuite) TestLsEmptyDir(t *testing.T) { func (tp *TestSuite) TestLsNonUnixfs(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -858,7 +858,7 @@ func (f *closeTestF) Close() error { func (tp *TestSuite) TestAddCloses(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -896,7 +896,7 @@ func (tp *TestSuite) TestAddCloses(t *testing.T) { func (tp *TestSuite) TestGetSeek(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } @@ -1002,7 +1002,7 @@ func (tp *TestSuite) TestGetSeek(t *testing.T) { func (tp *TestSuite) TestGetReadAt(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(ctx) + api, err := tp.makeAPI(t, ctx) if err != nil { t.Fatal(err) } From 0134124cdd62b2437b3888e9bd240a5a59de9962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Fri, 2 Jun 2023 16:49:03 +0200 Subject: [PATCH 251/286] pinner: change the interface to have async pin listing The rational is that if the pin list get big, a synchronous call to get the complete list can delay handling unnecessarily. For example, when listing indirect pins, you can start walking the DAGs immediately with the first recursive pin instead of waiting for the full list. This matters even more on low power device, of if the pin list is stored remotely. * coreiface: allow to return an error not linked to a specific Cid * merkledag/test: add a DAG generator Rationale is that generating a test DAG is quite difficult, and anything that helps writing better tests is helpful. This commit was moved from ipfs/boxo@e2fc7f2fd0237afad200d7b0eec8b7a60bdc6644 --- core/coreiface/pin.go | 3 +++ core/coreiface/tests/pin.go | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index ba5df5354dc..6b97c6ca53c 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -27,6 +27,9 @@ type PinStatus interface { // BadNodes returns any bad (usually missing) nodes from the pin BadNodes() []BadPinNode + + // if not nil, an error happened. Everything else should be ignored. + Err() error } // BadPinNode is a node that has been marked as bad by Pin.Verify diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index bbf60299470..4b0fea01d9c 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -198,6 +198,9 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { } n := 0 for r := range res { + if err := r.Err(); err != nil { + t.Error(err) + } if !r.Ok() { t.Error("expected pin to be ok") } @@ -208,7 +211,7 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected verify result count: %d", n) } - //TODO: figure out a way to test verify without touching IpfsNode + // TODO: figure out a way to test verify without touching IpfsNode /* err = api.Block().Rm(ctx, p0, opt.Block.Force(true)) if err != nil { From d6464864cbff0cc96d4cb11b292daba77c2366d1 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Tue, 20 Jun 2023 14:08:22 +0200 Subject: [PATCH 252/286] feat(ipns): refactored IPNS package with lean records (#339) This commit was moved from ipfs/boxo@417c5f7d61ff5dcf0fef88b19dde54c8d5097a0f --- core/coreiface/name.go | 11 +- core/coreiface/options/name.go | 20 ++- core/coreiface/options/namesys/opts.go | 12 +- core/coreiface/tests/name.go | 217 +++++++------------------ core/coreiface/tests/routing.go | 99 ++++------- 5 files changed, 117 insertions(+), 242 deletions(-) diff --git a/core/coreiface/name.go b/core/coreiface/name.go index 0c06183e694..8c3e8e89a4d 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -5,20 +5,13 @@ import ( "errors" path "github.com/ipfs/boxo/coreiface/path" + "github.com/ipfs/boxo/ipns" "github.com/ipfs/boxo/coreiface/options" ) var ErrResolveFailed = errors.New("could not resolve name") -// IpnsEntry specifies the interface to IpnsEntries -type IpnsEntry interface { - // Name returns IpnsEntry name - Name() string - // Value returns IpnsEntry value - Value() path.Path -} - type IpnsResult struct { path.Path Err error @@ -34,7 +27,7 @@ type IpnsResult struct { // You can use .Key API to list and generate more names and their respective keys. type NameAPI interface { // Publish announces new IPNS name - Publish(ctx context.Context, path path.Path, opts ...options.NamePublishOption) (IpnsEntry, error) + Publish(ctx context.Context, path path.Path, opts ...options.NamePublishOption) (ipns.Name, error) // Resolve attempts to resolve the newest version of the specified name Resolve(ctx context.Context, name string, opts ...options.NameResolveOption) (path.Path, error) diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index ae8be9ae9ea..8e9b5183d65 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -11,12 +11,11 @@ const ( ) type NamePublishSettings struct { - ValidTime time.Duration - Key string - - TTL *time.Duration - - AllowOffline bool + ValidTime time.Duration + Key string + TTL *time.Duration + CompatibleWithV1 bool + AllowOffline bool } type NameResolveSettings struct { @@ -104,6 +103,15 @@ func (nameOpts) TTL(ttl time.Duration) NamePublishOption { } } +// CompatibleWithV1 is an option for [Name.Publish] which specifies if the +// created record should be backwards compatible with V1 IPNS Records. +func (nameOpts) CompatibleWithV1(compatible bool) NamePublishOption { + return func(settings *NamePublishSettings) error { + settings.CompatibleWithV1 = compatible + return nil + } +} + // Cache is an option for Name.Resolve which specifies if cache should be used. // Default value is true func (nameOpts) Cache(cache bool) NameResolveOption { diff --git a/core/coreiface/options/namesys/opts.go b/core/coreiface/options/namesys/opts.go index 0cd1ba7781f..ed568200b3d 100644 --- a/core/coreiface/options/namesys/opts.go +++ b/core/coreiface/options/namesys/opts.go @@ -84,8 +84,9 @@ func ProcessOpts(opts []ResolveOpt) ResolveOpts { // PublishOptions specifies options for publishing an IPNS record. type PublishOptions struct { - EOL time.Time - TTL time.Duration + EOL time.Time + TTL time.Duration + CompatibleWithV1 bool } // DefaultPublishOptions returns the default options for publishing an IPNS record. @@ -113,6 +114,13 @@ func PublishWithTTL(ttl time.Duration) PublishOption { } } +// PublishCompatibleWithV1 sets compatibility with IPNS Records V1. +func PublishCompatibleWithV1(compatible bool) PublishOption { + return func(o *PublishOptions) { + o.CompatibleWithV1 = compatible + } +} + // ProcessPublishOptions converts an array of PublishOpt into a PublishOpts object. func ProcessPublishOptions(opts []PublishOption) PublishOptions { rsopts := DefaultPublishOptions() diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 8fa733567bd..ab55d0425a2 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -8,12 +8,12 @@ import ( "testing" "time" - path "github.com/ipfs/boxo/coreiface/path" - - "github.com/ipfs/boxo/files" - coreiface "github.com/ipfs/boxo/coreiface" opt "github.com/ipfs/boxo/coreiface/options" + path "github.com/ipfs/boxo/coreiface/path" + "github.com/ipfs/boxo/files" + "github.com/ipfs/boxo/ipns" + "github.com/stretchr/testify/require" ) func (tp *TestSuite) TestName(t *testing.T) { @@ -44,138 +44,68 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { defer cancel() init := func() (coreiface.CoreAPI, path.Path) { apis, err := tp.MakeAPISwarm(t, ctx, 5) - if err != nil { - t.Fatal(err) - return nil, nil - } + require.NoError(t, err) api := apis[0] p, err := addTestObject(ctx, api) - if err != nil { - t.Fatal(err) - return nil, nil - } + require.NoError(t, err) return api, p } run := func(t *testing.T, ropts []opt.NameResolveOption) { t.Run("basic", func(t *testing.T) { api, p := init() - e, err := api.Name().Publish(ctx, p) - if err != nil { - t.Fatal(err) - } + name, err := api.Name().Publish(ctx, p) + require.NoError(t, err) self, err := api.Key().Self(ctx) - if err != nil { - t.Fatal(err) - } - - if e.Name() != coreiface.FormatKeyID(self.ID()) { - t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) - } - - if e.Value().String() != p.String() { - t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) - } - - resPath, err := api.Name().Resolve(ctx, e.Name(), ropts...) - if err != nil { - t.Fatal(err) - } - - if resPath.String() != p.String() { - t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()) - } + require.NoError(t, err) + require.Equal(t, name.String(), ipns.NameFromPeer(self.ID()).String()) + + resPath, err := api.Name().Resolve(ctx, name.String(), ropts...) + require.NoError(t, err) + require.Equal(t, p.String(), resPath.String()) }) t.Run("publishPath", func(t *testing.T) { api, p := init() - e, err := api.Name().Publish(ctx, appendPath(p, "/test")) - if err != nil { - t.Fatal(err) - } + name, err := api.Name().Publish(ctx, appendPath(p, "/test")) + require.NoError(t, err) self, err := api.Key().Self(ctx) - if err != nil { - t.Fatal(err) - } - - if e.Name() != coreiface.FormatKeyID(self.ID()) { - t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) - } - - if e.Value().String() != p.String()+"/test" { - t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) - } - - resPath, err := api.Name().Resolve(ctx, e.Name(), ropts...) - if err != nil { - t.Fatal(err) - } - - if resPath.String() != p.String()+"/test" { - t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()+"/test") - } + require.NoError(t, err) + require.Equal(t, name.String(), ipns.NameFromPeer(self.ID()).String()) + + resPath, err := api.Name().Resolve(ctx, name.String(), ropts...) + require.NoError(t, err) + require.Equal(t, p.String()+"/test", resPath.String()) }) t.Run("revolvePath", func(t *testing.T) { api, p := init() - e, err := api.Name().Publish(ctx, p) - if err != nil { - t.Fatal(err) - } + name, err := api.Name().Publish(ctx, p) + require.NoError(t, err) self, err := api.Key().Self(ctx) - if err != nil { - t.Fatal(err) - } - - if e.Name() != coreiface.FormatKeyID(self.ID()) { - t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) - } - - if e.Value().String() != p.String() { - t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) - } - - resPath, err := api.Name().Resolve(ctx, e.Name()+"/test", ropts...) - if err != nil { - t.Fatal(err) - } - - if resPath.String() != p.String()+"/test" { - t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()+"/test") - } + require.NoError(t, err) + require.Equal(t, name.String(), ipns.NameFromPeer(self.ID()).String()) + + resPath, err := api.Name().Resolve(ctx, name.String()+"/test", ropts...) + require.NoError(t, err) + require.Equal(t, p.String()+"/test", resPath.String()) }) t.Run("publishRevolvePath", func(t *testing.T) { api, p := init() - e, err := api.Name().Publish(ctx, appendPath(p, "/a")) - if err != nil { - t.Fatal(err) - } + name, err := api.Name().Publish(ctx, appendPath(p, "/a")) + require.NoError(t, err) self, err := api.Key().Self(ctx) - if err != nil { - t.Fatal(err) - } - - if e.Name() != coreiface.FormatKeyID(self.ID()) { - t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) - } - - if e.Value().String() != p.String()+"/a" { - t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) - } - - resPath, err := api.Name().Resolve(ctx, e.Name()+"/b", ropts...) - if err != nil { - t.Fatal(err) - } - - if resPath.String() != p.String()+"/a/b" { - t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()+"/a/b") - } + require.NoError(t, err) + require.Equal(t, name.String(), ipns.NameFromPeer(self.ID()).String()) + + resPath, err := api.Name().Resolve(ctx, name.String()+"/b", ropts...) + require.NoError(t, err) + require.Equal(t, p.String()+"/a/b", resPath.String()) }) } @@ -192,42 +122,22 @@ func (tp *TestSuite) TestBasicPublishResolveKey(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(t, ctx, 5) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) api := apis[0] k, err := api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) p, err := addTestObject(ctx, api) - if err != nil { - t.Fatal(err) - } - - e, err := api.Name().Publish(ctx, p, opt.Name.Key(k.Name())) - if err != nil { - t.Fatal(err) - } - - if e.Name() != coreiface.FormatKey(k) { - t.Errorf("expected e.Name to equal %s, got '%s'", e.Name(), coreiface.FormatKey(k)) - } - - if e.Value().String() != p.String() { - t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) - } + require.NoError(t, err) - resPath, err := api.Name().Resolve(ctx, e.Name()) - if err != nil { - t.Fatal(err) - } + name, err := api.Name().Publish(ctx, p, opt.Name.Key(k.Name())) + require.NoError(t, err) + require.Equal(t, name.String(), ipns.NameFromPeer(k.ID()).String()) - if resPath.String() != p.String() { - t.Errorf("expected paths to match, '%s'!='%s'", resPath.String(), p.String()) - } + resPath, err := api.Name().Resolve(ctx, name.String()) + require.NoError(t, err) + require.Equal(t, p.String(), resPath.String()) } func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { @@ -236,39 +146,22 @@ func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(t, ctx, 5) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) api := apis[0] p, err := addTestObject(ctx, api) - if err != nil { - t.Fatal(err) - } - - e, err := api.Name().Publish(ctx, p, opt.Name.ValidTime(time.Millisecond*100)) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) self, err := api.Key().Self(ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) - if e.Name() != coreiface.FormatKeyID(self.ID()) { - t.Errorf("expected e.Name to equal '%s', got '%s'", coreiface.FormatKeyID(self.ID()), e.Name()) - } - - if e.Value().String() != p.String() { - t.Errorf("expected paths to match, '%s'!='%s'", e.Value().String(), p.String()) - } + name, err := api.Name().Publish(ctx, p, opt.Name.ValidTime(time.Millisecond*100)) + require.NoError(t, err) + require.Equal(t, name.String(), ipns.NameFromPeer(self.ID()).String()) time.Sleep(time.Second) - _, err = api.Name().Resolve(ctx, e.Name()) - if err == nil { - t.Fatal("Expected an error") - } + _, err = api.Name().Resolve(ctx, name.String()) + require.NoError(t, err) } //TODO: When swarm api is created, add multinode tests diff --git a/core/coreiface/tests/routing.go b/core/coreiface/tests/routing.go index 6fca1a0033b..fd10dffcd2c 100644 --- a/core/coreiface/tests/routing.go +++ b/core/coreiface/tests/routing.go @@ -5,10 +5,11 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" iface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/coreiface/options" - ipns_pb "github.com/ipfs/boxo/ipns/pb" + "github.com/ipfs/boxo/coreiface/path" + "github.com/ipfs/boxo/ipns" + "github.com/stretchr/testify/require" ) func (tp *TestSuite) TestRouting(t *testing.T) { @@ -24,19 +25,15 @@ func (tp *TestSuite) TestRouting(t *testing.T) { t.Run("TestRoutingPutOffline", tp.TestRoutingPutOffline) } -func (tp *TestSuite) testRoutingPublishKey(t *testing.T, ctx context.Context, api iface.CoreAPI, opts ...options.NamePublishOption) iface.IpnsEntry { +func (tp *TestSuite) testRoutingPublishKey(t *testing.T, ctx context.Context, api iface.CoreAPI, opts ...options.NamePublishOption) (path.Path, ipns.Name) { p, err := addTestObject(ctx, api) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) - entry, err := api.Name().Publish(ctx, p, opts...) - if err != nil { - t.Fatal(err) - } + name, err := api.Name().Publish(ctx, p, opts...) + require.NoError(t, err) time.Sleep(3 * time.Second) - return entry + return p, name } func (tp *TestSuite) TestRoutingGet(t *testing.T) { @@ -44,53 +41,39 @@ func (tp *TestSuite) TestRoutingGet(t *testing.T) { defer cancel() apis, err := tp.MakeAPISwarm(t, ctx, 2) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) // Node 1: publishes an IPNS name - ipnsEntry := tp.testRoutingPublishKey(t, ctx, apis[0]) + p, name := tp.testRoutingPublishKey(t, ctx, apis[0]) // Node 2: retrieves the best value for the IPNS name. - data, err := apis[1].Routing().Get(ctx, "/ipns/"+ipnsEntry.Name()) - if err != nil { - t.Fatal(err) - } - - // Checks if values match. - var entry ipns_pb.IpnsEntry - err = proto.Unmarshal(data, &entry) - if err != nil { - t.Fatal(err) - } - - if string(entry.GetValue()) != ipnsEntry.Value().String() { - t.Fatalf("routing key has wrong value, expected %s, got %s", ipnsEntry.Value().String(), string(entry.GetValue())) - } + data, err := apis[1].Routing().Get(ctx, ipns.NamespacePrefix+name.String()) + require.NoError(t, err) + + rec, err := ipns.UnmarshalRecord(data) + require.NoError(t, err) + + val, err := rec.Value() + require.NoError(t, err) + require.Equal(t, p.String(), val.String()) } func (tp *TestSuite) TestRoutingPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() apis, err := tp.MakeAPISwarm(t, ctx, 2) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) // Create and publish IPNS entry. - ipnsEntry := tp.testRoutingPublishKey(t, ctx, apis[0]) + _, name := tp.testRoutingPublishKey(t, ctx, apis[0]) // Get valid routing value. - data, err := apis[0].Routing().Get(ctx, "/ipns/"+ipnsEntry.Name()) - if err != nil { - t.Fatal(err) - } + data, err := apis[0].Routing().Get(ctx, ipns.NamespacePrefix+name.String()) + require.NoError(t, err) // Put routing value. - err = apis[1].Routing().Put(ctx, "/ipns/"+ipnsEntry.Name(), data) - if err != nil { - t.Fatal(err) - } + err = apis[1].Routing().Put(ctx, ipns.NamespacePrefix+name.String(), data) + require.NoError(t, err) } func (tp *TestSuite) TestRoutingPutOffline(t *testing.T) { @@ -99,29 +82,19 @@ func (tp *TestSuite) TestRoutingPutOffline(t *testing.T) { // init a swarm & publish an IPNS entry to get a valid payload apis, err := tp.MakeAPISwarm(t, ctx, 2) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) - ipnsEntry := tp.testRoutingPublishKey(t, ctx, apis[0], options.Name.AllowOffline(true)) - data, err := apis[0].Routing().Get(ctx, "/ipns/"+ipnsEntry.Name()) - if err != nil { - t.Fatal(err) - } + _, name := tp.testRoutingPublishKey(t, ctx, apis[0], options.Name.AllowOffline(true)) + data, err := apis[0].Routing().Get(ctx, ipns.NamespacePrefix+name.String()) + require.NoError(t, err) // init our offline node and try to put the payload api, err := tp.makeAPIWithIdentityAndOffline(t, ctx) - if err != nil { - t.Fatal(err) - } - - err = api.Routing().Put(ctx, "/ipns/"+ipnsEntry.Name(), data) - if err == nil { - t.Fatal("this operation should fail because we are offline") - } - - err = api.Routing().Put(ctx, "/ipns/"+ipnsEntry.Name(), data, options.Put.AllowOffline(true)) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) + + err = api.Routing().Put(ctx, ipns.NamespacePrefix+name.String(), data) + require.Error(t, err, "this operation should fail because we are offline") + + err = api.Routing().Put(ctx, ipns.NamespacePrefix+name.String(), data, options.Put.AllowOffline(true)) + require.NoError(t, err) } From 334308f532243a1a3f4ff5ab1a988c4a76b5891e Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 21 Aug 2023 10:01:00 +0200 Subject: [PATCH 253/286] style: run gofumpt This commit was moved from ipfs/boxo@c5a805eed56de5df9c8a220a4ce72b7bc3a0ae38 --- core/coreiface/options/block.go | 7 ++++--- core/coreiface/options/dht.go | 6 ++++-- core/coreiface/options/key.go | 6 ++++-- core/coreiface/options/name.go | 6 ++++-- core/coreiface/options/object.go | 8 +++++--- core/coreiface/options/pubsub.go | 6 ++++-- core/coreiface/options/unixfs.go | 6 ++++-- core/coreiface/tests/dag.go | 16 +++++++--------- core/coreiface/tests/name.go | 2 +- core/coreiface/tests/object.go | 2 +- core/coreiface/tests/unixfs.go | 8 +++++--- 11 files changed, 43 insertions(+), 30 deletions(-) diff --git a/core/coreiface/options/block.go b/core/coreiface/options/block.go index 130648682f9..83a43702cfb 100644 --- a/core/coreiface/options/block.go +++ b/core/coreiface/options/block.go @@ -17,8 +17,10 @@ type BlockRmSettings struct { Force bool } -type BlockPutOption func(*BlockPutSettings) error -type BlockRmOption func(*BlockRmSettings) error +type ( + BlockPutOption func(*BlockPutSettings) error + BlockRmOption func(*BlockRmSettings) error +) func BlockPutOptions(opts ...BlockPutOption) (*BlockPutSettings, error) { var cidPrefix cid.Prefix @@ -131,7 +133,6 @@ func (blockOpts) Format(format string) BlockPutOption { return nil } - } // Hash is an option for Block.Put which specifies the multihash settings to use diff --git a/core/coreiface/options/dht.go b/core/coreiface/options/dht.go index e13e1602006..b43bf3e7a75 100644 --- a/core/coreiface/options/dht.go +++ b/core/coreiface/options/dht.go @@ -8,8 +8,10 @@ type DhtFindProvidersSettings struct { NumProviders int } -type DhtProvideOption func(*DhtProvideSettings) error -type DhtFindProvidersOption func(*DhtFindProvidersSettings) error +type ( + DhtProvideOption func(*DhtProvideSettings) error + DhtFindProvidersOption func(*DhtFindProvidersSettings) error +) func DhtProvideOptions(opts ...DhtProvideOption) (*DhtProvideSettings, error) { options := &DhtProvideSettings{ diff --git a/core/coreiface/options/key.go b/core/coreiface/options/key.go index 4bc53a65fef..ebff6d5a767 100644 --- a/core/coreiface/options/key.go +++ b/core/coreiface/options/key.go @@ -16,8 +16,10 @@ type KeyRenameSettings struct { Force bool } -type KeyGenerateOption func(*KeyGenerateSettings) error -type KeyRenameOption func(*KeyRenameSettings) error +type ( + KeyGenerateOption func(*KeyGenerateSettings) error + KeyRenameOption func(*KeyRenameSettings) error +) func KeyGenerateOptions(opts ...KeyGenerateOption) (*KeyGenerateSettings, error) { options := &KeyGenerateSettings{ diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index 8e9b5183d65..35e78c394ec 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -24,8 +24,10 @@ type NameResolveSettings struct { ResolveOpts []ropts.ResolveOpt } -type NamePublishOption func(*NamePublishSettings) error -type NameResolveOption func(*NameResolveSettings) error +type ( + NamePublishOption func(*NamePublishSettings) error + NameResolveOption func(*NameResolveSettings) error +) func NamePublishOptions(opts ...NamePublishOption) (*NamePublishSettings, error) { options := &NamePublishSettings{ diff --git a/core/coreiface/options/object.go b/core/coreiface/options/object.go index e484a9f3632..b5625a1d61c 100644 --- a/core/coreiface/options/object.go +++ b/core/coreiface/options/object.go @@ -14,9 +14,11 @@ type ObjectAddLinkSettings struct { Create bool } -type ObjectNewOption func(*ObjectNewSettings) error -type ObjectPutOption func(*ObjectPutSettings) error -type ObjectAddLinkOption func(*ObjectAddLinkSettings) error +type ( + ObjectNewOption func(*ObjectNewSettings) error + ObjectPutOption func(*ObjectPutSettings) error + ObjectAddLinkOption func(*ObjectAddLinkSettings) error +) func ObjectNewOptions(opts ...ObjectNewOption) (*ObjectNewSettings, error) { options := &ObjectNewSettings{ diff --git a/core/coreiface/options/pubsub.go b/core/coreiface/options/pubsub.go index c387d613db4..839ef97b159 100644 --- a/core/coreiface/options/pubsub.go +++ b/core/coreiface/options/pubsub.go @@ -8,8 +8,10 @@ type PubSubSubscribeSettings struct { Discover bool } -type PubSubPeersOption func(*PubSubPeersSettings) error -type PubSubSubscribeOption func(*PubSubSubscribeSettings) error +type ( + PubSubPeersOption func(*PubSubPeersSettings) error + PubSubSubscribeOption func(*PubSubSubscribeSettings) error +) func PubSubPeersOptions(opts ...PubSubPeersOption) (*PubSubPeersSettings, error) { options := &PubSubPeersSettings{ diff --git a/core/coreiface/options/unixfs.go b/core/coreiface/options/unixfs.go index dd12502e611..f00fffb87b0 100644 --- a/core/coreiface/options/unixfs.go +++ b/core/coreiface/options/unixfs.go @@ -43,8 +43,10 @@ type UnixfsLsSettings struct { UseCumulativeSize bool } -type UnixfsAddOption func(*UnixfsAddSettings) error -type UnixfsLsOption func(*UnixfsLsSettings) error +type ( + UnixfsAddOption func(*UnixfsAddSettings) error + UnixfsLsOption func(*UnixfsLsSettings) error +) func UnixfsAddOptions(opts ...UnixfsAddOption) (*UnixfsAddSettings, cid.Prefix, error) { options := &UnixfsAddSettings{ diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index ba74031f963..b9a03c8f4c3 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -31,15 +31,13 @@ func (tp *TestSuite) TestDag(t *testing.T) { t.Run("TestBatch", tp.TestBatch) } -var ( - treeExpected = map[string]struct{}{ - "a": {}, - "b": {}, - "c": {}, - "c/d": {}, - "c/e": {}, - } -) +var treeExpected = map[string]struct{}{ + "a": {}, + "b": {}, + "c": {}, + "c/d": {}, + "c/e": {}, +} func (tp *TestSuite) TestPut(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index ab55d0425a2..74d88edff64 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -164,4 +164,4 @@ func (tp *TestSuite) TestBasicPublishResolveTimeout(t *testing.T) { require.NoError(t, err) } -//TODO: When swarm api is created, add multinode tests +// TODO: When swarm api is created, add multinode tests diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 77061b699f1..63c218eb36f 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -74,7 +74,7 @@ func (tp *TestSuite) TestObjectPut(t *testing.T) { t.Fatal(err) } - p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"YmFy"}`), opt.Object.DataType("base64")) //bar + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"YmFy"}`), opt.Object.DataType("base64")) // bar if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 2842b47bc5a..25c3ac1b76d 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -53,8 +53,10 @@ func (tp *TestSuite) TestUnixfs(t *testing.T) { } // `echo -n 'hello, world!' | ipfs add` -var hello = "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" -var helloStr = "hello, world!" +var ( + hello = "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" + helloStr = "hello, world!" +) // `echo -n | ipfs add` var emptyFile = "/ipfs/QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH" @@ -213,7 +215,7 @@ func (tp *TestSuite) TestAdd(t *testing.T) { path: "/ipfs/bafkqaaa", opts: []options.UnixfsAddOption{options.Unixfs.InlineLimit(0), options.Unixfs.Inline(true), options.Unixfs.RawLeaves(true)}, }, - { //TODO: after coreapi add is used in `ipfs add`, consider making this default for inline + { // TODO: after coreapi add is used in `ipfs add`, consider making this default for inline name: "addInlineRaw", data: strFile(helloStr), path: "/ipfs/bafkqadlimvwgy3zmeb3w64tmmqqq", From 5bac37c7351a5b70474ef2a5e426669bff86cfae Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 6 Oct 2023 16:04:23 +0200 Subject: [PATCH 254/286] feat(path)!: consolidated path libraries (#334) This commit was moved from ipfs/boxo@85c180e26664367f79de453c592020b4f279669f --- core/coreiface/block.go | 5 +- core/coreiface/coreapi.go | 9 +- core/coreiface/dht.go | 2 +- core/coreiface/key.go | 2 +- core/coreiface/name.go | 5 +- core/coreiface/object.go | 17 ++- core/coreiface/path/path.go | 199 ----------------------------- core/coreiface/pin.go | 6 +- core/coreiface/tests/block.go | 37 +++--- core/coreiface/tests/dag.go | 13 +- core/coreiface/tests/name.go | 21 ++-- core/coreiface/tests/object.go | 14 +-- core/coreiface/tests/path.go | 213 ++++++++++++-------------------- core/coreiface/tests/pin.go | 89 +++++++------ core/coreiface/tests/routing.go | 2 +- core/coreiface/tests/unixfs.go | 28 +++-- core/coreiface/unixfs.go | 11 +- 17 files changed, 216 insertions(+), 457 deletions(-) delete mode 100644 core/coreiface/path/path.go diff --git a/core/coreiface/block.go b/core/coreiface/block.go index dbe31e9f81a..cdd5fcee261 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -4,9 +4,8 @@ import ( "context" "io" - path "github.com/ipfs/boxo/coreiface/path" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/boxo/path" ) // BlockStat contains information about a block @@ -15,7 +14,7 @@ type BlockStat interface { Size() int // Path returns path to the block - Path() path.Resolved + Path() path.ImmutablePath } // BlockAPI specifies the interface to the block layer diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 7276a3f606a..25e54a37b72 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,9 +5,8 @@ package iface import ( "context" - path "github.com/ipfs/boxo/coreiface/path" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/boxo/path" ipld "github.com/ipfs/go-ipld-format" ) @@ -47,8 +46,10 @@ type CoreAPI interface { // Routing returns an implementation of Routing API Routing() RoutingAPI - // ResolvePath resolves the path using Unixfs resolver - ResolvePath(context.Context, path.Path) (path.Resolved, error) + // ResolvePath resolves the path using UnixFS resolver, and returns the resolved + // immutable path, and the remainder of the path segments that cannot be resolved + // within UnixFS. + ResolvePath(context.Context, path.Path) (path.ImmutablePath, []string, error) // ResolveNode resolves the path (if not resolved already) using Unixfs // resolver, gets and returns the resolved Node diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index 93027a4067c..d9418ebfc9b 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -3,7 +3,7 @@ package iface import ( "context" - "github.com/ipfs/boxo/coreiface/path" + "github.com/ipfs/boxo/path" "github.com/ipfs/boxo/coreiface/options" diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 118fe2e4fb9..4a1cbae80cf 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -3,7 +3,7 @@ package iface import ( "context" - "github.com/ipfs/boxo/coreiface/path" + "github.com/ipfs/boxo/path" "github.com/ipfs/boxo/coreiface/options" diff --git a/core/coreiface/name.go b/core/coreiface/name.go index 8c3e8e89a4d..f832033ef63 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -4,10 +4,9 @@ import ( "context" "errors" - path "github.com/ipfs/boxo/coreiface/path" - "github.com/ipfs/boxo/ipns" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/boxo/ipns" + "github.com/ipfs/boxo/path" ) var ErrResolveFailed = errors.New("could not resolve name") diff --git a/core/coreiface/object.go b/core/coreiface/object.go index d983fa49b65..4a73f22ea5d 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -4,9 +4,8 @@ import ( "context" "io" - path "github.com/ipfs/boxo/coreiface/path" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" @@ -60,11 +59,11 @@ type ObjectChange struct { // Before holds the link path before the change. Note that when a link is // added, this will be nil. - Before path.Resolved + Before path.ImmutablePath // After holds the link path after the change. Note that when a link is // removed, this will be nil. - After path.Resolved + After path.ImmutablePath } // ObjectAPI specifies the interface to MerkleDAG and contains useful utilities @@ -74,7 +73,7 @@ type ObjectAPI interface { New(context.Context, ...options.ObjectNewOption) (ipld.Node, error) // Put imports the data into merkledag - Put(context.Context, io.Reader, ...options.ObjectPutOption) (path.Resolved, error) + Put(context.Context, io.Reader, ...options.ObjectPutOption) (path.ImmutablePath, error) // Get returns the node for the path Get(context.Context, path.Path) (ipld.Node, error) @@ -91,16 +90,16 @@ type ObjectAPI interface { // AddLink adds a link under the specified path. child path can point to a // subdirectory within the patent which must be present (can be overridden // with WithCreate option). - AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...options.ObjectAddLinkOption) (path.Resolved, error) + AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...options.ObjectAddLinkOption) (path.ImmutablePath, error) // RmLink removes a link from the node - RmLink(ctx context.Context, base path.Path, link string) (path.Resolved, error) + RmLink(ctx context.Context, base path.Path, link string) (path.ImmutablePath, error) // AppendData appends data to the node - AppendData(context.Context, path.Path, io.Reader) (path.Resolved, error) + AppendData(context.Context, path.Path, io.Reader) (path.ImmutablePath, error) // SetData sets the data contained in the node - SetData(context.Context, path.Path, io.Reader) (path.Resolved, error) + SetData(context.Context, path.Path, io.Reader) (path.ImmutablePath, error) // Diff returns a set of changes needed to transform the first object into the // second. diff --git a/core/coreiface/path/path.go b/core/coreiface/path/path.go deleted file mode 100644 index c26b8692b05..00000000000 --- a/core/coreiface/path/path.go +++ /dev/null @@ -1,199 +0,0 @@ -package path - -import ( - "strings" - - ipfspath "github.com/ipfs/boxo/path" - cid "github.com/ipfs/go-cid" -) - -// Path is a generic wrapper for paths used in the API. A path can be resolved -// to a CID using one of Resolve functions in the API. -// -// Paths must be prefixed with a valid prefix: -// -// * /ipfs - Immutable unixfs path (files) -// * /ipld - Immutable ipld path (data) -// * /ipns - Mutable names. Usually resolves to one of the immutable paths -// TODO: /local (MFS) -type Path interface { - // String returns the path as a string. - String() string - - // Namespace returns the first component of the path. - // - // For example path "/ipfs/QmHash", calling Namespace() will return "ipfs" - // - // Calling this method on invalid paths (IsValid() != nil) will result in - // empty string - Namespace() string - - // Mutable returns false if the data pointed to by this path in guaranteed - // to not change. - // - // Note that resolved mutable path can be immutable. - Mutable() bool - - // IsValid checks if this path is a valid ipfs Path, returning nil iff it is - // valid - IsValid() error -} - -// Resolved is a path which was resolved to the last resolvable node. -// ResolvedPaths are guaranteed to return nil from `IsValid` -type Resolved interface { - // Cid returns the CID of the node referenced by the path. Remainder of the - // path is guaranteed to be within the node. - // - // Examples: - // If you have 3 linked objects: QmRoot -> A -> B: - // - // cidB := {"foo": {"bar": 42 }} - // cidA := {"B": {"/": cidB }} - // cidRoot := {"A": {"/": cidA }} - // - // And resolve paths: - // - // * "/ipfs/${cidRoot}" - // * Calling Cid() will return `cidRoot` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `` - // - // * "/ipfs/${cidRoot}/A" - // * Calling Cid() will return `cidA` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `` - // - // * "/ipfs/${cidRoot}/A/B/foo" - // * Calling Cid() will return `cidB` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `foo` - // - // * "/ipfs/${cidRoot}/A/B/foo/bar" - // * Calling Cid() will return `cidB` - // * Calling Root() will return `cidRoot` - // * Calling Remainder() will return `foo/bar` - Cid() cid.Cid - - // Root returns the CID of the root object of the path - // - // Example: - // If you have 3 linked objects: QmRoot -> A -> B, and resolve path - // "/ipfs/QmRoot/A/B", the Root method will return the CID of object QmRoot - // - // For more examples see the documentation of Cid() method - Root() cid.Cid - - // Remainder returns unresolved part of the path - // - // Example: - // If you have 2 linked objects: QmRoot -> A, where A is a CBOR node - // containing the following data: - // - // {"foo": {"bar": 42 }} - // - // When resolving "/ipld/QmRoot/A/foo/bar", Remainder will return "foo/bar" - // - // For more examples see the documentation of Cid() method - Remainder() string - - Path -} - -// path implements coreiface.Path -type path struct { - path string -} - -// resolvedPath implements coreiface.resolvedPath -type resolvedPath struct { - path - cid cid.Cid - root cid.Cid - remainder string -} - -// Join appends provided segments to the base path -func Join(base Path, a ...string) Path { - s := strings.Join(append([]string{base.String()}, a...), "/") - return &path{path: s} -} - -// IpfsPath creates new /ipfs path from the provided CID -func IpfsPath(c cid.Cid) Resolved { - return &resolvedPath{ - path: path{"/ipfs/" + c.String()}, - cid: c, - root: c, - remainder: "", - } -} - -// IpldPath creates new /ipld path from the provided CID -func IpldPath(c cid.Cid) Resolved { - return &resolvedPath{ - path: path{"/ipld/" + c.String()}, - cid: c, - root: c, - remainder: "", - } -} - -// New parses string path to a Path -func New(p string) Path { - if pp, err := ipfspath.ParsePath(p); err == nil { - p = pp.String() - } - - return &path{path: p} -} - -// NewResolvedPath creates new Resolved path. This function performs no checks -// and is intended to be used by resolver implementations. Incorrect inputs may -// cause panics. Handle with care. -func NewResolvedPath(ipath ipfspath.Path, c cid.Cid, root cid.Cid, remainder string) Resolved { - return &resolvedPath{ - path: path{ipath.String()}, - cid: c, - root: root, - remainder: remainder, - } -} - -func (p *path) String() string { - return p.path -} - -func (p *path) Namespace() string { - ip, err := ipfspath.ParsePath(p.path) - if err != nil { - return "" - } - - if len(ip.Segments()) < 1 { - panic("path without namespace") // this shouldn't happen under any scenario - } - return ip.Segments()[0] -} - -func (p *path) Mutable() bool { - // TODO: MFS: check for /local - return p.Namespace() == "ipns" -} - -func (p *path) IsValid() error { - _, err := ipfspath.ParsePath(p.path) - return err -} - -func (p *resolvedPath) Cid() cid.Cid { - return p.cid -} - -func (p *resolvedPath) Root() cid.Cid { - return p.root -} - -func (p *resolvedPath) Remainder() string { - return p.remainder -} diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 6b97c6ca53c..057516d08e4 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -3,7 +3,7 @@ package iface import ( "context" - path "github.com/ipfs/boxo/coreiface/path" + "github.com/ipfs/boxo/path" "github.com/ipfs/boxo/coreiface/options" ) @@ -11,7 +11,7 @@ import ( // Pin holds information about pinned resource type Pin interface { // Path to the pinned object - Path() path.Resolved + Path() path.ImmutablePath // Type of the pin Type() string @@ -35,7 +35,7 @@ type PinStatus interface { // BadPinNode is a node that has been marked as bad by Pin.Verify type BadPinNode interface { // Path is the path of the node - Path() path.Resolved + Path() path.ImmutablePath // Err is the reason why the node has been marked as bad Err() error diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 5dcb16e4f59..6e254063e18 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -9,9 +9,8 @@ import ( coreiface "github.com/ipfs/boxo/coreiface" opt "github.com/ipfs/boxo/coreiface/options" - "github.com/ipfs/boxo/coreiface/path" + "github.com/ipfs/boxo/path" ipld "github.com/ipfs/go-ipld-format" - mh "github.com/multiformats/go-multihash" ) @@ -68,8 +67,8 @@ func (tp *TestSuite) TestBlockPut(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != rawCid { - t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + if res.Path().RootCid().String() != rawCid { + t.Errorf("got wrong cid: %s", res.Path().RootCid().String()) } } @@ -88,8 +87,8 @@ func (tp *TestSuite) TestBlockPutFormatDagCbor(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != cborCid { - t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + if res.Path().RootCid().String() != cborCid { + t.Errorf("got wrong cid: %s", res.Path().RootCid().String()) } } @@ -108,8 +107,8 @@ func (tp *TestSuite) TestBlockPutFormatDagPb(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != pbCid { - t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + if res.Path().RootCid().String() != pbCid { + t.Errorf("got wrong cid: %s", res.Path().RootCid().String()) } } @@ -128,8 +127,8 @@ func (tp *TestSuite) TestBlockPutFormatV0(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != pbCidV0 { - t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + if res.Path().RootCid().String() != pbCidV0 { + t.Errorf("got wrong cid: %s", res.Path().RootCid().String()) } } @@ -146,8 +145,8 @@ func (tp *TestSuite) TestBlockPutCidCodecDagCbor(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != cborCid { - t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + if res.Path().RootCid().String() != cborCid { + t.Errorf("got wrong cid: %s", res.Path().RootCid().String()) } } @@ -164,8 +163,8 @@ func (tp *TestSuite) TestBlockPutCidCodecDagPb(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != pbCid { - t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + if res.Path().RootCid().String() != pbCid { + t.Errorf("got wrong cid: %s", res.Path().RootCid().String()) } } @@ -187,8 +186,8 @@ func (tp *TestSuite) TestBlockPutHash(t *testing.T) { t.Fatal(err) } - if res.Path().Cid().String() != cborKCid { - t.Errorf("got wrong cid: %s", res.Path().Cid().String()) + if res.Path().RootCid().String() != cborKCid { + t.Errorf("got wrong cid: %s", res.Path().RootCid().String()) } } @@ -219,13 +218,13 @@ func (tp *TestSuite) TestBlockGet(t *testing.T) { t.Error("didn't get correct data back") } - p := path.New("/ipfs/" + res.Path().Cid().String()) + p := path.FromCid(res.Path().RootCid()) - rp, err := api.ResolvePath(ctx, p) + rp, _, err := api.ResolvePath(ctx, p) if err != nil { t.Fatal(err) } - if rp.Cid().String() != res.Path().Cid().String() { + if rp.RootCid().String() != res.Path().RootCid().String() { t.Error("paths didn't match") } } diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index b9a03c8f4c3..a106788d6a2 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -3,13 +3,11 @@ package tests import ( "context" "math" - gopath "path" "strings" "testing" - path "github.com/ipfs/boxo/coreiface/path" - coreiface "github.com/ipfs/boxo/coreiface" + "github.com/ipfs/boxo/path" ipldcbor "github.com/ipfs/go-ipld-cbor" ipld "github.com/ipfs/go-ipld-format" @@ -113,14 +111,17 @@ func (tp *TestSuite) TestDagPath(t *testing.T) { t.Fatal(err) } - p := path.New(gopath.Join(nd.Cid().String(), "lnk")) + p, err := path.Join(path.FromCid(nd.Cid()), "lnk") + if err != nil { + t.Fatal(err) + } - rp, err := api.ResolvePath(ctx, p) + rp, _, err := api.ResolvePath(ctx, p) if err != nil { t.Fatal(err) } - ndd, err := api.Dag().Get(ctx, rp.Cid()) + ndd, err := api.Dag().Get(ctx, rp.RootCid()) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 74d88edff64..2b6b7ec49ab 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -4,15 +4,14 @@ import ( "context" "io" "math/rand" - gopath "path" "testing" "time" coreiface "github.com/ipfs/boxo/coreiface" opt "github.com/ipfs/boxo/coreiface/options" - path "github.com/ipfs/boxo/coreiface/path" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/ipns" + "github.com/ipfs/boxo/path" "github.com/stretchr/testify/require" ) @@ -35,10 +34,6 @@ func addTestObject(ctx context.Context, api coreiface.CoreAPI) (path.Path, error return api.Unixfs().Add(ctx, files.NewReaderFile(&io.LimitedReader{R: rnd, N: 4092})) } -func appendPath(p path.Path, sub string) path.Path { - return path.New(gopath.Join(p.String(), sub)) -} - func (tp *TestSuite) TestPublishResolve(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -68,7 +63,10 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { t.Run("publishPath", func(t *testing.T) { api, p := init() - name, err := api.Name().Publish(ctx, appendPath(p, "/test")) + p, err := path.Join(p, "/test") + require.NoError(t, err) + + name, err := api.Name().Publish(ctx, p) require.NoError(t, err) self, err := api.Key().Self(ctx) @@ -77,7 +75,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { resPath, err := api.Name().Resolve(ctx, name.String(), ropts...) require.NoError(t, err) - require.Equal(t, p.String()+"/test", resPath.String()) + require.Equal(t, p.String(), resPath.String()) }) t.Run("revolvePath", func(t *testing.T) { @@ -96,7 +94,10 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { t.Run("publishRevolvePath", func(t *testing.T) { api, p := init() - name, err := api.Name().Publish(ctx, appendPath(p, "/a")) + p, err := path.Join(p, "/a") + require.NoError(t, err) + + name, err := api.Name().Publish(ctx, p) require.NoError(t, err) self, err := api.Key().Self(ctx) @@ -105,7 +106,7 @@ func (tp *TestSuite) TestPublishResolve(t *testing.T) { resPath, err := api.Name().Resolve(ctx, name.String()+"/b", ropts...) require.NoError(t, err) - require.Equal(t, p.String()+"/a/b", resPath.String()) + require.Equal(t, p.String()+"/b", resPath.String()) }) } diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 63c218eb36f..5c6ba828c49 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -166,7 +166,7 @@ func (tp *TestSuite) TestObjectLinks(t *testing.T) { t.Fatal(err) } - p2, err := api.Object().Put(ctx, strings.NewReader(`{"Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`"}]}`)) + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Links":[{"Name":"bar", "Hash":"`+p1.RootCid().String()+`"}]}`)) if err != nil { t.Fatal(err) } @@ -180,7 +180,7 @@ func (tp *TestSuite) TestObjectLinks(t *testing.T) { t.Errorf("unexpected number of links: %d", len(links)) } - if links[0].Cid.String() != p1.Cid().String() { + if links[0].Cid.String() != p1.RootCid().String() { t.Fatal("cids didn't batch") } @@ -202,7 +202,7 @@ func (tp *TestSuite) TestObjectStat(t *testing.T) { t.Fatal(err) } - p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`", "Size":3}]}`)) + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.RootCid().String()+`", "Size":3}]}`)) if err != nil { t.Fatal(err) } @@ -212,7 +212,7 @@ func (tp *TestSuite) TestObjectStat(t *testing.T) { t.Fatal(err) } - if stat.Cid.String() != p2.Cid().String() { + if stat.Cid.String() != p2.RootCid().String() { t.Error("unexpected stat.Cid") } @@ -250,7 +250,7 @@ func (tp *TestSuite) TestObjectAddLink(t *testing.T) { t.Fatal(err) } - p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`", "Size":3}]}`)) + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.RootCid().String()+`", "Size":3}]}`)) if err != nil { t.Fatal(err) } @@ -291,7 +291,7 @@ func (tp *TestSuite) TestObjectAddLinkCreate(t *testing.T) { t.Fatal(err) } - p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`", "Size":3}]}`)) + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.RootCid().String()+`", "Size":3}]}`)) if err != nil { t.Fatal(err) } @@ -340,7 +340,7 @@ func (tp *TestSuite) TestObjectRmLink(t *testing.T) { t.Fatal(err) } - p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.Cid().String()+`", "Size":3}]}`)) + p2, err := api.Object().Put(ctx, strings.NewReader(`{"Data":"bazz", "Links":[{"Name":"bar", "Hash":"`+p1.RootCid().String()+`", "Size":3}]}`)) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 06f3aa1f808..116aed2e73d 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -2,17 +2,26 @@ package tests import ( "context" + "fmt" "math" "strings" "testing" - "github.com/ipfs/boxo/coreiface/path" - "github.com/ipfs/boxo/coreiface/options" - + "github.com/ipfs/boxo/path" + "github.com/ipfs/go-cid" ipldcbor "github.com/ipfs/go-ipld-cbor" + "github.com/stretchr/testify/require" ) +func newIPLDPath(t *testing.T, cid cid.Cid) path.ImmutablePath { + p, err := path.NewPath(fmt.Sprintf("/%s/%s", path.IPLDNamespace, cid.String())) + require.NoError(t, err) + im, err := path.NewImmutablePath(p) + require.NoError(t, err) + return im +} + func (tp *TestSuite) TestPath(t *testing.T) { t.Run("TestMutablePath", tp.TestMutablePath) t.Run("TestPathRemainder", tp.TestPathRemainder) @@ -25,173 +34,115 @@ func (tp *TestSuite) TestPath(t *testing.T) { func (tp *TestSuite) TestMutablePath(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) blk, err := api.Block().Put(ctx, strings.NewReader(`foo`)) - if err != nil { - t.Fatal(err) - } - - if blk.Path().Mutable() { - t.Error("expected /ipld path to be immutable") - } - - // get self /ipns path - - if api.Key() == nil { - t.Fatal(".Key not implemented") - } + require.NoError(t, err) + require.False(t, blk.Path().Mutable()) + require.NotNil(t, api.Key()) keys, err := api.Key().List(ctx) - if err != nil { - t.Fatal(err) - } - - if !keys[0].Path().Mutable() { - t.Error("expected self /ipns path to be mutable") - } + require.NoError(t, err) + require.True(t, keys[0].Path().Mutable()) } func (tp *TestSuite) TestPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } - if api.Dag() == nil { - t.Fatal(".Dag not implemented") - } + api, err := tp.makeAPI(t, ctx) + require.NoError(t, err) + require.NotNil(t, api.Dag()) nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) - if err != nil { - t.Fatal(err) - } - - if err := api.Dag().Add(ctx, nd); err != nil { - t.Fatal(err) - } - - rp1, err := api.ResolvePath(ctx, path.New(nd.String()+"/foo/bar")) - if err != nil { - t.Fatal(err) - } - - if rp1.Remainder() != "foo/bar" { - t.Error("expected to get path remainder") - } + require.NoError(t, err) + + err = api.Dag().Add(ctx, nd) + require.NoError(t, err) + + p, err := path.Join(path.FromCid(nd.Cid()), "foo", "bar") + require.NoError(t, err) + + _, remainder, err := api.ResolvePath(ctx, p) + require.NoError(t, err) + require.Equal(t, "/foo/bar", path.SegmentsToString(remainder...)) } func (tp *TestSuite) TestEmptyPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } - if api.Dag() == nil { - t.Fatal(".Dag not implemented") - } + api, err := tp.makeAPI(t, ctx) + require.NoError(t, err) + require.NotNil(t, api.Dag()) nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) - if err != nil { - t.Fatal(err) - } - - if err := api.Dag().Add(ctx, nd); err != nil { - t.Fatal(err) - } - - rp1, err := api.ResolvePath(ctx, path.New(nd.Cid().String())) - if err != nil { - t.Fatal(err) - } - - if rp1.Remainder() != "" { - t.Error("expected the resolved path to not have a remainder") - } + require.NoError(t, err) + + err = api.Dag().Add(ctx, nd) + require.NoError(t, err) + + _, remainder, err := api.ResolvePath(ctx, path.FromCid(nd.Cid())) + require.NoError(t, err) + require.Empty(t, remainder) } func (tp *TestSuite) TestInvalidPathRemainder(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } - if api.Dag() == nil { - t.Fatal(".Dag not implemented") - } + api, err := tp.makeAPI(t, ctx) + require.NoError(t, err) + require.NotNil(t, api.Dag()) nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"bar": "baz"}}`), math.MaxUint64, -1) - if err != nil { - t.Fatal(err) - } - - if err := api.Dag().Add(ctx, nd); err != nil { - t.Fatal(err) - } - - _, err = api.ResolvePath(ctx, path.New("/ipld/"+nd.Cid().String()+"/bar/baz")) - if err == nil || !strings.Contains(err.Error(), `no link named "bar"`) { - t.Fatalf("unexpected error: %s", err) - } + require.NoError(t, err) + + err = api.Dag().Add(ctx, nd) + require.NoError(t, err) + + p, err := path.Join(newIPLDPath(t, nd.Cid()), "/bar/baz") + require.NoError(t, err) + + _, _, err = api.ResolvePath(ctx, p) + require.NotNil(t, err) + require.ErrorContains(t, err, `no link named "bar"`) } func (tp *TestSuite) TestPathRoot(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } - if api.Block() == nil { - t.Fatal(".Block not implemented") - } + api, err := tp.makeAPI(t, ctx) + require.NoError(t, err) + require.NotNil(t, api.Block()) blk, err := api.Block().Put(ctx, strings.NewReader(`foo`), options.Block.Format("raw")) - if err != nil { - t.Fatal(err) - } - - if api.Dag() == nil { - t.Fatal(".Dag not implemented") - } - - nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"/": "`+blk.Path().Cid().String()+`"}}`), math.MaxUint64, -1) - if err != nil { - t.Fatal(err) - } - - if err := api.Dag().Add(ctx, nd); err != nil { - t.Fatal(err) - } - - rp, err := api.ResolvePath(ctx, path.New("/ipld/"+nd.Cid().String()+"/foo")) - if err != nil { - t.Fatal(err) - } - - if rp.Root().String() != nd.Cid().String() { - t.Error("unexpected path root") - } - - if rp.Cid().String() != blk.Path().Cid().String() { - t.Error("unexpected path cid") - } + require.NoError(t, err) + require.NotNil(t, api.Dag()) + + nd, err := ipldcbor.FromJSON(strings.NewReader(`{"foo": {"/": "`+blk.Path().RootCid().String()+`"}}`), math.MaxUint64, -1) + require.NoError(t, err) + + err = api.Dag().Add(ctx, nd) + require.NoError(t, err) + + p, err := path.Join(newIPLDPath(t, nd.Cid()), "/foo") + require.NoError(t, err) + + rp, _, err := api.ResolvePath(ctx, p) + require.NoError(t, err) + require.Equal(t, rp.RootCid().String(), blk.Path().RootCid().String()) } func (tp *TestSuite) TestPathJoin(t *testing.T) { - p1 := path.New("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") + p1, err := path.NewPath("/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz") + require.NoError(t, err) + + p2, err := path.Join(p1, "foo") + require.NoError(t, err) - if path.Join(p1, "foo").String() != "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo" { - t.Error("unexpected path") - } + require.Equal(t, "/ipfs/QmYNmQKp6SuaVrpgWRsPTgCQCnpxUYGq76YEKBXuj2N4H6/bar/baz/foo", p2.String()) } diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 4b0fea01d9c..49499b36acc 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -8,8 +8,7 @@ import ( iface "github.com/ipfs/boxo/coreiface" opt "github.com/ipfs/boxo/coreiface/options" - "github.com/ipfs/boxo/coreiface/path" - + "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" ipldcbor "github.com/ipfs/go-ipld-cbor" ipld "github.com/ipfs/go-ipld-format" @@ -77,7 +76,7 @@ func (tp *TestSuite) TestPinSimple(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().Cid().String() != p.Cid().String() { + if list[0].Path().RootCid().String() != p.RootCid().String() { t.Error("paths don't match") } @@ -120,12 +119,12 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Fatal(err) } - nd2, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+p0.Cid().String()+`"}}`), math.MaxUint64, -1) + nd2, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+p0.RootCid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Fatal(err) } - nd3, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+p1.Cid().String()+`"}}`), math.MaxUint64, -1) + nd3, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+p1.RootCid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Fatal(err) } @@ -134,12 +133,12 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Fatal(err) } - err = api.Pin().Add(ctx, path.IpldPath(nd2.Cid())) + err = api.Pin().Add(ctx, path.FromCid(nd2.Cid())) if err != nil { t.Fatal(err) } - err = api.Pin().Add(ctx, path.IpldPath(nd3.Cid()), opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, path.FromCid(nd3.Cid()), opt.Pin.Recursive(false)) if err != nil { t.Fatal(err) } @@ -162,8 +161,8 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().String() != path.IpldPath(nd3.Cid()).String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpfsPath(nd3.Cid()).String()) + if list[0].Path().String() != path.FromCid(nd3.Cid()).String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.FromCid(nd3.Cid()).String()) } list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Ls.Recursive())) @@ -175,8 +174,8 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().String() != path.IpldPath(nd2.Cid()).String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.IpldPath(nd2.Cid()).String()) + if list[0].Path().String() != path.FromCid(nd2.Cid()).String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().String(), path.FromCid(nd2.Cid()).String()) } list, err = accPins(api.Pin().Ls(ctx, opt.Pin.Ls.Indirect())) @@ -188,8 +187,8 @@ func (tp *TestSuite) TestPinRecursive(t *testing.T) { t.Errorf("unexpected pin list len: %d", len(list)) } - if list[0].Path().Cid().String() != p0.Cid().String() { - t.Errorf("unexpected path, %s != %s", list[0].Path().Cid().String(), p0.Cid().String()) + if list[0].Path().RootCid().String() != p0.RootCid().String() { + t.Errorf("unexpected path, %s != %s", list[0].Path().RootCid().String(), p0.RootCid().String()) } res, err := api.Pin().Verify(ctx) @@ -259,12 +258,12 @@ func (tp *TestSuite) TestPinLsIndirect(t *testing.T) { leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "foo") - err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid())) + err = api.Pin().Add(ctx, path.FromCid(grandparent.Cid())) if err != nil { t.Fatal(err) } - err = api.Pin().Add(ctx, path.IpldPath(parent.Cid()), opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, path.FromCid(parent.Cid()), opt.Pin.Recursive(false)) if err != nil { t.Fatal(err) } @@ -293,12 +292,12 @@ func (tp *TestSuite) TestPinLsPredenceRecursiveIndirect(t *testing.T) { // Test recursive > indirect leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "recursive > indirect") - err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid())) + err = api.Pin().Add(ctx, path.FromCid(grandparent.Cid())) if err != nil { t.Fatal(err) } - err = api.Pin().Add(ctx, path.IpldPath(parent.Cid())) + err = api.Pin().Add(ctx, path.FromCid(parent.Cid())) if err != nil { t.Fatal(err) } @@ -317,12 +316,12 @@ func (tp *TestSuite) TestPinLsPrecedenceDirectIndirect(t *testing.T) { // Test direct > indirect leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "direct > indirect") - err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid())) + err = api.Pin().Add(ctx, path.FromCid(grandparent.Cid())) if err != nil { t.Fatal(err) } - err = api.Pin().Add(ctx, path.IpldPath(parent.Cid()), opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, path.FromCid(parent.Cid()), opt.Pin.Recursive(false)) if err != nil { t.Fatal(err) } @@ -341,24 +340,24 @@ func (tp *TestSuite) TestPinLsPrecedenceRecursiveDirect(t *testing.T) { // Test recursive > direct leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "recursive + direct = error") - err = api.Pin().Add(ctx, path.IpldPath(parent.Cid())) + err = api.Pin().Add(ctx, path.FromCid(parent.Cid())) if err != nil { t.Fatal(err) } - err = api.Pin().Add(ctx, path.IpldPath(parent.Cid()), opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, path.FromCid(parent.Cid()), opt.Pin.Recursive(false)) if err == nil { t.Fatal("expected error directly pinning a recursively pinned node") } assertPinTypes(t, ctx, api, []cidContainer{parent}, []cidContainer{}, []cidContainer{leaf}) - err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid()), opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, path.FromCid(grandparent.Cid()), opt.Pin.Recursive(false)) if err != nil { t.Fatal(err) } - err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid())) + err = api.Pin().Add(ctx, path.FromCid(grandparent.Cid())) if err != nil { t.Fatal(err) } @@ -376,40 +375,48 @@ func (tp *TestSuite) TestPinIsPinned(t *testing.T) { leaf, parent, grandparent := getThreeChainedNodes(t, ctx, api, "foofoo") - assertNotPinned(t, ctx, api, path.IpldPath(grandparent.Cid())) - assertNotPinned(t, ctx, api, path.IpldPath(parent.Cid())) - assertNotPinned(t, ctx, api, path.IpldPath(leaf.Cid())) + assertNotPinned(t, ctx, api, newIPLDPath(t, grandparent.Cid())) + assertNotPinned(t, ctx, api, newIPLDPath(t, parent.Cid())) + assertNotPinned(t, ctx, api, newIPLDPath(t, leaf.Cid())) - err = api.Pin().Add(ctx, path.IpldPath(parent.Cid()), opt.Pin.Recursive(true)) + err = api.Pin().Add(ctx, newIPLDPath(t, parent.Cid()), opt.Pin.Recursive(true)) if err != nil { t.Fatal(err) } - assertNotPinned(t, ctx, api, path.IpldPath(grandparent.Cid())) - assertIsPinned(t, ctx, api, path.IpldPath(parent.Cid()), "recursive") - assertIsPinned(t, ctx, api, path.IpldPath(leaf.Cid()), "indirect") + assertNotPinned(t, ctx, api, newIPLDPath(t, grandparent.Cid())) + assertIsPinned(t, ctx, api, newIPLDPath(t, parent.Cid()), "recursive") + assertIsPinned(t, ctx, api, newIPLDPath(t, leaf.Cid()), "indirect") - err = api.Pin().Add(ctx, path.IpldPath(grandparent.Cid()), opt.Pin.Recursive(false)) + err = api.Pin().Add(ctx, newIPLDPath(t, grandparent.Cid()), opt.Pin.Recursive(false)) if err != nil { t.Fatal(err) } - assertIsPinned(t, ctx, api, path.IpldPath(grandparent.Cid()), "direct") - assertIsPinned(t, ctx, api, path.IpldPath(parent.Cid()), "recursive") - assertIsPinned(t, ctx, api, path.IpldPath(leaf.Cid()), "indirect") + assertIsPinned(t, ctx, api, newIPLDPath(t, grandparent.Cid()), "direct") + assertIsPinned(t, ctx, api, newIPLDPath(t, parent.Cid()), "recursive") + assertIsPinned(t, ctx, api, newIPLDPath(t, leaf.Cid()), "indirect") } type cidContainer interface { Cid() cid.Cid } +type immutablePathCidContainer struct { + path.ImmutablePath +} + +func (i immutablePathCidContainer) Cid() cid.Cid { + return i.RootCid() +} + func getThreeChainedNodes(t *testing.T, ctx context.Context, api iface.CoreAPI, leafData string) (cidContainer, cidContainer, cidContainer) { leaf, err := api.Unixfs().Add(ctx, strFile(leafData)()) if err != nil { t.Fatal(err) } - parent, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+leaf.Cid().String()+`"}}`), math.MaxUint64, -1) + parent, err := ipldcbor.FromJSON(strings.NewReader(`{"lnk": {"/": "`+leaf.RootCid().String()+`"}}`), math.MaxUint64, -1) if err != nil { t.Fatal(err) } @@ -423,7 +430,7 @@ func getThreeChainedNodes(t *testing.T, ctx context.Context, api iface.CoreAPI, t.Fatal(err) } - return leaf, parent, grandparent + return immutablePathCidContainer{leaf}, parent, grandparent } func assertPinTypes(t *testing.T, ctx context.Context, api iface.CoreAPI, recusive, direct, indirect []cidContainer) { @@ -466,7 +473,7 @@ func assertPinCids(t *testing.T, pins []iface.Pin, cids ...cidContainer) { valid := true for _, p := range pins { - c := p.Path().Cid() + c := p.Path().RootCid() if cSet.Has(c) { cSet.Remove(c) } else { @@ -480,7 +487,7 @@ func assertPinCids(t *testing.T, pins []iface.Pin, cids ...cidContainer) { if !valid { pinStrs := make([]string, len(pins)) for i, p := range pins { - pinStrs[i] = p.Path().Cid().String() + pinStrs[i] = p.Path().RootCid().String() } pathStrs := make([]string, len(cids)) for i, c := range cids { @@ -511,13 +518,13 @@ func assertPinLsAllConsistency(t *testing.T, ctx context.Context, api iface.Core } for _, p := range allPins { - if !all.Visit(p.Path().Cid()) { + if !all.Visit(p.Path().RootCid()) { t.Fatalf("pin ls returned the same cid multiple times") } typeStr := p.Type() if typeSet, ok := typeMap[p.Type()]; ok { - typeSet.Add(p.Path().Cid()) + typeSet.Add(p.Path().RootCid()) } else { t.Fatalf("unknown pin type: %s", typeStr) } @@ -538,7 +545,7 @@ func assertPinLsAllConsistency(t *testing.T, ctx context.Context, api iface.Core t.Fatalf("returned wrong pin type: expected %s, got %s", typeStr, pinType) } - if c := p.Path().Cid(); !pinProps.Has(c) { + if c := p.Path().RootCid(); !pinProps.Has(c) { t.Fatalf("%s expected to be in pin ls all as type %s", c.String(), typeStr) } } diff --git a/core/coreiface/tests/routing.go b/core/coreiface/tests/routing.go index fd10dffcd2c..c56e9165984 100644 --- a/core/coreiface/tests/routing.go +++ b/core/coreiface/tests/routing.go @@ -7,8 +7,8 @@ import ( iface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/coreiface/options" - "github.com/ipfs/boxo/coreiface/path" "github.com/ipfs/boxo/ipns" + "github.com/ipfs/boxo/path" "github.com/stretchr/testify/require" ) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 25c3ac1b76d..e0c37fce4b2 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -14,10 +14,9 @@ import ( "sync" "testing" - "github.com/ipfs/boxo/coreiface/path" - coreiface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/boxo/path" "github.com/ipfs/boxo/files" mdag "github.com/ipfs/boxo/ipld/merkledag" @@ -106,12 +105,12 @@ func (tp *TestSuite) TestAdd(t *testing.T) { t.Fatal(err) } - p := func(h string) path.Resolved { + p := func(h string) path.ImmutablePath { c, err := cid.Parse(h) if err != nil { t.Fatal(err) } - return path.IpfsPath(c) + return path.FromCid(c) } rf, err := os.CreateTemp(os.TempDir(), "unixfs-add-real") @@ -410,7 +409,7 @@ func (tp *TestSuite) TestAdd(t *testing.T) { } if expected[0].Path != nil && event.Path != nil { - if expected[0].Path.Cid().String() != event.Path.Cid().String() { + if expected[0].Path.RootCid().String() != event.Path.RootCid().String() { t.Errorf("Event.Hash didn't match, %s != %s", expected[0].Path, event.Path) } } else if event.Path != expected[0].Path { @@ -553,7 +552,7 @@ func (tp *TestSuite) TestAddPinned(t *testing.T) { t.Fatalf("expected 1 pin, got %d", len(pins)) } - if pins[0].Path().String() != "/ipld/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" { + if pins[0].Path().String() != "/ipfs/QmQy2Dw4Wk7rdJKjThjYXzfFJNaRKRHhHP5gHHXroJMYxk" { t.Fatalf("got unexpected pin: %s", pins[0].Path().String()) } } @@ -597,7 +596,10 @@ func (tp *TestSuite) TestGetEmptyFile(t *testing.T) { t.Fatal(err) } - emptyFilePath := path.New(emptyFile) + emptyFilePath, err := path.NewPath(emptyFile) + if err != nil { + t.Fatal(err) + } r, err := api.Unixfs().Get(ctx, emptyFilePath) if err != nil { @@ -626,18 +628,18 @@ func (tp *TestSuite) TestGetDir(t *testing.T) { if err != nil { t.Fatal(err) } - p := path.IpfsPath(edir.Cid()) + p := path.FromCid(edir.Cid()) emptyDir, err := api.Object().New(ctx, options.Object.Type("unixfs-dir")) if err != nil { t.Fatal(err) } - if p.String() != path.IpfsPath(emptyDir.Cid()).String() { + if p.String() != path.FromCid(emptyDir.Cid()).String() { t.Fatalf("expected path %s, got: %s", emptyDir.Cid(), p.String()) } - r, err := api.Unixfs().Get(ctx, path.IpfsPath(emptyDir.Cid())) + r, err := api.Unixfs().Get(ctx, path.FromCid(emptyDir.Cid())) if err != nil { t.Fatal(err) } @@ -661,7 +663,7 @@ func (tp *TestSuite) TestGetNonUnixfs(t *testing.T) { t.Fatal(err) } - _, err = api.Unixfs().Get(ctx, path.IpfsPath(nd.Cid())) + _, err = api.Unixfs().Get(ctx, path.FromCid(nd.Cid())) if !strings.Contains(err.Error(), "proto: required field") { t.Fatalf("expected protobuf error, got: %s", err) } @@ -787,7 +789,7 @@ func (tp *TestSuite) TestLsEmptyDir(t *testing.T) { t.Fatal(err) } - links, err := api.Unixfs().Ls(ctx, path.IpfsPath(emptyDir.Cid())) + links, err := api.Unixfs().Ls(ctx, path.FromCid(emptyDir.Cid())) if err != nil { t.Fatal(err) } @@ -816,7 +818,7 @@ func (tp *TestSuite) TestLsNonUnixfs(t *testing.T) { t.Fatal(err) } - links, err := api.Unixfs().Ls(ctx, path.IpfsPath(nd.Cid())) + links, err := api.Unixfs().Ls(ctx, path.FromCid(nd.Cid())) if err != nil { t.Fatal(err) } diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 606bc8e7810..35e108c028a 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -4,17 +4,16 @@ import ( "context" "github.com/ipfs/boxo/coreiface/options" - path "github.com/ipfs/boxo/coreiface/path" - "github.com/ipfs/boxo/files" + "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" ) type AddEvent struct { Name string - Path path.Resolved `json:",omitempty"` - Bytes int64 `json:",omitempty"` - Size string `json:",omitempty"` + Path path.ImmutablePath `json:",omitempty"` + Bytes int64 `json:",omitempty"` + Size string `json:",omitempty"` } // FileType is an enum of possible UnixFS file types. @@ -66,7 +65,7 @@ type UnixfsAPI interface { // Add imports the data from the reader into merkledag file // // TODO: a long useful comment on how to use this for many different scenarios - Add(context.Context, files.Node, ...options.UnixfsAddOption) (path.Resolved, error) + Add(context.Context, files.Node, ...options.UnixfsAddOption) (path.ImmutablePath, error) // Get returns a read-only handle to a file tree referenced by a path // From dafdce89838f358180a52a5bfbb4b198be25b8da Mon Sep 17 00:00:00 2001 From: Jorropo Date: Fri, 6 Oct 2023 21:17:13 +0200 Subject: [PATCH 255/286] path: replace ImmutablePath interface with struct Let's not repeat https://github.com/ipfs/go-block-format/issues/45 interface for struct with one implementation and no value added. This commit was moved from ipfs/boxo@45c797e0ccea0a3186795e64d9e5ed60b5d7544c --- core/coreiface/tests/unixfs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index e0c37fce4b2..31ac1b5c9f4 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -408,7 +408,7 @@ func (tp *TestSuite) TestAdd(t *testing.T) { t.Errorf("Event.Name didn't match, %s != %s", expected[0].Name, event.Name) } - if expected[0].Path != nil && event.Path != nil { + if (expected[0].Path != path.ImmutablePath{} && event.Path != path.ImmutablePath{}) { if expected[0].Path.RootCid().String() != event.Path.RootCid().String() { t.Errorf("Event.Hash didn't match, %s != %s", expected[0].Path, event.Path) } From faac7c183588115aa2acc3c1ab5df408d2477845 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 18 Oct 2023 10:12:37 +0200 Subject: [PATCH 256/286] feat!: namesys refactor, ipns TTL bubbled up to gateway (#459) This commit was moved from ipfs/boxo@a50f784985ddfc25ec8d25aced2ca058469a3390 --- core/coreiface/options/name.go | 6 +- core/coreiface/options/namesys/opts.go | 131 ------------------------- 2 files changed, 3 insertions(+), 134 deletions(-) delete mode 100644 core/coreiface/options/namesys/opts.go diff --git a/core/coreiface/options/name.go b/core/coreiface/options/name.go index 35e78c394ec..7b4b6a8fde1 100644 --- a/core/coreiface/options/name.go +++ b/core/coreiface/options/name.go @@ -3,7 +3,7 @@ package options import ( "time" - ropts "github.com/ipfs/boxo/coreiface/options/namesys" + "github.com/ipfs/boxo/namesys" ) const ( @@ -21,7 +21,7 @@ type NamePublishSettings struct { type NameResolveSettings struct { Cache bool - ResolveOpts []ropts.ResolveOpt + ResolveOpts []namesys.ResolveOption } type ( @@ -123,7 +123,7 @@ func (nameOpts) Cache(cache bool) NameResolveOption { } } -func (nameOpts) ResolveOption(opt ropts.ResolveOpt) NameResolveOption { +func (nameOpts) ResolveOption(opt namesys.ResolveOption) NameResolveOption { return func(settings *NameResolveSettings) error { settings.ResolveOpts = append(settings.ResolveOpts, opt) return nil diff --git a/core/coreiface/options/namesys/opts.go b/core/coreiface/options/namesys/opts.go deleted file mode 100644 index ed568200b3d..00000000000 --- a/core/coreiface/options/namesys/opts.go +++ /dev/null @@ -1,131 +0,0 @@ -package nsopts - -import ( - "time" -) - -const ( - // DefaultDepthLimit is the default depth limit used by Resolve. - DefaultDepthLimit = 32 - - // UnlimitedDepth allows infinite recursion in Resolve. You - // probably don't want to use this, but it's here if you absolutely - // trust resolution to eventually complete and can't put an upper - // limit on how many steps it will take. - UnlimitedDepth = 0 - - // DefaultIPNSRecordTTL specifies the time that the record can be cached - // before checking if its validity again. - DefaultIPNSRecordTTL = time.Minute - - // DefaultIPNSRecordEOL specifies the time that the network will cache IPNS - // records after being published. Records should be re-published before this - // interval expires. We use the same default expiration as the DHT. - DefaultIPNSRecordEOL = 48 * time.Hour -) - -// ResolveOpts specifies options for resolving an IPNS path -type ResolveOpts struct { - // Recursion depth limit - Depth uint - // The number of IPNS records to retrieve from the DHT - // (the best record is selected from this set) - DhtRecordCount uint - // The amount of time to wait for DHT records to be fetched - // and verified. A zero value indicates that there is no explicit - // timeout (although there is an implicit timeout due to dial - // timeouts within the DHT) - DhtTimeout time.Duration -} - -// DefaultResolveOpts returns the default options for resolving -// an IPNS path -func DefaultResolveOpts() ResolveOpts { - return ResolveOpts{ - Depth: DefaultDepthLimit, - DhtRecordCount: 16, - DhtTimeout: time.Minute, - } -} - -// ResolveOpt is used to set an option -type ResolveOpt func(*ResolveOpts) - -// Depth is the recursion depth limit -func Depth(depth uint) ResolveOpt { - return func(o *ResolveOpts) { - o.Depth = depth - } -} - -// DhtRecordCount is the number of IPNS records to retrieve from the DHT -func DhtRecordCount(count uint) ResolveOpt { - return func(o *ResolveOpts) { - o.DhtRecordCount = count - } -} - -// DhtTimeout is the amount of time to wait for DHT records to be fetched -// and verified. A zero value indicates that there is no explicit timeout -func DhtTimeout(timeout time.Duration) ResolveOpt { - return func(o *ResolveOpts) { - o.DhtTimeout = timeout - } -} - -// ProcessOpts converts an array of ResolveOpt into a ResolveOpts object -func ProcessOpts(opts []ResolveOpt) ResolveOpts { - rsopts := DefaultResolveOpts() - for _, option := range opts { - option(&rsopts) - } - return rsopts -} - -// PublishOptions specifies options for publishing an IPNS record. -type PublishOptions struct { - EOL time.Time - TTL time.Duration - CompatibleWithV1 bool -} - -// DefaultPublishOptions returns the default options for publishing an IPNS record. -func DefaultPublishOptions() PublishOptions { - return PublishOptions{ - EOL: time.Now().Add(DefaultIPNSRecordEOL), - TTL: DefaultIPNSRecordTTL, - } -} - -// PublishOption is used to set an option for PublishOpts. -type PublishOption func(*PublishOptions) - -// PublishWithEOL sets an EOL. -func PublishWithEOL(eol time.Time) PublishOption { - return func(o *PublishOptions) { - o.EOL = eol - } -} - -// PublishWithEOL sets a TTL. -func PublishWithTTL(ttl time.Duration) PublishOption { - return func(o *PublishOptions) { - o.TTL = ttl - } -} - -// PublishCompatibleWithV1 sets compatibility with IPNS Records V1. -func PublishCompatibleWithV1(compatible bool) PublishOption { - return func(o *PublishOptions) { - o.CompatibleWithV1 = compatible - } -} - -// ProcessPublishOptions converts an array of PublishOpt into a PublishOpts object. -func ProcessPublishOptions(opts []PublishOption) PublishOptions { - rsopts := DefaultPublishOptions() - for _, option := range opts { - option(&rsopts) - } - return rsopts -} From 0f6f02cbea658a3436dc0e772aabb9e85c5fc554 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 1 Nov 2023 10:25:48 +0000 Subject: [PATCH 257/286] chore: update version --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 2491eeffb04..2799f0e85bd 100644 --- a/version.go +++ b/version.go @@ -11,7 +11,7 @@ import ( var CurrentCommit string // CurrentVersionNumber is the current application's version literal. -const CurrentVersionNumber = "0.23.0" +const CurrentVersionNumber = "0.25.0-dev" const ApiVersion = "/kubo/" + CurrentVersionNumber + "/" //nolint From e238a869adff1e96cefcdce9a706f67820b981f2 Mon Sep 17 00:00:00 2001 From: Steve Loeppky Date: Fri, 3 Nov 2023 08:03:07 +0100 Subject: [PATCH 258/286] docs: update EARLY_TESTERS.md (#10194) --- docs/EARLY_TESTERS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/EARLY_TESTERS.md b/docs/EARLY_TESTERS.md index 635890676ec..6c5b09b1585 100644 --- a/docs/EARLY_TESTERS.md +++ b/docs/EARLY_TESTERS.md @@ -26,11 +26,11 @@ We will ask early testers to participate at two points in the process: - [ ] Fission (@bmann) - [ ] Infura (@MichaelMure) - [ ] OrbitDB (@haydenyoung) -- [ ] pacman.store (@RubenKelevra) - [ ] Pinata (@obo20) -- [ ] PL EngRes bifrost (@gmasgras) +- [ ] PL EngRes bifrost (@cewood ns4plabs) - [ ] Siderus (@koalalorenzo) - [ ] Textile (@sanderpick) +- [ ] @RubenKelevra ## How to sign up? From f1fec717825c891242c0054078192618c14b797c Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 3 Nov 2023 08:17:00 +0100 Subject: [PATCH 259/286] chore: go-libp2p v0.32.0 --- docs/examples/kubo-as-a-library/go.mod | 46 ++++++------- docs/examples/kubo-as-a-library/go.sum | 95 +++++++++++++------------- go.mod | 46 ++++++------- go.sum | 95 +++++++++++++------------- test/dependencies/go.mod | 44 ++++++------ test/dependencies/go.sum | 90 ++++++++++++------------ 6 files changed, 207 insertions(+), 209 deletions(-) diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index b2b90bf3bd3..da95b3f70eb 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -7,10 +7,10 @@ go 1.20 replace github.com/ipfs/kubo => ./../../.. require ( - github.com/ipfs/boxo v0.14.0 + github.com/ipfs/boxo v0.15.0 github.com/ipfs/kubo v0.0.0-00010101000000-000000000000 - github.com/libp2p/go-libp2p v0.31.0 - github.com/multiformats/go-multiaddr v0.11.0 + github.com/libp2p/go-libp2p v0.32.0 + github.com/multiformats/go-multiaddr v0.12.0 ) require ( @@ -47,11 +47,10 @@ require ( github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/gopacket v1.1.19 // indirect - github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f // indirect + github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect github.com/google/uuid v1.3.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect @@ -60,7 +59,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/huin/goupnp v1.2.0 // indirect + github.com/huin/goupnp v1.3.0 // indirect github.com/ipfs-shipyard/nopfs v0.0.12-0.20231027223058-cde3b5ba964c // indirect github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c // indirect github.com/ipfs/bbloom v0.0.4 // indirect @@ -74,7 +73,7 @@ require ( github.com/ipfs/go-ds-leveldb v0.5.0 // indirect github.com/ipfs/go-ds-measure v0.2.0 // indirect github.com/ipfs/go-fs-lock v0.0.7 // indirect - github.com/ipfs/go-graphsync v0.15.1 // indirect + github.com/ipfs/go-graphsync v0.16.0 // indirect github.com/ipfs/go-ipfs-blockstore v1.3.0 // indirect github.com/ipfs/go-ipfs-delay v0.0.1 // indirect github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect @@ -97,7 +96,7 @@ require ( github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.17.2 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/koron/go-ssdp v0.0.4 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect @@ -107,7 +106,7 @@ require ( github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect github.com/libp2p/go-libp2p-kad-dht v0.24.4 // indirect github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect - github.com/libp2p/go-libp2p-pubsub v0.9.3 // indirect + github.com/libp2p/go-libp2p-pubsub v0.10.0 // indirect github.com/libp2p/go-libp2p-pubsub-router v0.6.0 // indirect github.com/libp2p/go-libp2p-record v0.2.0 // indirect github.com/libp2p/go-libp2p-routing-helpers v0.7.3 // indirect @@ -120,9 +119,9 @@ require ( github.com/libp2p/go-yamux/v4 v4.0.1 // indirect github.com/libp2p/zeroconf/v2 v2.2.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/miekg/dns v1.1.55 // indirect + github.com/miekg/dns v1.1.56 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -135,9 +134,9 @@ require ( github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multihash v0.2.3 // indirect - github.com/multiformats/go-multistream v0.4.1 // 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.11.0 // indirect + github.com/onsi/ginkgo/v2 v2.13.0 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect @@ -150,9 +149,9 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect - github.com/quic-go/qtls-go1-20 v0.3.3 // indirect - github.com/quic-go/quic-go v0.38.1 // indirect - github.com/quic-go/webtransport-go v0.5.3 // indirect + github.com/quic-go/qtls-go1-20 v0.3.4 // indirect + github.com/quic-go/quic-go v0.39.3 // indirect + github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/samber/lo v1.36.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect @@ -178,19 +177,20 @@ require ( go.opentelemetry.io/otel/trace v1.17.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.11.0 // indirect - go.uber.org/dig v1.17.0 // indirect - go.uber.org/fx v1.20.0 // indirect + go.uber.org/dig v1.17.1 // indirect + go.uber.org/fx v1.20.1 // indirect + go.uber.org/mock v0.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sync v0.3.0 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gonum.org/v1/gonum v0.13.0 // indirect google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index ba1c192a227..42bb1aa3046 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -206,8 +206,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -257,8 +255,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f h1:pDhu5sgp8yJlEF/g6osliIIpF9K4F5jvkULXa4daRDQ= -github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -295,8 +293,8 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= -github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs-shipyard/nopfs v0.0.12-0.20231027223058-cde3b5ba964c h1:17FO7HnKiFhO7iadu3zCgII+EblpdRmJt5qg9FqQo8Y= @@ -305,8 +303,8 @@ github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c h1:7Uy github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c/go.mod h1:6EekK/jo+TynwSE/ZOiOJd4eEvRXoavEC3vquKtv4yI= 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.14.0 h1:gwSGW3xqUbtUOdn71oqBknpBFKpQm352g3I+RkebrX0= -github.com/ipfs/boxo v0.14.0/go.mod h1:pu8HsZvuyYeYJsqtLDCoYSvy8rHj6vI3dlh8P0f83Zs= +github.com/ipfs/boxo v0.15.0 h1:BriLydj2nlK1nKeJQHxcKSuG5ZXcoutzhBklOtxC5pk= +github.com/ipfs/boxo v0.15.0/go.mod h1:X5ulcbR5Nh7sm3Db8+08AApUo6FsGC5mb23QDKAoB/M= 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= @@ -343,8 +341,8 @@ github.com/ipfs/go-ds-measure v0.2.0 h1:sG4goQe0KDTccHMyT45CY1XyUbxe5VwTKpg2LjAp github.com/ipfs/go-ds-measure v0.2.0/go.mod h1:SEUD/rE2PwRa4IQEC5FuNAmjJCyYObZr9UvVh8V3JxE= github.com/ipfs/go-fs-lock v0.0.7 h1:6BR3dajORFrFTkb5EpCUFIAypsoxpGpDSVUdFwzgL9U= github.com/ipfs/go-fs-lock v0.0.7/go.mod h1:Js8ka+FNYmgQRLrRXzU3CB/+Csr1BwrRilEcvYrHhhc= -github.com/ipfs/go-graphsync v0.15.1 h1:7v4VfRQ/8pKzPuE0wHeMaWhKu8D/RlezIrzvGWIBtHQ= -github.com/ipfs/go-graphsync v0.15.1/go.mod h1:eUIYS0OKkdBbG4vHhfGkY3lZ7h1G5Dlwd+HxTCe18vA= +github.com/ipfs/go-graphsync v0.16.0 h1:0BX7whXlV13Y9FZ/jRg+xaGHaGYbtGxGppKD6tncw6k= +github.com/ipfs/go-graphsync v0.16.0/go.mod h1:WfbMW3hhmX5GQEQ+KJxsFzVJVBKgC5szfrYK7Zc7xIM= github.com/ipfs/go-ipfs-blockstore v1.3.0 h1:m2EXaWgwTzAfsmt5UdJ7Is6l4gJcaM/A12XwJyvYvMM= github.com/ipfs/go-ipfs-blockstore v1.3.0/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= @@ -432,8 +430,8 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= @@ -463,8 +461,8 @@ github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZ github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.31.0 h1:LFShhP8F6xthWiBBq3euxbKjZsoRajVEyBS9snfHxYg= -github.com/libp2p/go-libp2p v0.31.0/go.mod h1:W/FEK1c/t04PbRH3fA9i5oucu5YcgrG0JVoBWT1B7Eg= +github.com/libp2p/go-libp2p v0.32.0 h1:86I4B7nBUPIyTgw3+5Ibq6K7DdKRCuZw8URCfPc1hQM= +github.com/libp2p/go-libp2p v0.32.0/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= @@ -475,8 +473,8 @@ github.com/libp2p/go-libp2p-kbucket v0.3.1/go.mod h1:oyjT5O7tS9CQurok++ERgc46YLw github.com/libp2p/go-libp2p-kbucket v0.6.3 h1:p507271wWzpy2f1XxPzCQG9NiN6R6lHL9GiSErbQQo0= github.com/libp2p/go-libp2p-kbucket v0.6.3/go.mod h1:RCseT7AH6eJWxxk2ol03xtP9pEHetYSPXOaJnOiD8i0= github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVdLxvqh7hXOujessqdzs= -github.com/libp2p/go-libp2p-pubsub v0.9.3 h1:ihcz9oIBMaCK9kcx+yHWm3mLAFBMAUsM4ux42aikDxo= -github.com/libp2p/go-libp2p-pubsub v0.9.3/go.mod h1:RYA7aM9jIic5VV47WXu4GkcRxRhrdElWf8xtyli+Dzc= +github.com/libp2p/go-libp2p-pubsub v0.10.0 h1:wS0S5FlISavMaAbxyQn3dxMOe2eegMfswM471RuHJwA= +github.com/libp2p/go-libp2p-pubsub v0.10.0/go.mod h1:1OxbaT/pFRO5h+Dpze8hdHQ63R0ke55XTs6b6NwLLkw= github.com/libp2p/go-libp2p-pubsub-router v0.6.0 h1:D30iKdlqDt5ZmLEYhHELCMRj8b4sFAqrUcshIUvVP/s= github.com/libp2p/go-libp2p-pubsub-router v0.6.0/go.mod h1:FY/q0/RBTKsLA7l4vqC2cbRbOvyDotg8PJQ7j8FDudE= github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= @@ -515,8 +513,8 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -524,8 +522,8 @@ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyex github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= -github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo= -github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= +github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= +github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= @@ -558,8 +556,8 @@ github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lgmoS58qz/pzqmAxV44= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= -github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= -github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= +github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= +github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= github.com/multiformats/go-multiaddr-dns v0.3.0/go.mod h1:mNzQ4eTGDg0ll1N9jKPOUogZPoJ30W8a7zk66FQPpdQ= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= @@ -582,8 +580,8 @@ github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJ github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= -github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= -github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= +github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf/QGkvOGQAyiE= +github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= @@ -598,12 +596,12 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= -github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -643,12 +641,12 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= -github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM= -github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE= -github.com/quic-go/quic-go v0.38.1/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4= -github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU= -github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= +github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= +github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= +github.com/quic-go/quic-go v0.39.3 h1:o3YB6t2SR+HU/pgwF29kJ6g4jJIJEwEZ8CKia1h1TKg= +github.com/quic-go/quic-go v0.39.3/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= +github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= +github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -806,12 +804,14 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= -go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= -go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= -go.uber.org/fx v1.20.0/go.mod h1:qCUj0btiR3/JnanEr1TYEePfSw6o/4qYJscgvzQ5Ub0= +go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= +go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.20.1 h1:zVwVQGS8zYvhh9Xxcu4w1M6ESyeMzebzj2NbSayZ4Mk= +go.uber.org/fx v1.20.1/go.mod h1:iSYNbHf2y55acNCwCXKx7LbWb5WG1Bnue5RDXz1OREg= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= +go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -857,8 +857,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -882,8 +882,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -926,8 +926,8 @@ golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -948,8 +948,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1080,11 +1080,10 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/go.mod b/go.mod index 1acc57dae02..b8fe887d0b6 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/ipfs-shipyard/nopfs v0.0.12-0.20231027223058-cde3b5ba964c github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c - github.com/ipfs/boxo v0.14.0 + github.com/ipfs/boxo v0.15.0 github.com/ipfs/go-block-format v0.2.0 github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cidutil v0.1.0 @@ -28,7 +28,7 @@ require ( github.com/ipfs/go-ds-leveldb v0.5.0 github.com/ipfs/go-ds-measure v0.2.0 github.com/ipfs/go-fs-lock v0.0.7 - github.com/ipfs/go-graphsync v0.15.1 + github.com/ipfs/go-graphsync v0.16.0 github.com/ipfs/go-ipfs-cmds v0.10.0 github.com/ipfs/go-ipld-format v0.6.0 github.com/ipfs/go-ipld-git v0.1.1 @@ -47,11 +47,11 @@ require ( github.com/jbenet/goprocess v0.1.4 github.com/julienschmidt/httprouter v1.3.0 github.com/libp2p/go-doh-resolver v0.4.0 - github.com/libp2p/go-libp2p v0.31.0 + github.com/libp2p/go-libp2p v0.32.0 github.com/libp2p/go-libp2p-http v0.5.0 github.com/libp2p/go-libp2p-kad-dht v0.24.4 github.com/libp2p/go-libp2p-kbucket v0.6.3 - github.com/libp2p/go-libp2p-pubsub v0.9.3 + github.com/libp2p/go-libp2p-pubsub v0.10.0 github.com/libp2p/go-libp2p-pubsub-router v0.6.0 github.com/libp2p/go-libp2p-record v0.2.0 github.com/libp2p/go-libp2p-routing-helpers v0.7.3 @@ -59,7 +59,7 @@ require ( github.com/libp2p/go-mplex v0.7.0 github.com/libp2p/go-socket-activation v0.1.0 github.com/mitchellh/go-homedir v1.1.0 - github.com/multiformats/go-multiaddr v0.11.0 + github.com/multiformats/go-multiaddr v0.12.0 github.com/multiformats/go-multiaddr-dns v0.3.1 github.com/multiformats/go-multibase v0.2.0 github.com/multiformats/go-multicodec v0.9.0 @@ -80,14 +80,14 @@ require ( go.opentelemetry.io/otel v1.17.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.17.0 - go.uber.org/dig v1.17.0 - go.uber.org/fx v1.20.0 + go.uber.org/dig v1.17.1 + go.uber.org/fx v1.20.1 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.26.0 golang.org/x/crypto v0.14.0 - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/mod v0.12.0 - golang.org/x/sync v0.3.0 + golang.org/x/exp v0.0.0-20231006140011-7918f672742d + golang.org/x/mod v0.13.0 + golang.org/x/sync v0.4.0 golang.org/x/sys v0.13.0 google.golang.org/protobuf v1.31.0 ) @@ -122,11 +122,10 @@ require ( github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/gopacket v1.1.19 // indirect - github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f // indirect + github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect @@ -134,7 +133,7 @@ require ( github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect - github.com/huin/goupnp v1.2.0 // indirect + github.com/huin/goupnp v1.3.0 // indirect github.com/ipfs/bbloom v0.0.4 // indirect github.com/ipfs/go-bitfield v1.1.0 // indirect github.com/ipfs/go-blockservice v0.5.0 // indirect @@ -151,7 +150,7 @@ require ( github.com/ipfs/go-peertaskqueue v0.8.1 // indirect github.com/ipfs/go-verifcid v0.0.2 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.17.2 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/koron/go-ssdp v0.0.4 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect @@ -168,11 +167,11 @@ require ( github.com/libp2p/zeroconf/v2 v2.2.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-colorable v0.1.6 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.4 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect - github.com/miekg/dns v1.1.55 // indirect + github.com/miekg/dns v1.1.56 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -180,9 +179,9 @@ require ( github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect - github.com/multiformats/go-multistream v0.4.1 // 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.11.0 // indirect + github.com/onsi/ginkgo/v2 v2.13.0 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect @@ -193,9 +192,9 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/prometheus/statsd_exporter v0.22.7 // indirect github.com/quic-go/qpack v0.4.0 // indirect - github.com/quic-go/qtls-go1-20 v0.3.3 // indirect - github.com/quic-go/quic-go v0.38.1 // indirect - github.com/quic-go/webtransport-go v0.5.3 // indirect + github.com/quic-go/qtls-go1-20 v0.3.4 // indirect + github.com/quic-go/quic-go v0.39.3 // indirect + github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rs/cors v1.7.0 // indirect github.com/samber/lo v1.36.0 // indirect @@ -223,12 +222,13 @@ require ( go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.11.0 // indirect + go.uber.org/mock v0.3.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect - golang.org/x/net v0.15.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gonum.org/v1/gonum v0.13.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 69ae8aff6fe..c07381487ca 100644 --- a/go.sum +++ b/go.sum @@ -237,8 +237,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -290,8 +288,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f h1:pDhu5sgp8yJlEF/g6osliIIpF9K4F5jvkULXa4daRDQ= -github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -329,8 +327,8 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= -github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/ipfs-shipyard/nopfs v0.0.12-0.20231027223058-cde3b5ba964c h1:17FO7HnKiFhO7iadu3zCgII+EblpdRmJt5qg9FqQo8Y= @@ -339,8 +337,8 @@ github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c h1:7Uy github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c/go.mod h1:6EekK/jo+TynwSE/ZOiOJd4eEvRXoavEC3vquKtv4yI= 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.14.0 h1:gwSGW3xqUbtUOdn71oqBknpBFKpQm352g3I+RkebrX0= -github.com/ipfs/boxo v0.14.0/go.mod h1:pu8HsZvuyYeYJsqtLDCoYSvy8rHj6vI3dlh8P0f83Zs= +github.com/ipfs/boxo v0.15.0 h1:BriLydj2nlK1nKeJQHxcKSuG5ZXcoutzhBklOtxC5pk= +github.com/ipfs/boxo v0.15.0/go.mod h1:X5ulcbR5Nh7sm3Db8+08AApUo6FsGC5mb23QDKAoB/M= 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-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ= @@ -379,8 +377,8 @@ github.com/ipfs/go-ds-measure v0.2.0 h1:sG4goQe0KDTccHMyT45CY1XyUbxe5VwTKpg2LjAp github.com/ipfs/go-ds-measure v0.2.0/go.mod h1:SEUD/rE2PwRa4IQEC5FuNAmjJCyYObZr9UvVh8V3JxE= github.com/ipfs/go-fs-lock v0.0.7 h1:6BR3dajORFrFTkb5EpCUFIAypsoxpGpDSVUdFwzgL9U= github.com/ipfs/go-fs-lock v0.0.7/go.mod h1:Js8ka+FNYmgQRLrRXzU3CB/+Csr1BwrRilEcvYrHhhc= -github.com/ipfs/go-graphsync v0.15.1 h1:7v4VfRQ/8pKzPuE0wHeMaWhKu8D/RlezIrzvGWIBtHQ= -github.com/ipfs/go-graphsync v0.15.1/go.mod h1:eUIYS0OKkdBbG4vHhfGkY3lZ7h1G5Dlwd+HxTCe18vA= +github.com/ipfs/go-graphsync v0.16.0 h1:0BX7whXlV13Y9FZ/jRg+xaGHaGYbtGxGppKD6tncw6k= +github.com/ipfs/go-graphsync v0.16.0/go.mod h1:WfbMW3hhmX5GQEQ+KJxsFzVJVBKgC5szfrYK7Zc7xIM= github.com/ipfs/go-ipfs-blockstore v1.3.0 h1:m2EXaWgwTzAfsmt5UdJ7Is6l4gJcaM/A12XwJyvYvMM= github.com/ipfs/go-ipfs-blockstore v1.3.0/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= @@ -486,8 +484,8 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= @@ -519,8 +517,8 @@ github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZ github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.31.0 h1:LFShhP8F6xthWiBBq3euxbKjZsoRajVEyBS9snfHxYg= -github.com/libp2p/go-libp2p v0.31.0/go.mod h1:W/FEK1c/t04PbRH3fA9i5oucu5YcgrG0JVoBWT1B7Eg= +github.com/libp2p/go-libp2p v0.32.0 h1:86I4B7nBUPIyTgw3+5Ibq6K7DdKRCuZw8URCfPc1hQM= +github.com/libp2p/go-libp2p v0.32.0/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= @@ -535,8 +533,8 @@ github.com/libp2p/go-libp2p-kbucket v0.3.1/go.mod h1:oyjT5O7tS9CQurok++ERgc46YLw github.com/libp2p/go-libp2p-kbucket v0.6.3 h1:p507271wWzpy2f1XxPzCQG9NiN6R6lHL9GiSErbQQo0= github.com/libp2p/go-libp2p-kbucket v0.6.3/go.mod h1:RCseT7AH6eJWxxk2ol03xtP9pEHetYSPXOaJnOiD8i0= github.com/libp2p/go-libp2p-peerstore v0.1.4/go.mod h1:+4BDbDiiKf4PzpANZDAT+knVdLxvqh7hXOujessqdzs= -github.com/libp2p/go-libp2p-pubsub v0.9.3 h1:ihcz9oIBMaCK9kcx+yHWm3mLAFBMAUsM4ux42aikDxo= -github.com/libp2p/go-libp2p-pubsub v0.9.3/go.mod h1:RYA7aM9jIic5VV47WXu4GkcRxRhrdElWf8xtyli+Dzc= +github.com/libp2p/go-libp2p-pubsub v0.10.0 h1:wS0S5FlISavMaAbxyQn3dxMOe2eegMfswM471RuHJwA= +github.com/libp2p/go-libp2p-pubsub v0.10.0/go.mod h1:1OxbaT/pFRO5h+Dpze8hdHQ63R0ke55XTs6b6NwLLkw= github.com/libp2p/go-libp2p-pubsub-router v0.6.0 h1:D30iKdlqDt5ZmLEYhHELCMRj8b4sFAqrUcshIUvVP/s= github.com/libp2p/go-libp2p-pubsub-router v0.6.0/go.mod h1:FY/q0/RBTKsLA7l4vqC2cbRbOvyDotg8PJQ7j8FDudE= github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0= @@ -584,8 +582,8 @@ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -596,8 +594,8 @@ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyex github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= -github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo= -github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= +github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= +github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= @@ -634,8 +632,8 @@ github.com/multiformats/go-multiaddr v0.1.0/go.mod h1:xKVEak1K9cS1VdmPZW3LSIb6lg github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr v0.4.0/go.mod h1:YcpyLH8ZPudLxQlemYBPhSm0/oCXAT8Z4mzFpyoPyRc= -github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= -github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= +github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= +github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= github.com/multiformats/go-multiaddr-dns v0.3.0/go.mod h1:mNzQ4eTGDg0ll1N9jKPOUogZPoJ30W8a7zk66FQPpdQ= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= @@ -658,8 +656,8 @@ github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJ github.com/multiformats/go-multihash v0.1.0/go.mod h1:RJlXsxt6vHGaia+S8We0ErjhojtKzPP2AH4+kYM7k84= github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= -github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= -github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= +github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf/QGkvOGQAyiE= +github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= @@ -676,12 +674,12 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= -github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -748,12 +746,12 @@ github.com/prometheus/statsd_exporter v0.22.7 h1:7Pji/i2GuhK6Lu7DHrtTkFmNBCudCPT github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9dFqnUakOjnEuMPJJJnI= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= -github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM= -github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE= -github.com/quic-go/quic-go v0.38.1/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4= -github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU= -github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= +github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= +github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= +github.com/quic-go/quic-go v0.39.3 h1:o3YB6t2SR+HU/pgwF29kJ6g4jJIJEwEZ8CKia1h1TKg= +github.com/quic-go/quic-go v0.39.3/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= +github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= +github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -943,12 +941,14 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= -go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= -go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= -go.uber.org/fx v1.20.0/go.mod h1:qCUj0btiR3/JnanEr1TYEePfSw6o/4qYJscgvzQ5Ub0= +go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= +go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.20.1 h1:zVwVQGS8zYvhh9Xxcu4w1M6ESyeMzebzj2NbSayZ4Mk= +go.uber.org/fx v1.20.1/go.mod h1:iSYNbHf2y55acNCwCXKx7LbWb5WG1Bnue5RDXz1OREg= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= +go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -994,8 +994,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1019,8 +1019,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1069,8 +1069,8 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1097,8 +1097,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1241,11 +1241,10 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index 7593700c57c..b10e8c00f31 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -7,11 +7,11 @@ replace github.com/ipfs/kubo => ../../ require ( github.com/Kubuxu/gocovmerge v0.0.0-20161216165753-7ecaa51963cd github.com/golangci/golangci-lint v1.54.1 - github.com/ipfs/boxo v0.14.0 + github.com/ipfs/boxo v0.15.0 github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cidutil v0.1.0 github.com/ipfs/go-datastore v0.6.0 - github.com/ipfs/go-graphsync v0.15.1 + github.com/ipfs/go-graphsync v0.16.0 github.com/ipfs/go-log v1.0.5 github.com/ipfs/hang-fds v0.1.0 github.com/ipfs/iptb v1.4.0 @@ -19,8 +19,8 @@ require ( github.com/ipld/go-ipld-prime v0.21.0 github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c github.com/jbenet/go-random-files v0.0.0-20190219210431-31b3f20ebded - github.com/libp2p/go-libp2p v0.31.0 - github.com/multiformats/go-multiaddr v0.11.0 + github.com/libp2p/go-libp2p v0.32.0 + github.com/multiformats/go-multiaddr v0.12.0 github.com/multiformats/go-multihash v0.2.3 gotest.tools/gotestsum v0.4.2 ) @@ -93,7 +93,6 @@ require ( github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect @@ -106,7 +105,7 @@ require ( github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gopacket v1.1.19 // indirect - github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f // indirect + github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect github.com/google/uuid v1.3.1 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect github.com/gorilla/websocket v1.5.0 // indirect @@ -123,7 +122,7 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect - github.com/huin/goupnp v1.2.0 // indirect + github.com/huin/goupnp v1.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/bbloom v0.0.4 // indirect github.com/ipfs/go-bitfield v1.1.0 // indirect @@ -152,7 +151,7 @@ require ( github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect - github.com/klauspost/compress v1.16.7 // indirect + github.com/klauspost/compress v1.17.2 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/koron/go-ssdp v0.0.4 // indirect github.com/kulti/thelper v0.6.3 // indirect @@ -181,12 +180,12 @@ require ( github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.2 // indirect - github.com/miekg/dns v1.1.55 // indirect + github.com/miekg/dns v1.1.56 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -200,7 +199,7 @@ require ( github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect - github.com/multiformats/go-multistream v0.4.1 // indirect + github.com/multiformats/go-multistream v0.5.0 // indirect github.com/multiformats/go-varint v0.0.7 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect @@ -208,7 +207,7 @@ require ( github.com/nishanths/predeclared v0.2.2 // indirect github.com/nunnatsa/ginkgolinter v0.13.3 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/onsi/ginkgo/v2 v2.11.0 // indirect + github.com/onsi/ginkgo/v2 v2.13.0 // indirect github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect @@ -227,9 +226,9 @@ require ( github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/quic-go/qpack v0.4.0 // indirect - github.com/quic-go/qtls-go1-20 v0.3.3 // indirect - github.com/quic-go/quic-go v0.38.1 // indirect - github.com/quic-go/webtransport-go v0.5.3 // indirect + github.com/quic-go/qtls-go1-20 v0.3.4 // indirect + github.com/quic-go/quic-go v0.39.3 // indirect + github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect @@ -281,20 +280,21 @@ require ( go.opentelemetry.io/otel/trace v1.19.0 // indirect go.tmz.dev/musttag v0.7.1 // indirect go.uber.org/atomic v1.11.0 // indirect - go.uber.org/dig v1.17.0 // indirect - go.uber.org/fx v1.20.0 // indirect + go.uber.org/dig v1.17.1 // indirect + go.uber.org/fx v1.20.1 // indirect + go.uber.org/mock v0.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sync v0.3.0 // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.13.0 // indirect + golang.org/x/tools v0.14.0 // indirect gonum.org/v1/gonum v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index 99ffc1795a7..1c01c63202f 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -261,8 +261,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -336,8 +334,8 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f h1:pDhu5sgp8yJlEF/g6osliIIpF9K4F5jvkULXa4daRDQ= -github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= +github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -390,16 +388,16 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huin/goupnp v1.2.0 h1:uOKW26NG1hsSSbXIZ1IR7XP9Gjd1U8pnLaCMgntmkmY= -github.com/huin/goupnp v1.2.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 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.14.0 h1:gwSGW3xqUbtUOdn71oqBknpBFKpQm352g3I+RkebrX0= -github.com/ipfs/boxo v0.14.0/go.mod h1:pu8HsZvuyYeYJsqtLDCoYSvy8rHj6vI3dlh8P0f83Zs= +github.com/ipfs/boxo v0.15.0 h1:BriLydj2nlK1nKeJQHxcKSuG5ZXcoutzhBklOtxC5pk= +github.com/ipfs/boxo v0.15.0/go.mod h1:X5ulcbR5Nh7sm3Db8+08AApUo6FsGC5mb23QDKAoB/M= 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.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs= @@ -415,8 +413,8 @@ github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0M github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-graphsync v0.15.1 h1:7v4VfRQ/8pKzPuE0wHeMaWhKu8D/RlezIrzvGWIBtHQ= -github.com/ipfs/go-graphsync v0.15.1/go.mod h1:eUIYS0OKkdBbG4vHhfGkY3lZ7h1G5Dlwd+HxTCe18vA= +github.com/ipfs/go-graphsync v0.16.0 h1:0BX7whXlV13Y9FZ/jRg+xaGHaGYbtGxGppKD6tncw6k= +github.com/ipfs/go-graphsync v0.16.0/go.mod h1:WfbMW3hhmX5GQEQ+KJxsFzVJVBKgC5szfrYK7Zc7xIM= github.com/ipfs/go-ipfs-blockstore v1.3.0 h1:m2EXaWgwTzAfsmt5UdJ7Is6l4gJcaM/A12XwJyvYvMM= github.com/ipfs/go-ipfs-blockstore v1.3.0/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= @@ -508,8 +506,8 @@ github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= -github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= +github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -544,8 +542,8 @@ github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38y github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.31.0 h1:LFShhP8F6xthWiBBq3euxbKjZsoRajVEyBS9snfHxYg= -github.com/libp2p/go-libp2p v0.31.0/go.mod h1:W/FEK1c/t04PbRH3fA9i5oucu5YcgrG0JVoBWT1B7Eg= +github.com/libp2p/go-libp2p v0.32.0 h1:86I4B7nBUPIyTgw3+5Ibq6K7DdKRCuZw8URCfPc1hQM= +github.com/libp2p/go-libp2p v0.32.0/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-kad-dht v0.24.4 h1:ktNiJe7ffsJ1wX3ULpMCwXts99mPqGFSE/Qn1i8pErQ= @@ -589,8 +587,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -602,8 +600,8 @@ github.com/mgechev/revive v1.3.2 h1:Wb8NQKBaALBJ3xrrj4zpwJwqwNA6nDpyJSEQWcCka6U= github.com/mgechev/revive v1.3.2/go.mod h1:UCLtc7o5vg5aXCwdUTU1kEBQ1v+YXPAkYDIDXbrs5I0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo= -github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= +github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= +github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= @@ -637,8 +635,8 @@ github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9 github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= -github.com/multiformats/go-multiaddr v0.11.0 h1:XqGyJ8ufbCE0HmTDwx2kPdsrQ36AGPZNZX6s6xfJH10= -github.com/multiformats/go-multiaddr v0.11.0/go.mod h1:gWUm0QLR4thQ6+ZF6SXUw8YjtwQSPapICM+NmCkxHSM= +github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= +github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= @@ -652,8 +650,8 @@ github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= -github.com/multiformats/go-multistream v0.4.1 h1:rFy0Iiyn3YT0asivDUIR05leAdwZq3de4741sbiSdfo= -github.com/multiformats/go-multistream v0.4.1/go.mod h1:Mz5eykRVAjJWckE2U78c6xqdtyNUEhKSM0Lwar2p77Q= +github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf/QGkvOGQAyiE= +github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= @@ -676,10 +674,10 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= -github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -749,12 +747,12 @@ github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4l github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= -github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM= -github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE= -github.com/quic-go/quic-go v0.38.1/go.mod h1:ijnZM7JsFIkp4cRyjxJNIzdSfCLmUMg9wdyhGmg+SN4= -github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU= -github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU= +github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= +github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= +github.com/quic-go/quic-go v0.39.3 h1:o3YB6t2SR+HU/pgwF29kJ6g4jJIJEwEZ8CKia1h1TKg= +github.com/quic-go/quic-go v0.39.3/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= +github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= +github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -944,12 +942,14 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= -go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= -go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= -go.uber.org/fx v1.20.0/go.mod h1:qCUj0btiR3/JnanEr1TYEePfSw6o/4qYJscgvzQ5Ub0= +go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= +go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.20.1 h1:zVwVQGS8zYvhh9Xxcu4w1M6ESyeMzebzj2NbSayZ4Mk= +go.uber.org/fx v1.20.1/go.mod h1:iSYNbHf2y55acNCwCXKx7LbWb5WG1Bnue5RDXz1OREg= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= +go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -988,8 +988,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= @@ -1025,8 +1025,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1074,8 +1074,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1102,8 +1102,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1276,8 +1276,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 9f3251c1b0f59b06d6a1210d866d6bd10c60f465 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 3 Nov 2023 08:37:51 +0100 Subject: [PATCH 260/286] feat: add WebRTC Direct support --- config/swarm.go | 11 ++-- core/node/libp2p/transport.go | 10 ++++ docs/changelogs/v0.24.md | 12 ++++ docs/config.md | 14 +++++ docs/examples/kubo-as-a-library/go.mod | 19 +++++++ docs/examples/kubo-as-a-library/go.sum | 77 ++++++++++++++++++++++++++ go.mod | 16 ++++++ go.sum | 76 +++++++++++++++++++++++++ test/cli/transports_test.go | 18 ++++++ 9 files changed, 248 insertions(+), 5 deletions(-) diff --git a/config/swarm.go b/config/swarm.go index 45b8a9a5205..16c52b4a5dd 100644 --- a/config/swarm.go +++ b/config/swarm.go @@ -98,12 +98,13 @@ type Transports struct { // listen on a transport, add the transport to your Addresses.Swarm. Network struct { // All default to on. - QUIC Flag `json:",omitempty"` - TCP Flag `json:",omitempty"` - Websocket Flag `json:",omitempty"` - Relay Flag `json:",omitempty"` - // except WebTransport which is experimental and optin. + QUIC Flag `json:",omitempty"` + TCP Flag `json:",omitempty"` + Websocket Flag `json:",omitempty"` + Relay Flag `json:",omitempty"` WebTransport Flag `json:",omitempty"` + // except WebRTCDirect which is experimental and opt-in. + WebRTCDirect Flag `json:",omitempty"` } // Security specifies the transports used to encrypt insecure network diff --git a/core/node/libp2p/transport.go b/core/node/libp2p/transport.go index 8e04a63ffc8..797917b72cb 100644 --- a/core/node/libp2p/transport.go +++ b/core/node/libp2p/transport.go @@ -8,6 +8,7 @@ import ( "github.com/libp2p/go-libp2p/core/metrics" quic "github.com/libp2p/go-libp2p/p2p/transport/quic" "github.com/libp2p/go-libp2p/p2p/transport/tcp" + webrtc "github.com/libp2p/go-libp2p/p2p/transport/webrtc" "github.com/libp2p/go-libp2p/p2p/transport/websocket" webtransport "github.com/libp2p/go-libp2p/p2p/transport/webtransport" @@ -49,6 +50,15 @@ func Transports(tptConfig config.Transports) interface{} { opts.Opts = append(opts.Opts, libp2p.Transport(webtransport.New)) } + if tptConfig.Network.WebRTCDirect.WithDefault(false) { + if privateNetworkEnabled { + return opts, fmt.Errorf( + "WebRTC Direct transport does not support private networks, please disable Swarm.Transports.Network.WebRTCDirect", + ) + } + opts.Opts = append(opts.Opts, libp2p.Transport(webrtc.New)) + } + return opts, nil } } diff --git a/docs/changelogs/v0.24.md b/docs/changelogs/v0.24.md index 29d88d9cbd0..1a80e34370f 100644 --- a/docs/changelogs/v0.24.md +++ b/docs/changelogs/v0.24.md @@ -10,6 +10,7 @@ - [Gateway: the root of the CARs are no longer meaningful](#gateway-the-root-of-the-cars-are-no-longer-meaningful) - [IPNS: improved publishing defaults](#ipns-improved-publishing-defaults) - [IPNS: record TTL is used for caching](#ipns-record-ttl-is-used-for-caching) + - [WebRTC Direct Transport](#webrtc-direct-transport) - [📝 Changelog](#-changelog) - [👨‍👩‍👧‍👦 Contributors](#-contributors) @@ -68,6 +69,17 @@ DHT, for updates. The TTL value in the IPNS record now serves as a hint for: These changes make it easier for rarely updated IPNS-hosted websites to be cached more efficiently and load faster in browser contexts. +#### WebRTC Direct Transport + +[WebRTC Direct](https://github.com/libp2p/go-libp2p/pull/2337) has now been introduced +in [`go-libp2p`](https://github.com/libp2p/go-libp2p/releases/tag/v0.32.0) v0.32.0. This +transport protocol allows browser nodes to connect to other nodes without special configuration, +such as TLS certificates. This can be useful for browsers that do not yet support +WebTransport, for example. + +Note that, at the moment, WebRTC Direct cannot be used to connect to a browser node to a +node that is behind a NAT or firewall. This is being worked on [`go-libp2p#2009`](https://github.com/libp2p/go-libp2p/issues/2009). + ### 📝 Changelog ### 👨‍👩‍👧‍👦 Contributors diff --git a/docs/config.md b/docs/config.md index e70b54b3ac0..1280ec9f412 100644 --- a/docs/config.md +++ b/docs/config.md @@ -159,6 +159,7 @@ config file at runtime. - [`Swarm.Transports.Network.QUIC`](#swarmtransportsnetworkquic) - [`Swarm.Transports.Network.Relay`](#swarmtransportsnetworkrelay) - [`Swarm.Transports.Network.WebTransport`](#swarmtransportsnetworkwebtransport) + - [`Swarm.Transports.Network.WebRTCDirect`](#swarmtransportsnetworkwebrtcdirect) - [`Swarm.Transports.Security`](#swarmtransportssecurity) - [`Swarm.Transports.Security.TLS`](#swarmtransportssecuritytls) - [`Swarm.Transports.Security.SECIO`](#swarmtransportssecuritysecio) @@ -2072,6 +2073,19 @@ Default: Enabled Type: `flag` +#### `Swarm.Transports.Network.WebRTCDirect` + +A new feature of [`go-libp2p`](https://github.com/libp2p/go-libp2p/releases/tag/v0.32.0) +is the [WebRTC Direct](https://github.com/libp2p/go-libp2p/pull/2337) transport. + +WebRTC Direct is a transport protocol that provides another way for browsers to connect to the rest of the libp2p network. WebRTC Direct allows for browser nodes to connect to other nodes without special configuration, such as TLS certificates. This can be useful for browser nodes that do not yet support WebTransport, for example. + +Note that, at the moment, WebRTC Direct cannot be used to connect to a browser node to a node that is behind a NAT or firewall. This is being worked on [`go-libp2p#2009`](https://github.com/libp2p/go-libp2p/issues/2009). + +Default: Disabled + +Type: `flag` + ### `Swarm.Transports.Security` Configuration section for libp2p _security_ transports. Transports enabled in diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index da95b3f70eb..5b129929cb8 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -30,6 +30,7 @@ require ( github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect github.com/cskr/pubsub v1.0.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/dgraph-io/badger v1.6.2 // indirect @@ -142,7 +143,24 @@ require ( github.com/openzipkin/zipkin-go v0.4.1 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect + github.com/pion/datachannel v1.5.5 // indirect + github.com/pion/dtls/v2 v2.2.7 // indirect + github.com/pion/ice/v2 v2.3.6 // indirect + github.com/pion/interceptor v0.1.17 // indirect + github.com/pion/logging v0.2.2 // indirect + github.com/pion/mdns v0.0.7 // indirect + github.com/pion/randutil v0.1.0 // indirect + github.com/pion/rtcp v1.2.10 // indirect + github.com/pion/rtp v1.7.13 // indirect + github.com/pion/sctp v1.8.7 // indirect + github.com/pion/sdp/v3 v3.0.6 // indirect + github.com/pion/srtp/v2 v2.0.15 // indirect + github.com/pion/stun v0.6.0 // indirect + github.com/pion/transport/v2 v2.2.1 // indirect + github.com/pion/turn/v2 v2.1.0 // indirect + github.com/pion/webrtc/v3 v3.2.9 // 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/prometheus/client_golang v1.17.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect @@ -155,6 +173,7 @@ require ( github.com/raulk/go-watchdog v1.3.0 // indirect github.com/samber/lo v1.36.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/stretchr/testify v1.8.4 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/ucarion/urlpath v0.0.0-20200424170820-7ccc79b76bbb // indirect github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc // indirect diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index 42bb1aa3046..f5f0385e377 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -178,6 +178,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= @@ -260,6 +261,7 @@ github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0Z github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= @@ -591,16 +593,20 @@ github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJE github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= @@ -617,6 +623,45 @@ github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhM github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 h1:1/WtZae0yGtPq+TI6+Tv1WTxkukpXeMlviSxvL7SRgk= github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9/go.mod h1:x3N5drFsm2uilKKuuYo6LdyD8vZAW55sH/9w+pbo1sw= +github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew8= +github.com/pion/datachannel v1.5.5/go.mod h1:iMz+lECmfdCMqFRhXhcA/219B0SQlbpoR2V118yimL0= +github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= +github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= +github.com/pion/ice/v2 v2.3.6 h1:Jgqw36cAud47iD+N6rNX225uHvrgWtAlHfVyOQc3Heg= +github.com/pion/ice/v2 v2.3.6/go.mod h1:9/TzKDRwBVAPsC+YOrKH/e3xDrubeTRACU9/sHQarsU= +github.com/pion/interceptor v0.1.17 h1:prJtgwFh/gB8zMqGZoOgJPHivOwVAp61i2aG61Du/1w= +github.com/pion/interceptor v0.1.17/go.mod h1:SY8kpmfVBvrbUzvj2bsXz7OJt5JvmVNZ+4Kjq7FcwrI= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/mdns v0.0.7 h1:P0UB4Sr6xDWEox0kTVxF0LmQihtCbSAdW0H2nEgkA3U= +github.com/pion/mdns v0.0.7/go.mod h1:4iP2UbeFhLI/vWju/bw6ZfwjJzk0z8DNValjGxR/dD8= +github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= +github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= +github.com/pion/rtcp v1.2.10 h1:nkr3uj+8Sp97zyItdN60tE/S6vk4al5CPRR6Gejsdjc= +github.com/pion/rtcp v1.2.10/go.mod h1:ztfEwXZNLGyF1oQDttz/ZKIBaeeg/oWbRYqzBM9TL1I= +github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA= +github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= +github.com/pion/sctp v1.8.5/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0= +github.com/pion/sctp v1.8.7 h1:JnABvFakZueGAn4KU/4PSKg+GWbF6QWbKTWZOSGJjXw= +github.com/pion/sctp v1.8.7/go.mod h1:g1Ul+ARqZq5JEmoFy87Q/4CePtKnTJ1QCL9dBBdN6AU= +github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw= +github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= +github.com/pion/srtp/v2 v2.0.15 h1:+tqRtXGsGwHC0G0IUIAzRmdkHvriF79IHVfZGfHrQoA= +github.com/pion/srtp/v2 v2.0.15/go.mod h1:b/pQOlDrbB0HEH5EUAQXzSYxikFbNcNuKmF8tM0hCtw= +github.com/pion/stun v0.4.0/go.mod h1:QPsh1/SbXASntw3zkkrIk3ZJVKz4saBY2G7S10P3wCw= +github.com/pion/stun v0.6.0 h1:JHT/2iyGDPrFWE8NNC15wnddBN8KifsEDw8swQmrEmU= +github.com/pion/stun v0.6.0/go.mod h1:HPqcfoeqQn9cuaet7AOmB5e5xkObu9DwBdurwLKO9oA= +github.com/pion/transport v0.14.1 h1:XSM6olwW+o8J4SCmOBb/BpwZypkHeyM0PGFCxNQBr40= +github.com/pion/transport v0.14.1/go.mod h1:4tGmbk00NeYA3rUa9+n+dzCCoKkcy3YlYb99Jn2fNnI= +github.com/pion/transport/v2 v2.0.0/go.mod h1:HS2MEBJTwD+1ZI2eSXSvHJx/HnzQqRy2/LXxt6eVMHc= +github.com/pion/transport/v2 v2.1.0/go.mod h1:AdSw4YBZVDkZm8fpoz+fclXyQwANWmZAlDuQdctTThQ= +github.com/pion/transport/v2 v2.2.0/go.mod h1:AdSw4YBZVDkZm8fpoz+fclXyQwANWmZAlDuQdctTThQ= +github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c= +github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= +github.com/pion/turn/v2 v2.1.0 h1:5wGHSgGhJhP/RpabkUb/T9PdsAjkGLS6toYz5HNzoSI= +github.com/pion/turn/v2 v2.1.0/go.mod h1:yrT5XbXSGX1VFSF31A3c1kCNB5bBZgk/uu5LET162qs= +github.com/pion/webrtc/v3 v3.2.9 h1:U8NSjQDlZZ+Iy/hg42Q/u6mhEVSXYvKrOIZiZwYTfLc= +github.com/pion/webrtc/v3 v3.2.9/go.mod h1:gjQLMZeyN3jXBGdxGmUYCyKjOuYX/c99BDjGqmadq0A= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -658,6 +703,7 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= github.com/samber/lo v1.36.0 h1:4LaOxH1mHnbDGhTVE0i1z8v/lWaQW8AIfOD3HU4mSaw= github.com/samber/lo v1.36.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= @@ -719,7 +765,10 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= @@ -845,6 +894,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -882,6 +933,7 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -923,9 +975,16 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -948,6 +1007,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -996,6 +1056,7 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1007,14 +1068,24 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1023,7 +1094,11 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1079,9 +1154,11 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/go.mod b/go.mod index b8fe887d0b6..5efc4d52668 100644 --- a/go.mod +++ b/go.mod @@ -185,6 +185,22 @@ require ( github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 // indirect + github.com/pion/datachannel v1.5.5 // indirect + github.com/pion/dtls/v2 v2.2.7 // indirect + github.com/pion/ice/v2 v2.3.6 // indirect + github.com/pion/interceptor v0.1.17 // indirect + github.com/pion/logging v0.2.2 // indirect + github.com/pion/mdns v0.0.7 // indirect + github.com/pion/randutil v0.1.0 // indirect + github.com/pion/rtcp v1.2.10 // indirect + github.com/pion/rtp v1.7.13 // indirect + github.com/pion/sctp v1.8.7 // indirect + github.com/pion/sdp/v3 v3.0.6 // indirect + github.com/pion/srtp/v2 v2.0.15 // indirect + github.com/pion/stun v0.6.0 // indirect + github.com/pion/transport/v2 v2.2.1 // indirect + github.com/pion/turn/v2 v2.1.0 // indirect + github.com/pion/webrtc/v3 v3.2.9 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.89.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect diff --git a/go.sum b/go.sum index c07381487ca..fed65f74af3 100644 --- a/go.sum +++ b/go.sum @@ -208,6 +208,7 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= @@ -293,6 +294,7 @@ github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0Z github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= @@ -669,16 +671,20 @@ github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJE github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= @@ -695,6 +701,45 @@ github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhM github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 h1:1/WtZae0yGtPq+TI6+Tv1WTxkukpXeMlviSxvL7SRgk= github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9/go.mod h1:x3N5drFsm2uilKKuuYo6LdyD8vZAW55sH/9w+pbo1sw= +github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew8= +github.com/pion/datachannel v1.5.5/go.mod h1:iMz+lECmfdCMqFRhXhcA/219B0SQlbpoR2V118yimL0= +github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= +github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= +github.com/pion/ice/v2 v2.3.6 h1:Jgqw36cAud47iD+N6rNX225uHvrgWtAlHfVyOQc3Heg= +github.com/pion/ice/v2 v2.3.6/go.mod h1:9/TzKDRwBVAPsC+YOrKH/e3xDrubeTRACU9/sHQarsU= +github.com/pion/interceptor v0.1.17 h1:prJtgwFh/gB8zMqGZoOgJPHivOwVAp61i2aG61Du/1w= +github.com/pion/interceptor v0.1.17/go.mod h1:SY8kpmfVBvrbUzvj2bsXz7OJt5JvmVNZ+4Kjq7FcwrI= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/mdns v0.0.7 h1:P0UB4Sr6xDWEox0kTVxF0LmQihtCbSAdW0H2nEgkA3U= +github.com/pion/mdns v0.0.7/go.mod h1:4iP2UbeFhLI/vWju/bw6ZfwjJzk0z8DNValjGxR/dD8= +github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= +github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= +github.com/pion/rtcp v1.2.10 h1:nkr3uj+8Sp97zyItdN60tE/S6vk4al5CPRR6Gejsdjc= +github.com/pion/rtcp v1.2.10/go.mod h1:ztfEwXZNLGyF1oQDttz/ZKIBaeeg/oWbRYqzBM9TL1I= +github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA= +github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= +github.com/pion/sctp v1.8.5/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0= +github.com/pion/sctp v1.8.7 h1:JnABvFakZueGAn4KU/4PSKg+GWbF6QWbKTWZOSGJjXw= +github.com/pion/sctp v1.8.7/go.mod h1:g1Ul+ARqZq5JEmoFy87Q/4CePtKnTJ1QCL9dBBdN6AU= +github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw= +github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= +github.com/pion/srtp/v2 v2.0.15 h1:+tqRtXGsGwHC0G0IUIAzRmdkHvriF79IHVfZGfHrQoA= +github.com/pion/srtp/v2 v2.0.15/go.mod h1:b/pQOlDrbB0HEH5EUAQXzSYxikFbNcNuKmF8tM0hCtw= +github.com/pion/stun v0.4.0/go.mod h1:QPsh1/SbXASntw3zkkrIk3ZJVKz4saBY2G7S10P3wCw= +github.com/pion/stun v0.6.0 h1:JHT/2iyGDPrFWE8NNC15wnddBN8KifsEDw8swQmrEmU= +github.com/pion/stun v0.6.0/go.mod h1:HPqcfoeqQn9cuaet7AOmB5e5xkObu9DwBdurwLKO9oA= +github.com/pion/transport v0.14.1 h1:XSM6olwW+o8J4SCmOBb/BpwZypkHeyM0PGFCxNQBr40= +github.com/pion/transport v0.14.1/go.mod h1:4tGmbk00NeYA3rUa9+n+dzCCoKkcy3YlYb99Jn2fNnI= +github.com/pion/transport/v2 v2.0.0/go.mod h1:HS2MEBJTwD+1ZI2eSXSvHJx/HnzQqRy2/LXxt6eVMHc= +github.com/pion/transport/v2 v2.1.0/go.mod h1:AdSw4YBZVDkZm8fpoz+fclXyQwANWmZAlDuQdctTThQ= +github.com/pion/transport/v2 v2.2.0/go.mod h1:AdSw4YBZVDkZm8fpoz+fclXyQwANWmZAlDuQdctTThQ= +github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c= +github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= +github.com/pion/turn/v2 v2.1.0 h1:5wGHSgGhJhP/RpabkUb/T9PdsAjkGLS6toYz5HNzoSI= +github.com/pion/turn/v2 v2.1.0/go.mod h1:yrT5XbXSGX1VFSF31A3c1kCNB5bBZgk/uu5LET162qs= +github.com/pion/webrtc/v3 v3.2.9 h1:U8NSjQDlZZ+Iy/hg42Q/u6mhEVSXYvKrOIZiZwYTfLc= +github.com/pion/webrtc/v3 v3.2.9/go.mod h1:gjQLMZeyN3jXBGdxGmUYCyKjOuYX/c99BDjGqmadq0A= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -765,6 +810,7 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= github.com/samber/lo v1.36.0 h1:4LaOxH1mHnbDGhTVE0i1z8v/lWaQW8AIfOD3HU4mSaw= github.com/samber/lo v1.36.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= @@ -828,6 +874,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc= @@ -982,6 +1030,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1019,6 +1069,7 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1063,12 +1114,19 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1097,6 +1155,7 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1150,6 +1209,7 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1166,14 +1226,24 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1184,7 +1254,11 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1240,9 +1314,11 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/test/cli/transports_test.go b/test/cli/transports_test.go index d37c78aad1a..c1642c602cd 100644 --- a/test/cli/transports_test.go +++ b/test/cli/transports_test.go @@ -58,6 +58,7 @@ func TestTransports(t *testing.T) { cfg.Swarm.Transports.Network.QUIC = config.False cfg.Swarm.Transports.Network.Relay = config.False cfg.Swarm.Transports.Network.WebTransport = config.False + cfg.Swarm.Transports.Network.WebRTCDirect = config.False cfg.Swarm.Transports.Network.Websocket = config.False }) }) @@ -148,4 +149,21 @@ func TestTransports(t *testing.T) { nodes.StartDaemons().Connect() runTests(nodes) }) + + t.Run("WebRTC Direct", func(t *testing.T) { + t.Parallel() + nodes := harness.NewT(t).NewNodes(5).Init() + nodes.ForEachPar(func(n *harness.Node) { + n.UpdateConfig(func(cfg *config.Config) { + cfg.Addresses.Swarm = []string{"/ip4/127.0.0.1/udp/0/webrtc-direct"} + cfg.Swarm.Transports.Network.TCP = config.False + cfg.Swarm.Transports.Network.QUIC = config.False + cfg.Swarm.Transports.Network.WebTransport = config.False + cfg.Swarm.Transports.Network.WebRTCDirect = config.True + }) + }) + disableRouting(nodes) + nodes.StartDaemons().Connect() + runTests(nodes) + }) } From 884a3f36d44e3359f3f5112abb87344cd6d51b49 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 3 Nov 2023 14:49:35 +0100 Subject: [PATCH 261/286] docs: make it clear Web RTC Direct is experimental --- docs/changelogs/v0.24.md | 4 ++-- docs/config.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/changelogs/v0.24.md b/docs/changelogs/v0.24.md index 1a80e34370f..34a8490b050 100644 --- a/docs/changelogs/v0.24.md +++ b/docs/changelogs/v0.24.md @@ -10,7 +10,7 @@ - [Gateway: the root of the CARs are no longer meaningful](#gateway-the-root-of-the-cars-are-no-longer-meaningful) - [IPNS: improved publishing defaults](#ipns-improved-publishing-defaults) - [IPNS: record TTL is used for caching](#ipns-record-ttl-is-used-for-caching) - - [WebRTC Direct Transport](#webrtc-direct-transport) + - [Experimental Transport: WebRTC Direct](#experimental-transport-webrtc-direct) - [📝 Changelog](#-changelog) - [👨‍👩‍👧‍👦 Contributors](#-contributors) @@ -69,7 +69,7 @@ DHT, for updates. The TTL value in the IPNS record now serves as a hint for: These changes make it easier for rarely updated IPNS-hosted websites to be cached more efficiently and load faster in browser contexts. -#### WebRTC Direct Transport +#### Experimental Transport: WebRTC Direct [WebRTC Direct](https://github.com/libp2p/go-libp2p/pull/2337) has now been introduced in [`go-libp2p`](https://github.com/libp2p/go-libp2p/releases/tag/v0.32.0) v0.32.0. This diff --git a/docs/config.md b/docs/config.md index 1280ec9f412..1c8b0ed8671 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2075,6 +2075,8 @@ Type: `flag` #### `Swarm.Transports.Network.WebRTCDirect` +**Experimental:** the support for WebRTC Direct is currently experimental. + A new feature of [`go-libp2p`](https://github.com/libp2p/go-libp2p/releases/tag/v0.32.0) is the [WebRTC Direct](https://github.com/libp2p/go-libp2p/pull/2337) transport. From f17a06419355afbae3cdb1675675500fa5e17b9d Mon Sep 17 00:00:00 2001 From: Jonas Keunecke Date: Mon, 6 Nov 2023 00:49:12 +0100 Subject: [PATCH 262/286] docs/config: remove extra commas in PublicGateways example entries --- docs/config.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/config.md b/docs/config.md index 1c8b0ed8671..630532381b5 100644 --- a/docs/config.md +++ b/docs/config.md @@ -761,7 +761,7 @@ between content roots. "PublicGateways": { "dweb.link": { "UseSubdomains": true, - "Paths": ["/ipfs", "/ipns"], + "Paths": ["/ipfs", "/ipns"] } } } @@ -776,7 +776,7 @@ between content roots. "PublicGateways": { "ipfs.io": { "UseSubdomains": false, - "Paths": ["/ipfs", "/ipns", "/api"], + "Paths": ["/ipfs", "/ipns", "/api"] } } } From 63e89d4987294b09e55ee3571fb945efdf1539ac Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Mon, 6 Nov 2023 15:24:06 +0100 Subject: [PATCH 263/286] docs: fix accelerated-dht-client --- docs/experimental-features.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/experimental-features.md b/docs/experimental-features.md index 1f02dc3c8c0..6826a38c2f2 100644 --- a/docs/experimental-features.md +++ b/docs/experimental-features.md @@ -663,3 +663,7 @@ ipfs config --json Experimental.GatewayOverLibp2p true - [ ] Needs UX work for exposing non-recursive "HTTP transport" (NoFetch) over both libp2p and plain TCP (and sharing the configuration) - [ ] Needs a mechanism for HTTP handler to signal supported features ([IPIP-425](https://github.com/ipfs/specs/pull/425)) - [ ] Needs an option for Kubo to detect peers that have it enabled and prefer HTTP transport before falling back to bitswap (and use CAR if peer supports dag-scope=entity from [IPIP-402](https://github.com/ipfs/specs/pull/402)) + +## Accelerated DHT Client + +This feature now lives at [`Routing.AcceleratedDHTClient`](https://github.com/ipfs/kubo/blob/master/docs/config.md#routingaccelerateddhtclient). From 068f17650d49f48e8ed179e173a21745013690ff Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 7 Nov 2023 18:10:59 +0100 Subject: [PATCH 264/286] chore: update go-libp2p --- 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 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index 5b129929cb8..a370e26a362 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -9,7 +9,7 @@ replace github.com/ipfs/kubo => ./../../.. require ( github.com/ipfs/boxo v0.15.0 github.com/ipfs/kubo v0.0.0-00010101000000-000000000000 - github.com/libp2p/go-libp2p v0.32.0 + github.com/libp2p/go-libp2p v0.32.1 github.com/multiformats/go-multiaddr v0.12.0 ) diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index f5f0385e377..52792597383 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -463,8 +463,8 @@ github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZ github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.32.0 h1:86I4B7nBUPIyTgw3+5Ibq6K7DdKRCuZw8URCfPc1hQM= -github.com/libp2p/go-libp2p v0.32.0/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= +github.com/libp2p/go-libp2p v0.32.1 h1:wy1J4kZIZxOaej6NveTWCZmHiJ/kY7GoAqXgqNCnPps= +github.com/libp2p/go-libp2p v0.32.1/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= diff --git a/go.mod b/go.mod index 5efc4d52668..b4797b84a4c 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/jbenet/goprocess v0.1.4 github.com/julienschmidt/httprouter v1.3.0 github.com/libp2p/go-doh-resolver v0.4.0 - github.com/libp2p/go-libp2p v0.32.0 + github.com/libp2p/go-libp2p v0.32.1 github.com/libp2p/go-libp2p-http v0.5.0 github.com/libp2p/go-libp2p-kad-dht v0.24.4 github.com/libp2p/go-libp2p-kbucket v0.6.3 diff --git a/go.sum b/go.sum index fed65f74af3..0a52cb58518 100644 --- a/go.sum +++ b/go.sum @@ -519,8 +519,8 @@ github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZ github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.32.0 h1:86I4B7nBUPIyTgw3+5Ibq6K7DdKRCuZw8URCfPc1hQM= -github.com/libp2p/go-libp2p v0.32.0/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= +github.com/libp2p/go-libp2p v0.32.1 h1:wy1J4kZIZxOaej6NveTWCZmHiJ/kY7GoAqXgqNCnPps= +github.com/libp2p/go-libp2p v0.32.1/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index b10e8c00f31..dd6346b62e2 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -19,7 +19,7 @@ require ( github.com/ipld/go-ipld-prime v0.21.0 github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c github.com/jbenet/go-random-files v0.0.0-20190219210431-31b3f20ebded - github.com/libp2p/go-libp2p v0.32.0 + github.com/libp2p/go-libp2p v0.32.1 github.com/multiformats/go-multiaddr v0.12.0 github.com/multiformats/go-multihash v0.2.3 gotest.tools/gotestsum v0.4.2 diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index 1c01c63202f..8c901272223 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -542,8 +542,8 @@ github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38y github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.32.0 h1:86I4B7nBUPIyTgw3+5Ibq6K7DdKRCuZw8URCfPc1hQM= -github.com/libp2p/go-libp2p v0.32.0/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= +github.com/libp2p/go-libp2p v0.32.1 h1:wy1J4kZIZxOaej6NveTWCZmHiJ/kY7GoAqXgqNCnPps= +github.com/libp2p/go-libp2p v0.32.1/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-kad-dht v0.24.4 h1:ktNiJe7ffsJ1wX3ULpMCwXts99mPqGFSE/Qn1i8pErQ= From 9371d18b5325030807abc1c064efc36055205cf3 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Wed, 8 Nov 2023 01:07:10 -0500 Subject: [PATCH 265/286] fixes to routing put command (#10205) * fix(commands): routing put command returns the IPNS ID rather than the host's ID * fix(commands): routing put command errors with the allow-offline hint if the error is an offline error * fix: test expects correct error message --------- Co-authored-by: Henrique Dias --- core/commands/routing.go | 7 ++++--- test/cli/dht_legacy_test.go | 2 +- test/cli/routing_dht_test.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/commands/routing.go b/core/commands/routing.go index 6d0ddb1c864..99aa4a78df7 100644 --- a/core/commands/routing.go +++ b/core/commands/routing.go @@ -14,6 +14,7 @@ import ( iface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/coreiface/options" dag "github.com/ipfs/boxo/ipld/merkledag" + "github.com/ipfs/boxo/ipns" cid "github.com/ipfs/go-cid" cmds "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" @@ -451,12 +452,12 @@ identified by QmFoo. options.Put.AllowOffline(allowOffline), } - err = api.Routing().Put(req.Context, req.Arguments[0], data, opts...) + ipnsName, err := ipns.NameFromString(req.Arguments[0]) if err != nil { return err } - id, err := api.Key().Self(req.Context) + err = api.Routing().Put(req.Context, req.Arguments[0], data, opts...) if err != nil { if err == iface.ErrOffline { err = errAllowOffline @@ -466,7 +467,7 @@ identified by QmFoo. return res.Emit(routing.QueryEvent{ Type: routing.Value, - ID: id.ID(), + ID: ipnsName.Peer(), }) }, Encoders: cmds.EncoderMap{ diff --git a/test/cli/dht_legacy_test.go b/test/cli/dht_legacy_test.go index 2b90d164cb2..cfcb4f0cd09 100644 --- a/test/cli/dht_legacy_test.go +++ b/test/cli/dht_legacy_test.go @@ -131,7 +131,7 @@ func TestLegacyDHT(t *testing.T) { node.WriteBytes("foo", []byte("foo")) res := node.RunIPFS("dht", "put", "/ipns/"+node.PeerID().String(), "foo") assert.Equal(t, 1, res.ExitCode()) - assert.Contains(t, res.Stderr.String(), "this action must be run in online mode") + assert.Contains(t, res.Stderr.String(), "can't put while offline: pass `--allow-offline` to override") }) }) } diff --git a/test/cli/routing_dht_test.go b/test/cli/routing_dht_test.go index 3a3adc51c51..fb0d391951e 100644 --- a/test/cli/routing_dht_test.go +++ b/test/cli/routing_dht_test.go @@ -111,7 +111,7 @@ func testRoutingDHT(t *testing.T, enablePubsub bool) { node.WriteBytes("foo", []byte("foo")) res := node.RunIPFS("routing", "put", "/ipns/"+node.PeerID().String(), "foo") assert.Equal(t, 1, res.ExitCode()) - assert.Contains(t, res.Stderr.String(), "this action must be run in online mode") + assert.Contains(t, res.Stderr.String(), "can't put while offline: pass `--allow-offline` to override") }) }) }) From 846310e5ac98dee29eae1b71bf5ef7e2a022f490 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Wed, 8 Nov 2023 01:09:29 -0500 Subject: [PATCH 266/286] fix: allow event emitting to happen in parallel with getting the query channel --- core/commands/routing.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/commands/routing.go b/core/commands/routing.go index 99aa4a78df7..1f96c4deaad 100644 --- a/core/commands/routing.go +++ b/core/commands/routing.go @@ -81,10 +81,9 @@ var findProvidersRoutingCmd = &cmds.Command{ ctx, cancel := context.WithCancel(req.Context) ctx, events := routing.RegisterForQueryEvents(ctx) - pchan := n.Routing.FindProvidersAsync(ctx, c, numProviders) - go func() { defer cancel() + pchan := n.Routing.FindProvidersAsync(ctx, c, numProviders) for p := range pchan { np := p routing.PublishQueryEvent(ctx, &routing.QueryEvent{ From 9655d9290857f54e68b5266439a596b4015e02c4 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 8 Nov 2023 13:02:58 +0000 Subject: [PATCH 267/286] chore: create next changelog --- CHANGELOG.md | 1 + docs/changelogs/v0.25.md | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 docs/changelogs/v0.25.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f75314a9b2..7fd7e8f76b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Kubo Changelogs +- [v0.25](docs/changelogs/v0.25.md) - [v0.24](docs/changelogs/v0.24.md) - [v0.23](docs/changelogs/v0.23.md) - [v0.22](docs/changelogs/v0.22.md) diff --git a/docs/changelogs/v0.25.md b/docs/changelogs/v0.25.md new file mode 100644 index 00000000000..1388ddd90d5 --- /dev/null +++ b/docs/changelogs/v0.25.md @@ -0,0 +1,18 @@ +# Kubo changelog v0.25 + +- [v0.25.0](#v0250) + +## v0.25.0 + +- [Overview](#overview) +- [🔦 Highlights](#-highlights) +- [📝 Changelog](#-changelog) +- [👨‍👩‍👧‍👦 Contributors](#-contributors) + +### Overview + +### 🔦 Highlights + +### 📝 Changelog + +### 👨‍👩‍👧‍👦 Contributors From 7834a26d034dad9fda0e08d4bcd31052bbb969f5 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 9 Nov 2023 01:42:04 +0100 Subject: [PATCH 268/286] docs(changelog): clarify webrtc in v0.24 This sets the expectations (not production ready) and gives users hint how to enable it by adding `/udp/4001/webrtc-direct` listener. --- docs/changelogs/v0.24.md | 22 ++++++++++++++-------- docs/config.md | 26 +++++++++++++++++++------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/docs/changelogs/v0.24.md b/docs/changelogs/v0.24.md index 7bc04dc92d1..9ca7fa84eb6 100644 --- a/docs/changelogs/v0.24.md +++ b/docs/changelogs/v0.24.md @@ -71,14 +71,20 @@ cached more efficiently and load faster in browser contexts. #### Experimental Transport: WebRTC Direct -[WebRTC Direct](https://github.com/libp2p/go-libp2p/pull/2337) has now been introduced -in [`go-libp2p`](https://github.com/libp2p/go-libp2p/releases/tag/v0.32.0) v0.32.0. This -transport protocol allows browser nodes to connect to other nodes without special configuration, -such as TLS certificates. This can be useful for browsers that do not yet support -WebTransport, for example. - -Note that, at the moment, WebRTC Direct cannot be used to connect to a browser node to a -node that is behind a NAT or firewall. This is being worked on [`go-libp2p#2009`](https://github.com/libp2p/go-libp2p/issues/2009). +This Kubo release includes the initial work towards WebRTC Direct +introduced in [`go-libp2p`](https://github.com/libp2p/go-libp2p/releases/tag/v0.32.0) v0.32: + +> [WebRTC Direct](https://github.com/libp2p/specs/blob/master/webrtc/webrtc-direct.md) +> allows browser nodes to connect to go-libp2p nodes directly, +> without any configuration (e.g. TLS certificates) needed on the go-libp2p +> side. This is useful for browser nodes that aren’t able to use +> [WebTransport](https://blog.libp2p.io/2022-12-19-libp2p-webtransport/). + +The `/webrtc-direct` transport is disabled by default in Kubo 0.24, +and not ready for production use yet, but we plan to enable it in a future release. + +See [`Swarm.Transports.Network.WebRTCDirect`](https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmtransportsnetworkwebrtcdirect) +to learn how to enable it manually, and what current limitations are. ### 📝 Changelog diff --git a/docs/config.md b/docs/config.md index 630532381b5..49e761100dd 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2076,13 +2076,25 @@ Type: `flag` #### `Swarm.Transports.Network.WebRTCDirect` **Experimental:** the support for WebRTC Direct is currently experimental. - -A new feature of [`go-libp2p`](https://github.com/libp2p/go-libp2p/releases/tag/v0.32.0) -is the [WebRTC Direct](https://github.com/libp2p/go-libp2p/pull/2337) transport. - -WebRTC Direct is a transport protocol that provides another way for browsers to connect to the rest of the libp2p network. WebRTC Direct allows for browser nodes to connect to other nodes without special configuration, such as TLS certificates. This can be useful for browser nodes that do not yet support WebTransport, for example. - -Note that, at the moment, WebRTC Direct cannot be used to connect to a browser node to a node that is behind a NAT or firewall. This is being worked on [`go-libp2p#2009`](https://github.com/libp2p/go-libp2p/issues/2009). +This feature was introduced in [`go-libp2p@v0.32.0`](https://github.com/libp2p/go-libp2p/releases/tag/v0.32.0). + +[WebRTC Direct](https://github.com/libp2p/specs/blob/master/webrtc/webrtc-direct.md) +is a transport protocol that provides another way for browsers to +connect to the rest of the libp2p network. WebRTC Direct allows for browser +nodes to connect to other nodes without special configuration, such as TLS +certificates. This can be useful for browser nodes that do not yet support +[WebTransport](https://blog.libp2p.io/2022-12-19-libp2p-webtransport/). + +Enabling this transport allows Kubo node to act on `/udp/4001/webrtc-direct` +listeners defined in `Addresses.Swarm`, `Addresses.Announce` or +`Addresses.AppendAnnounce`. + +**NOTE:** at the moment, WebRTC Direct cannot be used to connect to a browser +node to a node that is behind a NAT or firewall. +This requires using normal +[WebRTC](https://github.com/libp2p/specs/blob/master/webrtc/webrtc.md), +which is currently being worked on in +[go-libp2p#2009](https://github.com/libp2p/go-libp2p/issues/2009). Default: Disabled From 670ce7043e3b0af52a25a69569464cd3c256d3ee Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 8 Nov 2023 21:30:38 +0100 Subject: [PATCH 269/286] fix: regression in 'ipfs dns' this command used to work with domain without `/ipns/` prefix. we've switched it to the same backend as `resolve` command, which requires the prefix, so we add it if it is missing --- core/commands/dns.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/commands/dns.go b/core/commands/dns.go index 5126a6cb153..065b4acdc9a 100644 --- a/core/commands/dns.go +++ b/core/commands/dns.go @@ -3,6 +3,7 @@ package commands import ( "fmt" "io" + "strings" namesys "github.com/ipfs/boxo/namesys" "github.com/ipfs/boxo/path" @@ -19,7 +20,7 @@ const ( var DNSCmd = &cmds.Command{ Status: cmds.Deprecated, // https://github.com/ipfs/kubo/issues/8607 Helptext: cmds.HelpText{ - Tagline: "Resolve DNSLink records.", + Tagline: "Resolve DNSLink records. Deprecated: Use 'ipfs resolve /ipns/domain-name' instead.", ShortDescription: ` This command can only recursively resolve DNSLink TXT records. It will fail to recursively resolve through IPNS keys etc. @@ -52,6 +53,10 @@ It will work across multiple DNSLinks and IPNS keys. routing = append(routing, namesys.ResolveWithDepth(1)) } + if !strings.HasPrefix(name, "/ipns/") { + name = "/ipns/" + name + } + p, err := path.NewPath(name) if err != nil { return err From 0770702289fcc77952e92814242764e99557edb9 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 15 Nov 2023 15:32:25 +0100 Subject: [PATCH 270/286] docs: clarify ipfs id agent version --- cmd/ipfs/daemon.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index d9207b0f61a..62d5616c7fe 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -175,7 +175,7 @@ Headers. cmds.BoolOption(enablePubSubKwd, "DEPRECATED"), cmds.BoolOption(enableIPNSPubSubKwd, "Enable IPNS over pubsub. Implicitly enables pubsub, overrides Ipns.UsePubsub config."), cmds.BoolOption(enableMultiplexKwd, "DEPRECATED"), - cmds.StringOption(agentVersionSuffix, "Optional suffix to the AgentVersion presented by `ipfs id` and also advertised through BitSwap."), + cmds.StringOption(agentVersionSuffix, "Optional suffix to the AgentVersion presented by `ipfs id` and exposed via libp2p identify protocol."), // TODO: add way to override addresses. tricky part: updating the config if also --init. // cmds.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"), From 01cc5eab57ed7acab1593280c7b5565d18c8f3ae Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 17 Nov 2023 01:29:29 +0100 Subject: [PATCH 271/286] feat(rpc): Opt-in HTTP RPC API Authorization (#10218) Context: https://github.com/ipfs/kubo/issues/10187 Co-authored-by: Marcin Rataj --- client/rpc/auth/auth.go | 29 +++++++ cmd/ipfs/daemon.go | 4 + cmd/ipfs/main.go | 8 ++ config/api.go | 60 +++++++++++++- config/api_test.go | 22 ++++++ core/commands/config.go | 5 ++ core/commands/root.go | 4 +- core/corehttp/commands.go | 51 ++++++++++++ docs/changelogs/v0.25.md | 14 ++++ docs/config.md | 84 ++++++++++++++++++++ test/cli/harness/node.go | 29 +++++-- test/cli/rpc_auth_test.go | 162 ++++++++++++++++++++++++++++++++++++++ 12 files changed, 463 insertions(+), 9 deletions(-) create mode 100644 client/rpc/auth/auth.go create mode 100644 config/api_test.go create mode 100644 test/cli/rpc_auth_test.go diff --git a/client/rpc/auth/auth.go b/client/rpc/auth/auth.go new file mode 100644 index 00000000000..a6ed273cd1a --- /dev/null +++ b/client/rpc/auth/auth.go @@ -0,0 +1,29 @@ +package auth + +import "net/http" + +var _ http.RoundTripper = &AuthorizedRoundTripper{} + +type AuthorizedRoundTripper struct { + authorization string + roundTripper http.RoundTripper +} + +// NewAuthorizedRoundTripper creates a new [http.RoundTripper] that will set the +// Authorization HTTP header with the value of [authorization]. The given [roundTripper] is +// the base [http.RoundTripper]. If it is nil, [http.DefaultTransport] is used. +func NewAuthorizedRoundTripper(authorization string, roundTripper http.RoundTripper) http.RoundTripper { + if roundTripper == nil { + roundTripper = http.DefaultTransport + } + + return &AuthorizedRoundTripper{ + authorization: authorization, + roundTripper: roundTripper, + } +} + +func (tp *AuthorizedRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { + r.Header.Set("Authorization", tp.authorization) + return tp.roundTripper.RoundTrip(r) +} diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index 62d5616c7fe..1375d464de3 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -676,6 +676,10 @@ func serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, error listeners = append(listeners, apiLis) } + if len(cfg.API.Authorizations) > 0 && len(listeners) > 0 { + fmt.Printf("RPC API access is limited by the rules defined in API.Authorizations\n") + } + for _, listener := range listeners { // we might have listened to /tcp/0 - let's see what we are listing on fmt.Printf("RPC API server listening on %s\n", listener.Multiaddr()) diff --git a/cmd/ipfs/main.go b/cmd/ipfs/main.go index 3909e18162c..f135f28feb8 100644 --- a/cmd/ipfs/main.go +++ b/cmd/ipfs/main.go @@ -23,8 +23,10 @@ import ( cmdhttp "github.com/ipfs/go-ipfs-cmds/http" logging "github.com/ipfs/go-log" ipfs "github.com/ipfs/kubo" + "github.com/ipfs/kubo/client/rpc/auth" "github.com/ipfs/kubo/cmd/ipfs/util" oldcmds "github.com/ipfs/kubo/commands" + config "github.com/ipfs/kubo/config" "github.com/ipfs/kubo/core" corecmds "github.com/ipfs/kubo/core/commands" "github.com/ipfs/kubo/core/corehttp" @@ -325,6 +327,12 @@ func makeExecutor(req *cmds.Request, env interface{}) (cmds.Executor, error) { return nil, fmt.Errorf("unsupported API address: %s", apiAddr) } + apiAuth, specified := req.Options[corecmds.ApiAuthOption].(string) + if specified { + authorization := config.ConvertAuthSecret(apiAuth) + tpt = auth.NewAuthorizedRoundTripper(authorization, tpt) + } + httpClient := &http.Client{ Transport: otelhttp.NewTransport(tpt), } diff --git a/config/api.go b/config/api.go index b36b1080304..a626a272a49 100644 --- a/config/api.go +++ b/config/api.go @@ -1,5 +1,63 @@ package config +import ( + "encoding/base64" + "strings" +) + +const ( + APITag = "API" + AuthorizationTag = "Authorizations" +) + +type RPCAuthScope struct { + // AuthSecret is the secret that will be compared to the HTTP "Authorization". + // header. A secret is in the format "type:value". Check the documentation for + // supported types. + AuthSecret string + + // AllowedPaths is an explicit list of RPC path prefixes to allow. + // By default, none are allowed. ["/api/v0"] exposes all RPCs. + AllowedPaths []string +} + type API struct { - HTTPHeaders map[string][]string // HTTP headers to return with the API. + // HTTPHeaders are the HTTP headers to return with the API. + HTTPHeaders map[string][]string + + // Authorization is a map of authorizations used to authenticate in the API. + // If the map is empty, then the RPC API is exposed to everyone. Check the + // documentation for more details. + Authorizations map[string]*RPCAuthScope `json:",omitempty"` +} + +// ConvertAuthSecret converts the given secret in the format "type:value" into an +// HTTP Authorization header value. It can handle 'bearer' and 'basic' as type. +// If type exists and is not known, an empty string is returned. If type does not +// exist, 'bearer' type is assumed. +func ConvertAuthSecret(secret string) string { + if secret == "" { + return secret + } + + split := strings.SplitN(secret, ":", 2) + if len(split) < 2 { + // No prefix: assume bearer token. + return "Bearer " + secret + } + + if strings.HasPrefix(secret, "basic:") { + if strings.Contains(split[1], ":") { + // Assume basic:user:password + return "Basic " + base64.StdEncoding.EncodeToString([]byte(split[1])) + } else { + // Assume already base64 encoded. + return "Basic " + split[1] + } + } else if strings.HasPrefix(secret, "bearer:") { + return "Bearer " + split[1] + } + + // Unknown. Type is present, but we can't handle it. + return "" } diff --git a/config/api_test.go b/config/api_test.go new file mode 100644 index 00000000000..daf8a5375d8 --- /dev/null +++ b/config/api_test.go @@ -0,0 +1,22 @@ +package config + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestConvertAuthSecret(t *testing.T) { + for _, testCase := range []struct { + input string + output string + }{ + {"", ""}, + {"someToken", "Bearer someToken"}, + {"bearer:someToken", "Bearer someToken"}, + {"basic:user:pass", "Basic dXNlcjpwYXNz"}, + {"basic:dXNlcjpwYXNz", "Basic dXNlcjpwYXNz"}, + } { + assert.Equal(t, testCase.output, ConvertAuthSecret(testCase.input)) + } +} diff --git a/core/commands/config.go b/core/commands/config.go index b2455102747..b52c05af232 100644 --- a/core/commands/config.go +++ b/core/commands/config.go @@ -208,6 +208,11 @@ NOTE: For security reasons, this command will omit your private key and remote s return err } + cfg, err = scrubValue(cfg, []string{config.APITag, config.AuthorizationTag}) + if err != nil { + return err + } + cfg, err = scrubOptionalValue(cfg, config.PinningConcealSelector) if err != nil { return err diff --git a/core/commands/root.go b/core/commands/root.go index 0e274f0872f..b812573fc2f 100644 --- a/core/commands/root.go +++ b/core/commands/root.go @@ -28,7 +28,8 @@ const ( DebugOption = "debug" LocalOption = "local" // DEPRECATED: use OfflineOption OfflineOption = "offline" - ApiOption = "api" //nolint + ApiOption = "api" //nolint + ApiAuthOption = "api-auth" //nolint ) var Root = &cmds.Command{ @@ -110,6 +111,7 @@ The CLI will exit with one of the following values: cmds.BoolOption(LocalOption, "L", "Run the command locally, instead of using the daemon. DEPRECATED: use --offline."), cmds.BoolOption(OfflineOption, "Run the command offline."), cmds.StringOption(ApiOption, "Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"), + cmds.StringOption(ApiAuthOption, "Optional RPC API authorization secret (defined as AuthSecret in API.Authorizations config)"), // global options, added to every command cmdenv.OptionCidBase, diff --git a/core/corehttp/commands.go b/core/corehttp/commands.go index 804b70a7e2c..314822ff2e7 100644 --- a/core/corehttp/commands.go +++ b/core/corehttp/commands.go @@ -143,12 +143,63 @@ func commandsOption(cctx oldcmds.Context, command *cmds.Command, allowGet bool) patchCORSVars(cfg, l.Addr()) cmdHandler := cmdsHttp.NewHandler(&cctx, command, cfg) + + if len(rcfg.API.Authorizations) > 0 { + authorizations := convertAuthorizationsMap(rcfg.API.Authorizations) + cmdHandler = withAuthSecrets(authorizations, cmdHandler) + } + cmdHandler = otelhttp.NewHandler(cmdHandler, "corehttp.cmdsHandler") mux.Handle(APIPath+"/", cmdHandler) return mux, nil } } +type rpcAuthScopeWithUser struct { + config.RPCAuthScope + User string +} + +func convertAuthorizationsMap(authScopes map[string]*config.RPCAuthScope) map[string]rpcAuthScopeWithUser { + // authorizations is a map where we can just check for the header value to match. + authorizations := map[string]rpcAuthScopeWithUser{} + for user, authScope := range authScopes { + expectedHeader := config.ConvertAuthSecret(authScope.AuthSecret) + if expectedHeader != "" { + authorizations[expectedHeader] = rpcAuthScopeWithUser{ + RPCAuthScope: *authScopes[user], + User: user, + } + } + } + + return authorizations +} + +func withAuthSecrets(authorizations map[string]rpcAuthScopeWithUser, next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + authorizationHeader := r.Header.Get("Authorization") + auth, ok := authorizations[authorizationHeader] + + if ok { + // version check is implicitly allowed + if r.URL.Path == "/api/v0/version" { + next.ServeHTTP(w, r) + return + } + // everything else has to be safelisted via AllowedPaths + for _, prefix := range auth.AllowedPaths { + if strings.HasPrefix(r.URL.Path, prefix) { + next.ServeHTTP(w, r) + return + } + } + } + + http.Error(w, "Kubo RPC Access Denied: Please provide a valid authorization token as defined in the API.Authorizations configuration.", http.StatusForbidden) + }) +} + // CommandsOption constructs a ServerOption for hooking the commands into the // HTTP server. It will NOT allow GET requests. func CommandsOption(cctx oldcmds.Context) ServeOption { diff --git a/docs/changelogs/v0.25.md b/docs/changelogs/v0.25.md index 1388ddd90d5..1ad032ed305 100644 --- a/docs/changelogs/v0.25.md +++ b/docs/changelogs/v0.25.md @@ -6,6 +6,7 @@ - [Overview](#overview) - [🔦 Highlights](#-highlights) + - [RPC `API.Authorizations`](#rpc-apiauthorizations) - [📝 Changelog](#-changelog) - [👨‍👩‍👧‍👦 Contributors](#-contributors) @@ -13,6 +14,19 @@ ### 🔦 Highlights +#### RPC `API.Authorizations` + +Kubo RPC API now supports optional HTTP Authorization. + +Granular control over user access to the RPC can be defined in the +[`API.Authorizations`](https://github.com/ipfs/kubo/blob/master/docs/config.md#apiauthorizations) +map in the configuration file, allowing different users or apps to have unique +access secrets and allowed paths. + +This feature is opt-in. By default, no authorization is set up. +For configuration instructions, +refer to the [documentation](https://github.com/ipfs/kubo/blob/master/docs/config.md#apiauthorizations). + ### 📝 Changelog ### 👨‍👩‍👧‍👦 Contributors diff --git a/docs/config.md b/docs/config.md index 49e761100dd..0b33fa3fdcf 100644 --- a/docs/config.md +++ b/docs/config.md @@ -28,6 +28,9 @@ config file at runtime. - [`Addresses.NoAnnounce`](#addressesnoannounce) - [`API`](#api) - [`API.HTTPHeaders`](#apihttpheaders) + - [`API.Authorizations`](#apiauthorizations) + - [`API.Authorizations: AuthSecret`](#apiauthorizations-authsecret) + - [`API.Authorizations: AllowedPaths`](#apiauthorizations-allowedpaths) - [`AutoNAT`](#autonat) - [`AutoNAT.ServiceMode`](#autonatservicemode) - [`AutoNAT.Throttle`](#autonatthrottle) @@ -438,6 +441,87 @@ Default: `null` Type: `object[string -> array[string]]` (header names -> array of header values) +### `API.Authorizations` + +The `API.Authorizations` field defines user-based access restrictions for the +[Kubo RPC API](https://docs.ipfs.tech/reference/kubo/rpc/), which is located at +`Addresses.API` under `/api/v0` paths. + +By default, the RPC API is accessible without restrictions as it is only +exposed on `127.0.0.1` and safeguarded with Origin check and implicit +[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) headers that +block random websites from accessing the RPC. + +When entries are defined in `API.Authorizations`, RPC requests will be declined +unless a corresponding secret is present in the HTTP [`Authorization` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization), +and the requested path is included in the `AllowedPaths` list for that specific +secret. + +Default: `null` + +Type: `object[string -> object]` (user name -> authorization object, see bellow) + +For example, to limit RPC access to Alice (access `id` and MFS `files` commands with HTTP Basic Auth) +and Bob (full access with Bearer token): + +```json +{ + "API": { + "Authorizations": { + "Alice": { + "AuthSecret": "basic:alice:password123", + "AllowedPaths": ["/api/v0/id", "/api/v0/files"] + }, + "Bob": { + "AuthSecret": "bearer:secret-token123", + "AllowedPaths": ["/api/v0"] + } + } + } +} + +``` + +#### `API.Authorizations: AuthSecret` + +The `AuthSecret` field denotes the secret used by a user to authenticate, +usually via HTTP [`Authorization` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization). + +Field format is `type:value`, and the following types are supported: + +- `bearer:` For secret Bearer tokens, set as `bearer:token`. + - If no known `type:` prefix is present, `bearer:` is assumed. +- `basic`: For HTTP Basic Auth introduced in [RFC7617](https://datatracker.ietf.org/doc/html/rfc7617). Value can be: + - `basic:user:pass` + - `basic:base64EncodedBasicAuth` + +One can use the config value for authentication via the command line: + +``` +ipfs id --api-auth basic:user:pass +``` + +Type: `string` + +#### `API.Authorizations: AllowedPaths` + +The `AllowedPaths` field is an array of strings containing allowed RPC path +prefixes. Users authorized with the related `AuthSecret` will only be able to +access paths prefixed by the specified prefixes. + +For instance: + +- If set to `["/api/v0"]`, the user will have access to the complete RPC API. +- If set to `["/api/v0/id", "/api/v0/files"]`, the user will only have access + to the `id` command and all MFS commands under `files`. + +Note that `/api/v0/version` is always permitted access to allow version check +to ensure compatibility. + +Default: `[]` + +Type: `array[string]` + ## `AutoNAT` Contains the configuration options for the AutoNAT service. The AutoNAT service diff --git a/test/cli/harness/node.go b/test/cli/harness/node.go index 7db1d553824..d030c7c9404 100644 --- a/test/cli/harness/node.go +++ b/test/cli/harness/node.go @@ -223,7 +223,7 @@ func (n *Node) Init(ipfsArgs ...string) *Node { // harness.RunWithStdout(os.Stdout), // }, // }) -func (n *Node) StartDaemonWithReq(req RunRequest) *Node { +func (n *Node) StartDaemonWithReq(req RunRequest, authorization string) *Node { alive := n.IsAlive() if alive { log.Panicf("node %d is already running", n.ID) @@ -239,14 +239,20 @@ func (n *Node) StartDaemonWithReq(req RunRequest) *Node { n.Daemon = res log.Debugf("node %d started, checking API", n.ID) - n.WaitOnAPI() + n.WaitOnAPI(authorization) return n } func (n *Node) StartDaemon(ipfsArgs ...string) *Node { return n.StartDaemonWithReq(RunRequest{ Args: ipfsArgs, - }) + }, "") +} + +func (n *Node) StartDaemonWithAuthorization(secret string, ipfsArgs ...string) *Node { + return n.StartDaemonWithReq(RunRequest{ + Args: ipfsArgs, + }, secret) } func (n *Node) signalAndWait(watch <-chan struct{}, signal os.Signal, t time.Duration) bool { @@ -337,7 +343,7 @@ func (n *Node) TryAPIAddr() (multiaddr.Multiaddr, error) { return ma, nil } -func (n *Node) checkAPI() bool { +func (n *Node) checkAPI(authorization string) bool { apiAddr, err := n.TryAPIAddr() if err != nil { log.Debugf("node %d API addr not available yet: %s", n.ID, err.Error()) @@ -353,7 +359,16 @@ func (n *Node) checkAPI() bool { } url := fmt.Sprintf("http://%s:%s/api/v0/id", ip, port) log.Debugf("checking API for node %d at %s", n.ID, url) - httpResp, err := http.Post(url, "", nil) + + req, err := http.NewRequest(http.MethodPost, url, nil) + if err != nil { + panic(err) + } + if authorization != "" { + req.Header.Set("Authorization", authorization) + } + + httpResp, err := http.DefaultClient.Do(req) if err != nil { log.Debugf("node %d API check error: %s", err.Error()) return false @@ -402,10 +417,10 @@ func (n *Node) PeerID() peer.ID { return id } -func (n *Node) WaitOnAPI() *Node { +func (n *Node) WaitOnAPI(authorization string) *Node { log.Debugf("waiting on API for node %d", n.ID) for i := 0; i < 50; i++ { - if n.checkAPI() { + if n.checkAPI(authorization) { log.Debugf("daemon API found, daemon stdout: %s", n.Daemon.Stdout.String()) return n } diff --git a/test/cli/rpc_auth_test.go b/test/cli/rpc_auth_test.go new file mode 100644 index 00000000000..c30b107cf3f --- /dev/null +++ b/test/cli/rpc_auth_test.go @@ -0,0 +1,162 @@ +package cli + +import ( + "net/http" + "testing" + + "github.com/ipfs/kubo/client/rpc/auth" + "github.com/ipfs/kubo/config" + "github.com/ipfs/kubo/test/cli/harness" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +const rpcDeniedMsg = "Kubo RPC Access Denied: Please provide a valid authorization token as defined in the API.Authorizations configuration." + +func TestRPCAuth(t *testing.T) { + t.Parallel() + + makeAndStartProtectedNode := func(t *testing.T, authorizations map[string]*config.RPCAuthScope) *harness.Node { + authorizations["test-node-starter"] = &config.RPCAuthScope{ + AuthSecret: "bearer:test-node-starter", + AllowedPaths: []string{"/api/v0"}, + } + + node := harness.NewT(t).NewNode().Init() + node.UpdateConfig(func(cfg *config.Config) { + cfg.API.Authorizations = authorizations + }) + node.StartDaemonWithAuthorization("Bearer test-node-starter") + return node + } + + makeHTTPTest := func(authSecret, header string) func(t *testing.T) { + return func(t *testing.T) { + t.Parallel() + t.Log(authSecret, header) + + node := makeAndStartProtectedNode(t, map[string]*config.RPCAuthScope{ + "userA": { + AuthSecret: authSecret, + AllowedPaths: []string{"/api/v0/id"}, + }, + }) + + apiClient := node.APIClient() + apiClient.Client = &http.Client{ + Transport: auth.NewAuthorizedRoundTripper(header, http.DefaultTransport), + } + + // Can access /id with valid token + resp := apiClient.Post("/api/v0/id", nil) + assert.Equal(t, 200, resp.StatusCode) + + // But not /config/show + resp = apiClient.Post("/api/v0/config/show", nil) + assert.Equal(t, 403, resp.StatusCode) + + // create client which sends invalid access token + invalidApiClient := node.APIClient() + invalidApiClient.Client = &http.Client{ + Transport: auth.NewAuthorizedRoundTripper("Bearer invalid", http.DefaultTransport), + } + + // Can't access /id with invalid token + errResp := invalidApiClient.Post("/api/v0/id", nil) + assert.Equal(t, 403, errResp.StatusCode) + + node.StopDaemon() + } + } + + makeCLITest := func(authSecret string) func(t *testing.T) { + return func(t *testing.T) { + t.Parallel() + + node := makeAndStartProtectedNode(t, map[string]*config.RPCAuthScope{ + "userA": { + AuthSecret: authSecret, + AllowedPaths: []string{"/api/v0/id"}, + }, + }) + + // Can access 'ipfs id' + resp := node.RunIPFS("id", "--api-auth", authSecret) + require.NoError(t, resp.Err) + + // But not 'ipfs config show' + resp = node.RunIPFS("config", "show", "--api-auth", authSecret) + require.Error(t, resp.Err) + require.Contains(t, resp.Stderr.String(), rpcDeniedMsg) + + node.StopDaemon() + } + } + + for _, testCase := range []struct { + name string + authSecret string + header string + }{ + {"Bearer (no type)", "myToken", "Bearer myToken"}, + {"Bearer", "bearer:myToken", "Bearer myToken"}, + {"Basic (user:pass)", "basic:user:pass", "Basic dXNlcjpwYXNz"}, + {"Basic (encoded)", "basic:dXNlcjpwYXNz", "Basic dXNlcjpwYXNz"}, + } { + t.Run("AllowedPaths on CLI "+testCase.name, makeCLITest(testCase.authSecret)) + t.Run("AllowedPaths on HTTP "+testCase.name, makeHTTPTest(testCase.authSecret, testCase.header)) + } + + t.Run("AllowedPaths set to /api/v0 Gives Full Access", func(t *testing.T) { + t.Parallel() + + node := makeAndStartProtectedNode(t, map[string]*config.RPCAuthScope{ + "userA": { + AuthSecret: "bearer:userAToken", + AllowedPaths: []string{"/api/v0"}, + }, + }) + + apiClient := node.APIClient() + apiClient.Client = &http.Client{ + Transport: auth.NewAuthorizedRoundTripper("Bearer userAToken", http.DefaultTransport), + } + + resp := apiClient.Post("/api/v0/id", nil) + assert.Equal(t, 200, resp.StatusCode) + + node.StopDaemon() + }) + + t.Run("API.Authorizations set to nil disables Authorization header check", func(t *testing.T) { + t.Parallel() + + node := harness.NewT(t).NewNode().Init() + node.UpdateConfig(func(cfg *config.Config) { + cfg.API.Authorizations = nil + }) + node.StartDaemon() + + apiClient := node.APIClient() + resp := apiClient.Post("/api/v0/id", nil) + assert.Equal(t, 200, resp.StatusCode) + + node.StopDaemon() + }) + + t.Run("API.Authorizations set to empty map disables Authorization header check", func(t *testing.T) { + t.Parallel() + + node := harness.NewT(t).NewNode().Init() + node.UpdateConfig(func(cfg *config.Config) { + cfg.API.Authorizations = map[string]*config.RPCAuthScope{} + }) + node.StartDaemon() + + apiClient := node.APIClient() + resp := apiClient.Post("/api/v0/id", nil) + assert.Equal(t, 200, resp.StatusCode) + + node.StopDaemon() + }) +} From 48865a9092d1086952c3f2959b830dfac88ed126 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 20 Nov 2023 23:22:45 +0100 Subject: [PATCH 272/286] docs: move kubo-specific docs (#10226) * docs: move kubo-specific docs * chore: note crypt cmd does not exist Context: https://github.com/ipfs/specs/pull/455 --------- Co-authored-by: Marcin Rataj --- docs/specifications/fs-datastore.png | Bin 0 -> 49319 bytes docs/specifications/ipfs-repo-contents.png | Bin 0 -> 16097 bytes docs/specifications/keystore.md | 295 +++++++++++++++++++++ docs/specifications/repository.md | 131 +++++++++ docs/specifications/repository_fs.md | 279 +++++++++++++++++++ 5 files changed, 705 insertions(+) create mode 100644 docs/specifications/fs-datastore.png create mode 100644 docs/specifications/ipfs-repo-contents.png create mode 100644 docs/specifications/keystore.md create mode 100644 docs/specifications/repository.md create mode 100644 docs/specifications/repository_fs.md diff --git a/docs/specifications/fs-datastore.png b/docs/specifications/fs-datastore.png new file mode 100644 index 0000000000000000000000000000000000000000..0a5eaaa87ddfb226272f33334e9e25ee74be62e4 GIT binary patch literal 49319 zcmeFZV{oR;)<2qLV%wTYCY;!|jfrjBwryuJnb@{%+qUgeoqA8z`JZ~L zuB7VjyL;WeRxfm~{;exiR$2rO8XFo22nbG0R8SrW=nE?l5QsS>2%sg`KL_vu2-sd; zgdeDU9QO$D0m?>H)gA~42Icb)7$_|R69|YGNKBAV(FOQ46T(A%ZtcC!aLE0_lC&xl zuNtKr5_mW(k7|;ie3Jj@k3allho%FDnoG{)G=I+IJrzzIFE}FoP}CV~DBi_aYxShM zJMY~S4egQZ5UReo*VV(F4EJ-k4*T(k!Reh1RlDSo?>j;u#Jqn!h%TV0zRKU{LqJ7+ z{(3s4eE1_Tz916<|L1{}1wl0fUZyKWhl&CE&m&uS#q~E8UJzh$AATxcj-a`3e+?o8 zhGuGq_=hSXFO+N{n8`q;+CRU}o74aB7eN4JP%>cXI-oO5rSQL|;sZ)H`-uPdL zzVqgw|HA7ri~VO@Aoj+We`q590*nEv)mNeVhk;+RJMMq8=K~6o02HX^;{;psUy?vI z^Fa8Uxfos_5msCW6nV|Lp}(tN)KkLiTAI)AG|0d;)yLzlP5Z>317IH#&;nR!$%gAZD0Y-I&MF$2I0Pg!V6t>FBwp?8|JY|06p04LueN&Ujey78S-XLrL z*rtg7FO$v@0vL1cb9~uX-zliVMEbQ(YtC2o_x1$nrNAcf$Z5@}p6@4hjR|%i$;TH; zQ{0~}A;TWvBMxxcV2FLOcnL{`sS9i4&&t0@Nn;Ff8uJ#^gaVZAosc(YAECHb48&Ko z(<1o}Ho~R5Z|{PV@8Ui?hp?E@J2&4Gnb3EV1YqOKZzJ=uoru2j{x!3-4krsSUOHxK z${peDj2(9Qwt!wSq@8DM{O#dOyvQlwAl;1xV{C9jHKLzJ5BVK1mz>#j3m7O+bl`%I z0hKQ$U8QiJ(|k+=3QVgAoyPyilRbt29TYx65|733cA|t#4F#~hC*ox(40J12N0>a^ zegxqwcUV?_7tJOp5uF_QR(oE?RH)=3nQr( z%}mLjJ5Gj45r@-b-ol{WZ!}Z6!X}Mey9GDEgS4lDI$$x zt^n)M^|`){&*637eTPs)Lt|(pZ8@e&IPmVbq zzA=psDJNMyYi22#+)$ZJtE@gMQ~)mU5QNxZT_ha9f2Du|AO3-{OF%?l)W}`iH9LuS zOwm;7!@>dYh+4S=1FoVLvHi33bDdqXu@e~FIac=DE3a7~ERJ7oD!Bfpe4LglofWx1 zCTIVYyeN3$m!e=lLb5AAAOC4P)=Zl+F$U>xu&xw8P00p1H46C~a(;-CVFoM1zB4qo zH&ao&bZ?$Xz$Wi_1pXFe)V{JULy5$G@q7LuZI|w6U5y3=k%pd|IB;Z03--fgEe~us z+6+%K*ZpV`#=JTKak7!{NH&i-zI5Rj`ScgjB#e!4{}C#OSx(tNIZ}2UAY#%1jGOSB zQz;YFLmFtuQ(|U~0uK2s7aKut8(p$5G|ZLUDtOip)dVbXb|}Di1dqvo`fM5mO#12c z&^eTDx>zqjPSzBWOIZVT3i*qYAC=dMTWDg_xj)zoy|4FskpYgpQMP zY~s4$Q5U~I4NDc^av33fIaiOE&`Ky!Y&Iw6Sl;e#r#PSN{JzMCIE>sgeC77E7dY%J z!(KQC4t&Lf49NzfA&F?GISd}#i3<5cT#i>#2Yoq-0-=rGq_%Xf=_x@V<&KGxj~Z_+ z-K7dk&Mspi%3P*x=AX~;@7)K`MF=U0z#F{3CYU!E?p z?TRT)SrE|L#^LJBrjo>z8ryXAyu3>jA+MaJOB3g6BtJUq4N(2>F{tl1EO2c; z1){YT!0H=tMU19R*^KN6%uNJ2vW3P+L_uOcp!}gg-faR!EKBIfDHOo4tlcbMDyA_} zp6G(xW@*Woj0R-(89;Lj3&|vT*&>y8tZF1vzz^ttTGig>_UUI~1;ozYkV-)z1;>i_ z-m0wylZg_z2FN%!!g`)Bk4s_K4asJ^B;sh?t>xCkpu;n9$l+3(aO>L4c-rstyQ6@w zx}%j*|9D|VIotEDmB2Lb|3$USMDyt?iD{2XrA6zLA_3Nbnau0D@+e}DZ;g|H9SC)v z7h>$LJB&f?QrsW+m0ne<0mfLX%RM+}x=4d`S>&en`Pj}Af;f_SUlM(p>>1fHWJcQgWrQumBT@ITB|M0QKMnDnT87$Hqh$%P0_99 z`&%%OR(s5RxJX2Ar-3d)&}^+(6mtfbDD|;$V7s2VpH+XP^Rh6-D*{Luc&Zo>YIL*y==Q7+U8ZYNXg=|8T?KKDA^ITlMf?U3IDh6) zeoSWql%$5S4lD8qP8F*yGCq?cia9ME82-y7e@W8<6^X7g%y$wO-JVL4T=o9Qua)D) ziL3}ZwYR@tpw%@ql9|;gXs#BuEdh!&hj&)Q=*4@~42EvB8Ojf*4h>^UQl0{K7NUWK z-9!sZK^3U`xz?nBpFZUpe2({_f!fR{4Ao9C2r{?ha3CZ~Vywr+Tl6Giva``c7sT1O z*s5dw8N{_%SzMKGu9(Wyfj!*Uy+@1gwbmxWGSb^o#6 zdE0KL>Bmifq>oUzTTCIm*cc>0DB}~`94+9NRmw^v0Y<*01C}F;FvqZ>!^d3wA(>|Z)kxI>; zu-HyUL`+OKoM|}ySzd=fSXBCd(hiAOV=DVmXbgN-$s_Cuo&&yBA_-@Vx81yBx|#nr zj1VP_y4k*!Y@vbnY3~g!+@=pl0)r3tVMe1S@5FyVWoZEFXU#X&n_08*YSj_RU}7~% z{s3(E0ziF3rGCMM=2w48U;_@I&_*X88+qG7 z4%e5~C`ybQRa15w^<4}*&H&}0O>DarA}}wPRZX!uQ>4LF_Pb20csCGrb?7?l#U5P} zs3;-p=Yh?*qiUXblK_M@2w6W3rO9sG;(3{)a;#Ud8q#!A%&!5K<`kEsf6r$49zJ6^ zfUz4%MxQuqm56mJfX$Uv-QG`GEdiG!DNiJl0(a({h$k@>NQ^EtUH{f?@0Yr`Ta;@5 zSfz}Cy?Xu3!X!;fcmip z9E)|~Q!96CO7BYVfOnIB2~|d?HC|7dTUIrs(kkE|cs(C=W0ugeSz1j$;+J+aK%{3K zV%|wo=wO`{I#xl6GMIOw8tq4Nj@{_Q>*5sYa(MLHG~$gIz-8`ktU$gwlLm zSdzw65Ci2tkEktmQ1awj7wfZ95d>I+p^3TNAp>;ac=@ptYjpfnRXn&+>X%u1Iz_#K zP0+f2YEM|HWKt3S$L0_u2VEyY$+xkLu#6=&sNJp#1F+IZf-I)=pApS3v$HUpq-&ja zJ{we22N_gceN{x1uTDe$SFdRH0GMqhtxy%~+?kX>wf|TydlDzT+iLe45$-S0vEZ5B zwk&9%$Z8v2wyv|?1zRrGInYFZQ+teE3Sl=CIWFAHcFvwRQz+er8mC#MoueVA2DKhr z7*U>S?U2xqlN+=Y$Ph*w%B zNF96zBzF_cH*4igd(SLnj@5CgqzQ3ZJzvs!owQSGQA7)*I9$5MSs-My71M!UXYWiw z&tK)0Zv)E~U`|#&rY8&NW7o0A!&2KTwzET2QbLaPlI%UsB$B=DTmTwtQk4=QS!Ix>K-L4;3r_KgLf!v7*pLm{f)Aw<`yl4OTB*M1kZp{it{;8UqZ07`w>9DzpSJA^2^ z_#;SZ06%^>XMVU8z3xkxfYnS8k=9Xd(d;9c4GeT$nYN|v?O^u?&4tV?8^aFM)Rvh= zYJSYtrIc~>Pq_tM%M*GIO}nMkR(TG+#@g{bC2}`I?5=jq=<43eF})Q}e*A32Sls=P zpl`kPHPENm$BgQ@!X-C~(ZwATnk;v`Tod(URG#ITj#j~Qpl!B@Dla&h1?&c?a+qle zfklR_Y(U1~odqF9E|G2HHEOG24Er+9?3K3QT8l_h1xY7 zpj^sJU;QcJqiR|4>J#GA&!|fSEbotO3-xDxqX9{y{7j(0ZwI1lHKyjZ^UD|eiAAIt(HZvu zV~JrrD$m>TF>*MONd7hOVR>^0Pcn(P2MesOEoF|X%(uLxt+o^9XnK5dDHdPaASPSc zquB|HK5$c3z8p83oNiEPBV<6Nn*7`usJ#u%$8?f`x)H^zA=_C}Jb?Jd>N-l=b@TR@ zAI_G0JqXtl%|s+UtoBAv{}2ZFz!=^Tl$e%RX1Ke(+$hB0f&EzCLd4F5QiO>09dUyDi_TxWI0H{j2N>Oq;vjs2n@O%H9GixEQrFd&?s{0MVgDrd zL_0eGiMrR3uf}8h>BE#*Q2t<`DCkbzFO8Lv6cu8K zm27K3R8HIJpqxfu0XyArAZ5=eq2P&sa(J7ikT!D%s#|(`|0D+?l|V9b(M!1o+&=mJ z*Au|`xo5o4V~+W2W`ruAwr4(3wGPnie?MPk0Q$Y#k^)EkS5^=}3DvA?*}jzJuj~Tv zAPOLl_(W~=92)!f%d6-UN9i+2UstsqIoRFan%bV^nJ`;B& zacK7I_v{=LBuf6iP1udQ39HBw?1wTE6Q|Hpvl|0NndmfV#>^8(@gu18T}l+slgG%9 zAKCLN&Qi*qGGp?h=gu81RxEy9#ck6fwRE(QluTik#O|p~0OAq(!-xqF0&;wb+QdJz zc9}D`xLbJ($#ib|+?Z=*k2w2|t7L1~6^NkqYWacI_|1Fmf%?7t<8+1|;F}MTAYo>x zRa*&3*ePz)_B+t07%q6~Yfmvijw@Lg9hW8LPm;3OkEnY7(IP!|tjxeddi^?2!r+q<_RBi4rUkR|tj2E1uQ^l@puR9AE-NVi0{qZLx zLNYv5^t|ET$!TGw%u}EE-i3I`{PeUOhpK|)2MINaz*l7_CzjjvWzL8Q&ysmT;yw(A zTgKamx~NR~BIucu9d~!^KSPRXm%ESM)cW??)-{aWpxu}m3L+GjGs`EqFH)tlLv^vx z!DEI@QFqe3^mSUkj!eubURC|fSRk+C%}^#lckdT5RLQNXuSz0^9X%+J1xw*M75uQdPCIs(Rub81x5g~_XOlqa`bj@F) zyKB`H^;Zq_aZ=X{7=#M*&}k-AY`l76@gnnD1hC%NG%916*RCH9d9jlDJmxcIpkEnX7O1ibDl(tkAyKU^hpF7c! zFn)OqlvKxwt(DD*Lc}&q^$ z^QJ&eTP&4OYzEzmZ7RsmJ^mRyN99o`ry5#gg`PiGK=n$Y*KD@If(`!_G5LW!kEH(Y zF`S?JL1vcf&BJ+3af|;?UPFD25ej-Z$#{ES-l=Q)5N!f05WijEam`7)P7JCy}p9;I6eos)4Z?m3E}jn zwAH;3Y&=u?cdgZ=9)%OMTtO`=Q_lIlReWqHo1gF?Ax{joT%KTfF|cq;P}|F3(qpb@ zabFIryJy87k9VxTotKDct$3QP_$R-+XqjE%T)UTKPa5OKmCXNyO28s<=cllxAfQhI7PD0z0jFYv}(bKvZ15Jpi&EQ!L+%G9@f zU_n)L%e(|l6K%m^b;QZ_IQB<&BwoB*uX^@d(mQqVR!UPx&)5FZU0xR#K{fF(r4ls4 zMZBo;@^W;6@L)HeN>Op~u*lG#OYc<{Bs(dGkDf!EI8!&l!tNRc)nyxnM@-@ zGdnwf!NYoc2fgLE9v298W!tSGkXvPaaPFzO=5HYsq?&qkBOcb%bH^{Koo%||D*)az zNf1y~MTe2q;r0^Dk()~tZZr`V0vVk793(u&KM7_OAS;pGz-~VU<_J+Q@l(x1+O{jL zq$OQ?;dI5~*kVesx7ToNT+=I+oB8TCOX^Tmp`gp`RQ!hqt9)Uf(fIt~x0RALZ8b#8 z8k%O+A}Efw7tKS4CV8yPxOn+mhwXM>dJ zo^-*aAPLo!u;D|ej&t6~(X8N~ej}|o4G)opwe9^(@mFMB!1(V5i7V*AxHH1D_iEIf`28`eiB zmS$EQP&L_U&SQo(ERgr;z3e3d~d8dSqNw`)#=e|Tu%FrZdeDW%tSQW+0Kx@(a{RMD&1hN%th zQwu3uCL)n&_;O9nDVA8TvS24!t~g{E=h|l)?ywa~AyBkrQrU7!uh~k^EE3=Jt@W9R zXw~s|S1MLWczCe*$uQ<*47re*bpN0Tpg420U?2CSm|h~OmLoRFwo z>*(MY_qZ=98j{UK`JuRHY7k6HPyY?swF=u|1%klY!6|HLe~gMcO*6z`j;XG#zrC<< z(64nBX1?4Hx3st%DK5vvML0eVd4Gbcyu_MSRdsHj`%&uaGE_P5Axzz9;6cHJwtCG) zTmE&M-bNvlt}7+aoKth{^$ts*sJe)Rwn%tUN!jJ=iJCNSfVe>G*6h}4UUGm?f0}#n zI$4O!X!gd&oSB6+KPx?*0!F+_n|tnIm_Jcj&HL`}lZ)sHDpPLmLnB0SsJv_&r6av- zbxJK}=WO)lxs~dUiZhktS9iS{nv)Aw>enS~d~J}#d9A1BB2SyZ{JaKyn&3PR_8Wc$ zWE=ZxO0hgWI%^zZ6D{A}?gWXi;MvI5PH%5d~w6)}`y z6X$={U^N9atGeS{R;P31)=)!tYBlO~NsZJbdz|rT^Jp;@YEYUxz00g+L6p1Pj_)-{ zP?kc42Z_7e4a``ddx?h(Y;F#SyuVrXcT`-Ne7RCOWtKO8dg-YS^mz238lkz zy*Q@fy1QbqK6R5HG^bD7Ds`i@Tz9;waMj!C>E^Z9`MZU#?yW(a#_yRcBPv-3IBbZx-L1Q2jA>$+U)$UJSOlTJ}aLrQn zn?K$*p?>xdsK|m4MyY12&U!tx-(K=4#pp(x^QAuSFapKd=2kAL%ulG*hUz zJ;_UOV(&~aYa-za*Za8eU(=f>am9?pGMO#NJmx&E6GZ0jj;h-344gLn08o`&@=R}tUzuQAqlw?)ja)3+x-|g$4{x?TjLvK8t0<^7Bs_MblqIf= ztj7s|d-ZxEN#sYvN#8-DX_JyB<6Kf}DqCf^nBPfHv=j2sD34Joh!p%)Rl=9HV0I1& z4+?K_TXIJVUp-!m-6NCQy**z826Bs+H3^i?T8;0xrq?!U?Vby$Bw_3_b*}rV()~LTX~^H3VPMys zj%muKR$JCoPhxB>D$6b1B^;=q>uSaf`~K^W!=Mi0%<>;{z)cg~SEMq0w&A4>>*Mny z=@0_kbbk&w3h3W_il!ixh0R6+Fv9#>Xg9wg5|dJ6ffJP!SS0hlVhM9vI;95_o*bSY z(%pA=?dX#BS}{y3=>N`@7>Np}kTM~(8ljXX`OSm8Jz!-gVw?<+U&0|+NYi493Ej?X z-0$&nE4jSTtGvB|J!n@ittd=?pk^jUMeJqdVSXy(rJ&ikL@B_|TswI&e5$Ak^R`yC z^>u1#MIHqyo8nJzr=js$Xu#`}o-io#^?s80yIvP($4F&j=fd5{%IcM`@;iq0=nVIqIBe9(|U>bE<)Ud#Juve4hbNAdU5Qy!V z<8ZrfTC?0bEQk?J?Fy+Ld=;j``bZ=}>`uuKYF*3p{{qTSd`*pbT?}4uJ~%vXcWE)cG#RspnHxgqpKw!t1iG z_ZH~=s;Q}|Z5_41XLbgoprT|zp(v|r61z+aJwobaCBL_m5EVr^C!2Y z9iD^{c!768S<98g#{efl@=rC!zrt@QTQ|DCOCJ+Yd~t@r*c7;&Lr_7{>&<3P#}g>A ztvX+7+y1GpOcUhKMSIG^xrjqFPrw!S6C@N2W|Zsfs>!}8sM8AP9t#51ZR4IM6^ zH|*w47aVW4mOa2nW#+qn$AbD3jY_-BdwO1ST!&H8Vf z#UOMvAVNd-)4#{ZODM*;&vYFFy62+}ZPqFEPMpoU*UsrQ%raL4uq@W8e~@2>Sg~73 zYnP6woj)yvie#nQhC3!BnrW?2n2^+|`G=Z|1~Jb2cCl83=EbH6 zrDrDQEgb0r=VoBy-#waili?;1kmPkq1W(iLz$GhJkul+5>q;&T@D@NI=9t<<=$g=T z>SZ91mCS`F1@h@iAxq{!@|7G-{2+??-E(h&--4%~qMk-r*pov(tEh(8Pbp*Z;_NN6 z@>+5}&Tj2FSMJ>F)qU%or}o7<{1G0J;OpduX{SVyJR7)h%h%S@e0;!NR1UatIyF1+ z3GyG+%H>}zO%&Aj(hhE3W>?h_VCH3S{Xqf*wHchmQt0Bkfx}$iHtk$&#l+K#WSa*9 zh44r`84)j(ChS=4g6=mjUn%TJF<+r?2Dy&QJUUBu?})y*X6($lDzUF&@5si_sAG1M+Ef1VF}+rD zK3&u^42LFy9d%at{8-VFRkb)KvvF-~T0X6Cv2lOebpyRnF|7G^6v(n(a~-bY`7~N? z+;HmMrLQ4Bnl~j#xXLn2{Z$3ZuV72f8GGv(`Tl3e1Buzv5nPY=4N6xj4Zpzr? zMs%3VoWhz_-}pSRPkkp*%`n3`+xHCl)BvXtzcz+tnPf*6Wtg@-hs~LF1B((2CFiKM zz{h3)ZdJ5x+W{frqU?1V~Q}akZ=K)kNh&2PB()*FUh4 z>MeB;aB{`D0g(*C<_Vj23Z}VqQkDkT4JRXeHY#g3mYyzMauDX2@3&?OWscr%;Inh{ zD}K+t0i>?5;?Rkb;nMN*_tQ7+HXqA0A6x!BRvh{dDgF8(3Lz}%%g(r7U^Jq8Ee7mBMvl6@m~5exVY4{WVYi%mKazg*nzs0eqxD z7cn;7TZ!pIe^Oqv6^LnZfRtV$MmB5q4K?ybU?7u_*~t%Bln#<8a{0vrs+7S8Z%bX{ za+?sGI@>l9p|Ey_UtBV5fEgF_1UD5);CFW+87|0_+*BwO6qxH1sdQ$>FI?OPY~NHM zOKCCuxr4~WdiH8x+B7k@QLXcQ3;#qcM(~@$&cl%@9zULbYvPZMQJ+?Flq`O$ z!V>Yg$ED*6(A0LH8H(0AVVeDp2AjT0k`LtzbRR85$+*?S7%)lwQ^f&r;0Pie?JN7T z6G2@doV{H)lokT3?maM=YM_N8!--tNSEU?6LO)}Uj(W`Gg-x{LzDmK&k<)38w_gC~ zj-ko&!7e%KZ9KsspBNNTM5n4%BSBQ5ZnHLi%w>J%rB*y0Lulx-9#Jb4exN}o>PAugI)n}sO_YB$V0uv_0}+Yi-WIYAyWCd48hzpmyr6o zR0E@$b@PRab%(#>jZ)cke^3Q{88vsOV-I!V(^&$~?}enp58dkU?F@i7~9Ivh7wW)`1>|rGz@h!MTJq?ss2As9MRw&xP-uuuvtn#8djxIl#6o zOgf#QAN=w%_UIOgzjsRh0~^n|t$XqQ%af@IG!w#hBF9E=qxk-I4uac{g9ypt-k=72 zaz{B^Asj2ILHlsnD|(z3!aHPW^j@P;c{7K_8Uc?0pi|Tg?@YJe?O*FjYLVQ~%hGAA z2Hh$Op?4{iKu z>H;d;dE*4+vV7=pu^+9fn3#9Es@!yU$(j=e{eO5ai?X*5iKler<*zj)eqM^io&@daM@B+pZn0bD@j?* z$cab`5wUUsVK{z&?jq?n`8( zkv!%U5RdTsrsXgt7M{+gTe=j$KP)N{e_r7mZE|W^qEwWYwiXX(v(>UOIS(x(>!!xe zn1L9Yy@-vGo1_BA-oHv8(Oc(OTR{9BN{cb2yPrVC0O*cnnU6Qd$}_)9YWYtzKY2tR z3L2?28v5>@0m93d3X}2D(^5%`Y+bIJb2K-2IAscet)LvpI<e3R3l4^$ zwTEMj_e}d1&oH5|plOhkexYnsBb!C%Fzhv)7*coKi)G2~!ewez9%lK_p9fUrFxCA}LkJ+-VN&&}sNLA$uYHqI= zuA>I=&v8lz%i@gg&2b2)vg9b)h#Xu0r5O_nCwrEJU&qadp%5}=!69Rfsvd^ItS<9T z$^B3~`}C0JZk7{2`;2-z?2E#)LZRJ5f~O}=0AA@fEBhWDpvsaz-h!jPvt3J;AqfPL zRkXu;?Xgj;64esQzI*GlAc{+p@T&r+jyww2po%Tt#d@wQ=7*xxP?O z=s7rayIZf#<-QU=;dwO|xtH!X%9XKjVCQZxaip-~{dRgr^L94=(S9<%64^RwDS{($;jv{87@X~{V}BWgnaDh_rZJQuG^ zj@~Zk_ul6v95&sua&hd=ru%w@DZ%TnUIVE;XuY>xXotnM#f;axuDVl8W?Lboo}3=- zVfXRqrxhfY5^MMh{qmmk(4O9;^_8}S7*PbB^$m^$>DM%&F-;x&s~Gn>=B$(1wpmv5 zd$H#UXYd{mLa?xI^Jmbus)UG`FQiVnW17e7KR3p+GX<89>%- zTlD*DPd^I&OKqejvuJiwlCnb0pWuA4PVdQ;HEeit8NOIdEEH2Ma14*bIXb79)PzSTo}9pS7m4R* z`TM1aS2bspYBCB06y^#xXWU)AqW%Ue?x86|3r`=SNeQO~6PE3wpbLLmkJ))4n^x0~ z<5nwhbnBxzIVZCi2A=la6^?Z9!E#c2)c*ML&fsr&7=-W$`(?|^McqvDu**t&YU^C& zpm*L|g{JxT{rB>C>R>Q!R#wbm-IH_6M-nV9<7k5PbGZ}^t6J86>~q$) z7OLoTO81#;8GFfx=Vs!^xyNsU zg7W$Wq2u4u4a)Nf8T+P(g&rlRYhDFEu#E%y_Ed1^S)$sX7W)Yvu!12Q9Oo1t98pOz z27*a(OV{*qSv~OPRy=O!inRm+nC-00#Da_TZ?2@gmtSY1#wo~s;alERdb-Yihg_#! z3^p82?`F8lSf`@n3(ZQM+WY&TO|E5@QwI0GGlrpoT~e1!0x*P!6Z2Z#8>;#Oj^v#emB5U zBE;au=Wi+c@5eXovLe)8@pf4D3ggSa9FUww*jKQyCu1a`i{Bx>V+TXlESHK0$`j=G zSjt!b|d+NT%>Ubu@=MvvJ|g|k*p6VbF|{5q?gqp0rWw%Q7) z;W#~ynlahx?8#tGSmfHS9k%z$t1H{VP54FyG8SBd9PHk#EGHr3aw-#8u1EAr0Q zJ<9%hct`fH)U$qIfwftfC3AhKvlkzkjMD^LG*;eA1V*OzexUf-HTr(!{@+yoI1*yuJ%G1{v-Z@Haa8Zq%k*H}(f7;-+ct3gqS(Q;<**6jU|@oOfk@ zoi`K{YRIR0ydDgMzkJoTnO}5b>|Gw&4}kT3(={#SDq68(&%SN5QJeuSJK< ztJv!I;F40RNXVGNKt$;&QAzcnJ9h#E6v^@z zhpA9jOlViC{_^5XYpHQa`%HI`{qo`a;RXE~YIvCxYnD1ac5EluF1f2k`Ci#8nU_nh zs|n9Lm2XfH!ayei=FVyI7=gNLK(EHETADaV>n3nGEAtm!^avAB)wxT$oB&wJAmT4s zoD#}0EB4&n6-CHo*n z^`$USA)r6F;3Wn9KO}K{_gJp8z%ld)mn%mVBzpkJxX#h9ygAHD+5*2FXMaW{`b~hO z0L`bSwMdK2gMis+sxl#CN&~68K(@HRM(^VR`bQAaGQ#QgGiAa7;Q4=n+d4n%`xf7N zmjABd9n}E<=NKAqmK^@K)BignAarih@YNKUj{+6#j0RPUJgdyYM7kKDH%a>!`bwu7 z^iVGS2irc8Zw%q(0@uVA8nTow(I;?{5EOuX4Ad#879*zR1Fx^KpT>nRsag}oH6Ihp?GYP z1vnjmenh+kppih@!&Uf@FA;#dGD#Nm6~=fXOcOt+ln;Q!TNZ<+W`p|0`pjmM%w|j1 z>70tprvhfQ`#B>Ij2d6!&A`v^I055eNQ6JtsnY=fxJ*CC*Lfng8Hb8+D1iF;OW`cT z84TtVrRi%6DO(u%B_vvm@D}p(OUpkBRJYG*RDilDNGA}^RKi8~m^)Hma-_w}lBdCr zCk~N(gTT~(V>e#~eDIk*Z1R5orK5n#LV5sBl$_|#-?|N`K|ui2z5hSzrBMg7{MWkx z{wL}FFRlM9*#GEi{huz?xdf_7K&cuEaPmmtF*Hw}ua22N!SS&T>#Givfz5c|G(}r)>t!p^lj6DoeF)#A#vPJAi`(Ptd9fwn5TESZy$iM28I8u@i~H-@4W!M3=E@d ze}DJtNbUtO0taqQK6T;~&6rC&S-@gM*Km>EYg}Vf)4os3R=#Ex$8{3O*Y5;r!$3m~_IwP`= zY)_x{yy>YQA|>|4_vRV?Qkf-OWJpFp{PCS9DvkDrf>aypFr0jj`0CRz6Jbh;BMw4L z%LQ;$`N13#-~TprUt53=iVP2d`UhJMU|qIQ3c)!EFyb$a_zvKe2{;%?DF23)fBx^h z1qA1G{PQ3G@^b$k-48%}GgE&f`LFj}9DN2_u2ofvzmViWP!SRUkEkIi`4?@#kIV=F zngGI9{Kq9>CIcka7?ScgrXJu*{}STg(;}v&2FTwQi4OQ5@{$0@Rd=*CF8?=DT~tQ{ zAeNnPdLaLhPr(N?&GcmE0g8|R!&GM@Ksx5ymZ5+2f*`$gHPq7#ZMUq|!sg;wzHz09>moHO$}W_FOQ|IHFe zz~^f}96(Euet~*9&Cwut@8C42pSwKMr;akIQ7NNozxBXv0B|L3&u6)$EYV38&D%Xh zaqkW@D7lGVwMC~*Yu;>5*KJeCv|0a-n$4fe-aJ^d`s*v8axzb(z{og*ML4n|%bh7M zGImpgyV+t1<0;kr{B_`f;NvpXM(XjR{N;@5q@9a? zL{Lv}=US`P+T3lqJCry}Fzs;BVsS#8ApC=Plpf|&;-FxFW%_kUqGZPog=@w+y}0J^ z)LJ4^A}DEb{#qO7Jj@cAw23=#!nAb>67^%&fG$n5WI=nO86k$Kz-{`o@44YTb*7B^7&x3n~t_k{7 z3R-(eo2cc{BlCKPYtZ_nwx_*0XPO@>9UZS@NJ_iP$r?}6OTsNP%-gXX-#GM-{6=rW z6vQQ&6;u_Dy3#VwEJ^doC7`MMEsu(*rbPpYa;KBgv~IVm7A%sqR`mjGZO@M_gSF%+ zm|&o()skvB)o|=rW#4uCNTzfI4UVr>PYw#kU=&PgwCr%~&e+?b#u*Ssw5&A8Nx5BK zuW$&oIbW(h^C~1zb`8rkSj;`$B%ArEtq;vs?L71y*YN4OmIE992o>zy`z_%d#~CSO zON(aj8&G%H+y~VjGA8mbO|CWGJ>~;Y7kXNNTNuGoZI_YL-6h-S$E5XrfjbE2}aJ5$+g)weczEEJXDofV98?tXj<7!eV$eS-U(sdK=rA7C zvHBdn{Td#?i1geD15Gm;IyPO*2)UWJ&=*mA%Cs*yMxEYMPi$^Nk)n~~cKA%1{d)Uh z)N79r3b6kX|{Ts3J=OQxAjA2@78>IW+R5ZdsC=0ib&l`A^~ zb8hpFgQ5FRX$@wpi`HEcJuT4RzZtX}UotDQKF|tlhwBvp$pdeXC4}tuojF>~j2H{U z^J7ER5k#$&^ZM*$R&&}GjjJQa4UhBr1At{3CKr`#tb4D$nrD5yN@S~fHAs>WND{^K z>8;moQ=5!ooIfr+%=4%uXb^Mz^$KbeDl2ic5Hz{*}1STtwb;wC}{>%A+f&jbC zg5+SR1QQZo?pLvRIUFH$6Dhp7rT>|0t9>jkzCX_2&y8&|&%1)$sCy4y7;ia#v3}j` zylUtbQ7&tIcsc3#B38R|NvXHn`$fj>a=d&%|pG1PS(9e28A2)?I?3ywz&OMbPX36FdG@o<5J+7}m&fJELn4qsH z57vBsHg~MtFXnqrWU7u*cIZ7N<2RiSJUGlrWIFxE1ON0rI%<%Uxy)3HswS66i}oHw z%=qfc9(lFLDN~NFQ$Z|IuC@ibfxxXy-p_~RMdAYMEY3WEsV@)Z?Z$RBUF*~<0JxTl zJsY0)##MlLj#^BIv|80rActh;)ia+m`VWf~&!Lq)oIDD+SR915Z3i~vyivTC5IB2k zJ_bPJ5etD^A06k#_AOXCWj!Q?6z$^L&zEh|4~^swCA#P1fXl&z396>OrZyT;0KCe2 z>7%;?q3yX3&AG5HR_|`}VpYB6Vh_QKsF?AT!g*u)MT_TtKHt-uD|b3(_3l24$C{^Z z=bT9!>4yGaA$>*~5X_fbe9$1_L6{{blHyk?u(+SuST4G4%HI8}zXqo+rbrxUM~5n0 z5WFX25`n+lZ|40831DN(!e^!H!US&2<;-$&oLkO}N?{=SgD*32JbzqyIIHWgx*Il7 z|9`RfR$X~C-4-Yo+&#FvhT!h*65J)YySqC90>RxKg1ZHGcMt9kr+MG~?QdV4A8;G7}>iRVpy-F?Z8>SsQ_n;U^d)r2xJru7G+@2W*i{8 zSnejS!nMH~TLyV!JoC~_6N7%gpX^LFri+Ri$9@cB{$~lG|8Su`al;`t!3-y5#)?Jw zx7$G0tG9}J{gj6(J4XuIF|J3;G34mb?Up34Kj7PF>l@U9(FW_QTceK24=v9Yi{Q4F zi#~v=9XZgwpLF&Oh)CG?-Z?xTMhW-rxMrop@yn8N3sNl}$Q0v%E1)je`t@*9n3>$M zZfc&7Y-7tEY_KN-qt!ZN!-SVoI4V12d3;>0E(6dROr#dVjd>_sPtGWEm9?_edrZisWu$Le zJ7I<%gh_20h77g55l;ff`!!mjZD#?gT1nlAT5 z$Nd|+Yw%j_Xk}rnb>CLYH@M`!Y~SmTMH2zfW5} z5^XbDpl(b}!bs>mXT;Gsn_mSlQ^xUY;tC|o9}FbGuuPZt6RMu|Tm?_Jc(=EY#ihEn zaJkNL4D3Y^u3zj%oLsx8oW8w6`Esa5w#f>u?}1Bm6fDJlv-Zul;BK?2V@V#D*RumG zcxUy=-G;62OS^n#B1K|IHyf|1N)Z;K=HU^cA)IU8SH>R9)`E_*%ML8t>o6?a3bT2< zFy;?Y5CA7Y0ltsnijJKMrtRAk1t#wJSm)+YxGb=4S~&JUyV#f8xdqa!&`wO;^TE;c zkbH(}UvN@^7qdYu!Zn%MeCwDO#yH=+-45++b?xm%(!Gh+!N85~#ahf{ zW-R+#texqd=|+p7|E-b3J8DSnNdkVsbxx1%Ai+nOd)_cC{+|yJ&_~_GYv?+`nx_$f z!G_;k?0)~#ywKN=l|(k-zOdpUpYs=kesCsNDIaaQkHX-nSbD$IijShNK7Dz=AW47b z3$s76I#)ISPx1ULn;L4!7xe=A!G7m7QEGDRZ64iQfAMhU8qO&LMS^&Oro}ZZI7BJh z366tto`Fhp1x2$nWBbcTjy}iv3v1cxxzotjOu;l@i$Y%#fj`>VATzqwp*8D3guh8M zhO9Vmt%PkXdx{{{1c7d4+-87i*7FR0l~})w=~H$+^oPoTMAtXKJa~yFxR}EF1Hit2 ziFp%UXI=lICizm{M&4_ylwQ?QdF#Oo6nd{XQ%&y0{59Xb=@B>n=?|ggKl4)X38qDi z@tR$k&sgYgu0xWE(U=3&V0pYapY`JE_J6MEiX>;XvDPPAr`M=fO-bH2+nFWNo@v}y zfWl?o?Oo*{C8`-&rfQbWAuc#N^sixg%~UWbNt3bFUwXzTWb~*cDOWWCwzM2z>{W z7F;B4*6+t79oFZ*uVxsBXXimPaB^P`X^w2H9hDC%GJO*-dOBWG7+a4UBRlR_dDAo7 z9wp0qUGAk_rH~Ys-5uaaeC@{0H@SoG%VX&NbRJGkyy%oD7)pXRKDf4KK=vu?`BIj$ z<8try&~gxYyJRg}G-||QnSDjrjm}DR-I}m{Oqa{EJ+yH+h#nW=*?)PpIIddQt9lzy z?absqR;pmYOj7tm`t9XL#B#5MW#!=RzV+Mqc)}voojCg&89(v8YnEpYk!J%19nR!F zhK<|RJk}1s2D?cQ^5Y;@1k>EeV;8Y=GU#@*`J zM)L^@UIrN<#{x9BxE0Uay7KwE3`d8uMAXGM-M48V9e@f^1l6#*@doRhf7!-LC#_js zo7=C%ir}ul7EcapK&gMl`v;*@W!v$FYiIC~ZRgYGRARabxcdS|dAGC-WP4bD5k^R& z@6v0Ej)^Uo)$2AX1krNG>tFUx&tYLk-^a)LU#j zZ$4gF^*t|Td_Bl)s&cbJXe?ZDJeeaLHr{BtNMB@Er^0VFZ&U6#VqEc|orj`iu;RSz zURYRrZ*ac1=Dplv)O)5;Vq+z2eyw8nx}FZrdbmjh)9PAs`P)0l&TIG?IVOPBDXVwI z$BHBFX8eHvd2)~6`y^ygL=QjdGIre!c`z8p{W0+)NCxxw!^?W}S3sKghZqM1ZCzVm zSXh{yz3IYb&kEe`BiS^QlKo{=^K*Gwo)e#q*~d*FCb}=d$g%pzH%r_EjSzm`5$mG6}!W6=SSlhGWgiJ!e(q(JYNaGX^jtfIlj1z^{UubqIziL=eCjI#Q_k^ix`|! z>Ya~;P5&>1iZZ((92v3*#Kl;tS{b3nwTiT~w7h)moP~3#1+eKj zF){H{SBd7wti{YabvYpQ!~_g9$ z4>3ASa;8lmew&4sT-&WZ6IE(F_H%fbf4iZud|wZd=PTK8Z8Ol*)2kCtbN>vdq@=_{ zBK(H=2i}(KVJ>?bB35&V{pW|oMk>Px@+g|QCkGDNeeKWq4VpDtjHOo;Xuw(NxL)>fO>b}21rD{1JlIEn|G4iYsZpP&!wq%ZhxBL(A}j*j?`Fu;Go;2g-6B+}DwguR>f2cU?%rIqHiRPM@_Cfa7hj*R# zJ|GYr-NutnC{aBt%ae%4tbAHE)5eA;Ldh6S@{Rin6(w|wDe%EnF z8eLE@RzRuw$5QK$j5nnDFd$mNYA*NY*I7YUK*rA}UZEn5#w7EB_y1Q7#=izyrb^+u zSfi-qSYoE8cK<5Ew5fA!afM1YTcI=&HG3r@A|X;rDbkD_Q=v)n@#A^q1mMGjYPFWA zP*bV={ZK6kew;Di<5|-Lc2?vzw+$%F&*(795`8O1MT6b4O$T2~R{FwSB2YFh^`F-Z z0Ae%{T=B9*fTSz5anAk}Of4Lq5Qk|Eu>#3MNQ4%cE&knb?*8EbRQ(jl6x$ht~J+!lZowH(! z^sur|HWo1%BAxlK)NnV@-Siw!;SFS<{3y`6Is2e}K+N9M{Ax{aQiQN~ieIE7*ZNgf z#>&PnRv)pAE{J<05%XsL&E|yTyRRZoDAk6QeX(06-hv?wV|y5OzT{& zKIvPdK$9vLKAU;kVQTrW{Ou)bjxV4s)^bq{nomgvAL|G-GVna;G)g%nj0}>$0)_>_ zS3q3AzE|>Lr8-#aN6zY`%b%lai5U^G0<#^jX+htWUk?`?N6P<1Ao?vI>U@D#gmeg^3kKcAxgiJ{yW;W zfY*2INm`O28$*~DDqJ6u6^*#pHq@3El$V#ZO)IRgY8o{C%s213fms?R2XCoxv$0@~ zF^=Oi`DZA;0D4(tzEY|CYA+uV;vtYQs<#+k+w$Rr1 z$E59>LzVxjdspa3^aPz)C_(h_@fG<5;VNtZcBk z)q9y*h1^j8JM}SuIxFW4wvi#<0A)~21v_Wl4z3=f{;{w361EI3=oGdPsR);mX9(!5 zplbL{*33c4AkC2SpHYtnXg;#ptI0@$5laB*)!&Te$u*Vbs7GrXUo9Q!pYFeHluK^S zB}G34zBMMSK3D~7Gv5lC`vdD@$OjEZj6Y_Y;O7d|VZB*~cwXO%clnU-?_UvV&Y0x$ za~6qcYSot6e9lK;sEYOv_dmik(*#SU`Tf(|aR5M(I1S8VQ#`^AIhJ|G>*7%)Z+?{E; zedEEANPTmYot?FM$+4*`YcS2G3(I}|W1?6AKyJ!!7~nWr9w|&eNeX-vX6^Ksm##B^ zQ$)(?cIt|HPJF~nFQTrxxJ46InwIdK0{G$i8zDX6(Z=fV_>l#b4q(Cxfi4_F*ZSd1 z;?D(?R>o2a8K$nH=|pln8=jW8XQZ50S39nyqB``);OGbgWox0-M8NpiZ$AEwUi&1& zB*zKh1XIC)mn(l41-yNmRA3Y%KR8`cxoA^`$^cE*}7A$0qp?T1EDddmEZyre-A)3 zO-(-g_>~#s2L|)!n(C&lV%o(OrRfQkB&=cSt=*H*yuI}2Zxgnb_}E7W+qC~yLExhb z62jHkWRpz5w89DTZ0B#NExpnna38gel;d<~W98y}RdLtIX+uYpTQ~5TwC2$4P)+Yr z^S61sQfL7@N1O=2lMs$SaFpyK`Y26=W!96pw6t`)mLUx23nh7qf(#nkF`yOJr&wmI zR9W7W7oqZ<10IfE+FjA=21l5yNUOhu)F;*`y3xfeyIzMBp!mS_oFSGm6$Kmkuxk&?<-}6I zex+-A8w*{9vzSj^mQY5*vFsL9*EqvoSTBtdYW+6gH9w}{Ls3gs`*&8XemK9lVuL|s z`mn$U$mC!gw<8`sejZG;jG>a{{hWoVlbS`t7|;+c>}Lyyr>N;&-{xCp+7WGCZncX7 z)B&}a8z`Zr&QJywNL@m=pja%v)h!qeC`T)qTI@NMvA7AIO?-5hydqK8Sb2Q>dOl~h zInxxC@;n1%Cn;coz5Gzdl8O@kht5}^1+_J+>WKE-$_k6uNg~Ck_a&z1Vy7e~zjbSK z-O-$30hZ8g7vL=obq3J?aN}LRl$%?J>$JI0Z{hjw{q7u^>vQXSodbG9 z#@vH!^Y7+zp5ixNK0l2_KS{LB9=t>wT{R$A3n&w~x>5lO_Os)0%?a?}zZV5?M#orw zddd&df4xLt;+TF+oK+7x?*9<;KuLg2INCSa`=4_BAfkQ(Q;NBXU_|bJ$|3tla!;nk zUE{yesu4vOX?|4mt-1?1h27C~fyqd+yPI1S9_O@QFb zzAu-ZZ%@bjgzt|BSsTs^Ivc+4uLx!hKCd3TOct}nxa0mX(ZOB7ef}{`4tr9s7}yb8 zG2CYl2U)&O#nS|yC(KS$#l^+A40oRA?V)&lfHW}fcy|}t^2$mqF8f(HWhT>wL#-PZ zVBZTJ^GD+#N@2=%+i`qtJ74e82kmbT6^A;|DCJh|)UX(|1rUGRa6nOf#RPLca#K}R zeSN-1f`xtBO_YDLY>$YDAS$)8wmumBd962N5#H%?s(CXpIx0hNUk`P<){4b>veBvM z`E>{3bhZR72xs|zkkI$*x@Pq*JK&X_LS{3=z-WgGh>CuSQdd(`6Andems6>OAD@`; zt=$jkr2{=InJoswApcpbF&bpw@Vbs>UuO#H$%gOm@86i$w!@Z)m&wCkX|$%LqdQq^Z7M6X zv}O(9w0^odN={CGeYy?&WO=sQ+|aM`e7;n7P&dH`hluF2_v71a4#IIDjN{?%{ko@Z zFQ%{u*Dl=?2SuqAANzUN{cyecOl@5qrA(^bzxC=8UILtIbvYvvzmj<>hQe1Ii5%k3 z_MasT)Zt%Iilqm8+azT^_2OVjR2Isn8{S+4!y`1KkfFfi`LrqLI@9}30}3j%rLSs& z1Bv%W!JDr#C-ZhzSzgerm%?MS%b!7~<*N$w!|D^6K%}Pk^nTrFuz=1!%uhJD`8om^ z?WP@7H8ogA9I|iUzf-M0F-^?c7vh}s0gVmpQtu7Z<(&_YZ3*#fZROsF?m2#cJAbc) z*^E8{j2X*XqsbUf7|5M?SF8>rW0lQX3#$UkgSsP`A35pN)D(7#70`Otx9_j_8}gYv zFpip`i1^4*JKxot!>8n{&&)luT@C0TD>-W>$sn#HjwYj-D zFql_5-`{YtutJ9){Qdn;SDFTYPxyg?&&HzhU0z<&s+D)O6#!j6j|t_N#S9K3eSk>7 z6UNS5*s#@dJ?!9W;$E0x!p4;uEVK-rQWA4E3a3 z35UDi4Y7AC)A3N4IG#rsJG12}$jCMwgFclWt{=8Pw9O{t5z^jZI*TW4W1*w#7ku*I zs7y^wO{Uk%)lWtBlQS`L%=ku3q5KAPgmf~UppeXou>0gNu}hZw{%3i4`6HB`%YH1q zE`NEnx7?>~%rg{Hv91W}?Jz*w$KC31>$gIPSTs&J5+bJCpFHYSDo)JPTn0j)2Vy?g z2!-`DBG5KPHvm33jPpySz3xTgFTU=(|I!i3>J#hc>1h-S=8XCva7i>A$=DHQPx~E< zl9Do-Q$LWL?rA195E~_Matb>FYZ0hh6|;PCeKan+g$y~*rHCSrv%?UzG2C-5&ttVg z?=17ybq^flP@W(cG-y#w)Hl|<%LMU4Eo8q<5C$2+GK3*{{?{PrMLBr_&=x{oSS&mT z-(b)Aat(>d5-SDI2%`SeZ+hOU={U#h?c6>rRNIkSHQ}^NyJ~CDe6`Aqd>u9ztMq#h(rG#RdrO``kYy=!mP^0gr+nLG{v1 zWc|R%xj^lghNDOZ+7#Uso-C*vi4B*U51$BR=)2%e^s?>+U_d8-A5tzR%L~GLTKm!X zz)-#HHGLQF^Ou!4E3q?*WIbu1)x<1C!DS`n^TJ+(Sv${gT}K&U!uv_IK&yl(RBXUe zC7aGR1PcD!w*3~D+c9k|_ zguChFpdXUd5Ly-mI=q%`SgxU2*434Rd!qw;LYVjtILUp{3K`&0{4}nsRYDL0L94v{ z6hVw33d0me+M&*z8is(5o`VcHJ5Qxy)oz!DqQ%G-+tC3feUn@f(7#^+gIwc@>ClDQ z`gd|U2uIg#yB+#8Yz+b(Mv+G1YuodsOQ@4_&^9I{Di2DPt~%^oPBnD|j_l7bq9_qf zRnST!QatDbqCrBB)Jj{JG!Q#&(7`5h_!i@QldoN11-iHpRJJ0&4>CPxQL;6O5ScV& zUyp@E#)pRm*##V^aGf27p;*?Dq1r`_zVdwP7ltTC3qz&;VF#TPXdYO0z@dDAL3W8 zgn}t_kD16;>`Df=D+zQqlfNK7Y%`=t7?batmviw&_aH{t^dYB}BBh8E)GgM7R2nT&E+Vmx#H2^J&#w_}Lt;XbiKw!Z;ASf^QMMM6 zZIfooEHGKL-0lmf!Y~an_rhC0b3>sC$X`j(^Z9HZ&#!BqK#8XrvCRN(9IB;}0fn1K2zgm6rZ5s$_#fqRl_mg61h^&pMuM$fh2^#mGbs z`bL@h6l2RGZY$I=^3~i(==UqbAC0jGlVGVoY6LhoQG?xWMG_=yhQb`DCSs$^Mgv5M z1I7g^PQZyLKl-bEaE{$}p-}36y-&S8VwluidLt$FJW8ZMZ#M2^~NI{h#HjSyAj-c3t7$`y^=9B^Vd#dX>A)QHO0 zfBTuF<{;3jKOf^%HU%09{bHcm%M?8T?I14$(lctKE|}@_WZvA_6AilBZ)c-Vb?%k4{bW($p91W*W@h>3|GA_ooPGq}+CHvQPC=KX>7Ufl?S zhR7N_{yb z0h>0o0hvwzx}_8^wQ5K~9z^F-6u3BtEqF@J#W{-|qBfUv(M_UpV|SF2KEPqPj|ZGv zbV-2on3_NtoJQS1aXj4xp}*tb4h1GuvrH)cq*&YX>zNvzVE%8JWdNgVR7C0P9$$3< zU^*z-*woIdrs&rt<6@UL$|Y!Z9Tc3E_^{7{aL<`;A@P*(wz_DM9cTNj*hJ$7v_^mS zuHXn(&l$W$$3f#5O)HZSvF&$lBNa0bD?13-WuIo-YBt%>yO-iCJi6VJeu2!u$ibcu zidBG&AhL&xCMnNfINd$8QXrNns7W*m@k^C2yrk|?c5(=#p|{T`ni{UTkKWCj@(=Bi zi6nBS1lEDycO+ZAeC}7qP7d^5=t%wF>8^qXdS=-{1{cdngmi2Q)=nNim%uUP#W-e+ z8AY|&(DA^`vVb!8ge@^e97Lo@S>rkmkw(@?(3$tiyEC7V1Y5Afgnb_$AFtLih(KBo zSZ*>D^14LqRc4AH;}y*V&r`Wb>Fi~SgCIP)&tZNWbIavn>M?jjsHbQQ@A)IxM$Ie{ zRK@^dvp+SE-q;uuieqpBZ;46_R}Z*m{ZsDQQOt^{`%ShTk79B=Ekd#hvd-tbIKi4a zY1ojQNeJ^4qqt~w+qj1ulG{)dTyNFsh5p-8faP*`CdOu25s%0>%%|%sYIm)xa zHWpib{B{PV&!t{d>Ea{25Rfj=FjFK?%ATZw{@lVjfyiyv!GW;rsqfI8ege z3|nT!hq>fFE4CwyX)M(d}MSoBQx{JPGv7lhw3_O?b{qw*7 z@{q@C-V=Xwrnq7Lz_!JvWa#oykh|;|kd0GkqUp1D`}iK$tpLtF8@(jzA;KVqG`G-VUXI#`I`@*SbZep1yheNS6Wy;OAGa;D=M{V#~dEOZH zmoKQ7_L6}^Psh91+k>T~i@i)*=yep;W>9^!PPh!{ZsWf=4c&vNVxJfrxluBm*?US@ za$*$$td}Li)Q~vZPrw@LL0<_`MvzI*{3|gPO^BfUgZ^vA*Ggj1Vrd7Fke{Hw81o#| zXwBdhXeVco&q3;e6i6+VTB%yQJ0c6R4&W#k4598y>QsQ4goB?(==G|u&)HS5O|ajC z{KEc|tihQ_QLu(nbd7eUY+tDlt6gzKn<~dPyNhYaO-DKIa2JPCd%hqsk{||Ew<%G$ zTOSkxI8-Vkf00gBk&(U$*#ZRxc=rSL@kE7CW7)#D(=FpeQv8RIq}IXkwf<)2EqpR{kjrL60y0 zZ4PT@m)sX;!hI(qQ<2z22JfAw~W9|$is{aPXXmzyb4wK%)Fs-f<^u!s@e9= zL_!@~;v%2Q1RDC@g<6O>eHbWv!0cVr*v=UTF^^&Z7St|iglM`KKIQTiGzgvI?x<=T z@PV~aX9!vOJ_SDK&RC#ek`N<)Mti=pJlRFwo<8gxfa+Fux@x(x6T!sCXk1)&KzmEY zh)`ae9Nv4?$nR$(Sr+H7;f8!7|<%E(ODeNFC%SU3ZtQ`HA)zmkcHl+WEoOVT7$+!=&DPD29sOL~b z0Y_G0Q{=$8M+{H>{l)s!MHTkR!_CqH9wQS7#O?H%RHX4(U;>zgT6^c+)?l>Q!9}cW zqVTG7Y^)#ktG+-8n$hkzQE%tf31S%R6%Lp?R(D!#5FyNS)cDjj2CiVlq7}&rS{ZC- zkVyDM5<)(l=)0F6YLZCg_g{e>=|j4s4o4HjRE80n8%F6~RgL*42RtG)OzO@YyEx>) zH82(xSHRz}e*t@ly9RbQ{+0y8uI{2FtZTF!5eMR@6UCKF4kk+&%U@60p!Q!t^9dOG zG2gES!`BWJ;rpAR!$`#jt9@h%2yN^)F$%BrXT?y+*7)9Eu7}XrFw_yrID*a<>g|HP;WTNh^6v#Ae z@7Q-6JZqJeK%zgvE`yMS4gK8|!w=SeUPQ|1_I-u8hg(cPO60+QkVKZ4Vv_{9%U_`* zMpL2@Nm#9f%&aKDiK5y^R+#iRBO>v?RFi=D80OS3t|0NMp^({J)?gHN17HUYNmwFG zi_2;0#bCvQ3@8>s1!6FgKCFWJN)9tvDWeY>V5XFffL-0FpajGwQWe83U$H@JrqLW5 zEoeapsQcI%$I-uu3m3a(=%a(zRiXcc&Iw@$%?z+LYXdC^1eX;^ zr`D_);nscN4T=CQ?G=j9>D)IxQRm4jq9b&a?4yFcVfDu{=zeP;$ly{0f0e3einH$Y zc~xLlub$=qrr&^yk3sv@KvS6qeNi<2qFd#l&3G8q7;ddZB3O$~q3e+xIv6>KRSpF- z3-Q;6pMp$JS%nF^?RpgSZzi=eiE*tNV5hIChxH$vId)L{RMh>X@4ie?2FQdDHvJ>F zIiUnkH#71z6okT|i>s=mpaB^my;Of?f)sk|G1~qH8Gu(Mo6i(hsMmm94^&H*IN2c& z=*}_18>^=)2qT9CrLo(_C<%gXH~3Gf9@4ZKZN|C81;DDL!15t0;d8r)Xnq%I`=sal z>fDA-d~`vphZFBVJCmxG-R1U~pvitmj7}#hcPpA|{V=YADP8aKveq;l~uY|QQyiyg{aR$~x2!b5?DkqQuMVnAaE_5sP z=4dR#D$1B4v$d%?k_+y}TN&mI4S_ z9B!%QR)wx}bRRZ1G3_s!dna%&o597hmCb0q`tJIX!x}`hJE?)B8kT~2V;!6j5TA`5 zIIO`T?fc8caM*Jg5j8!IcX3`ssxL`FI5s)acB3&|oL;&fN93vMUy}tR6@E!a3!yIC`R^yQ_UcO^ru( z(u=fYBxk?il?c-@okGh7{vcnj>(`b!N(pRxWMYRCt*D5U5<>WyxAJ}U4!%=KzrO7B zNHYj0AzQ`J-mguf2cZmGEnz;H{-x%-m{D{b-m985SW0aG%@2M=w1<2mj*DlJ7qNsv z6q}QXqDJA7nTVR@7O#ULj8l;>LrzzyyLE!moAQY0} zC60@9&j>i$g54?_o?)D*kyjgqK>(_7beP{M2tX__UWN#0YFAqsyrytfT==)c+M>TG zE!28~Q9$OXFoAFW2(kY>+UBnaQ4-{z-}oz-|ISxjNV^zajwHYy1uKdQ5fM=nwFeLS zQ}`S_6?P$VNo;sfKeT9%&8JkOn0RWd$>4i5mqS&&g3>*dLi`{!9J^|Es&G=nTOAD< zzCd0WTD%(Jh&waE=p3x@H@^=5EgvTb?H-46W_rla%-V>;<%<)TLU{)ynsJixKLQG*pAw@4FYc>G^X#IpWGzTo-BD=-2%<3O5%b26*S7e7dCi` zJP411Qx2w@_5^$-Z@$nt{af|mOOkvH1r9o`eg z=nDX2``q-R`fW)Bs+v=*gY0Yas@oZm1fVqesNgUeAr`0)JTIAL{iMAOsbVi5NrePp zc}(4}Ugqin9sqrz#+dquJVOrRh*PMwWyL34nY%cxHp={E*P+(RnG*P!iy%35mUnn; zu&>?~4+g{$F$B?;k9}=lpCSVfj;=b{5WrVb%S*KUM#uDFF3RNtt#L3%IiPP!n&I2Z z4VB^-QM$S!|7_32gQz`hml_%Chz3ga+TpUrrhYMjRr`5JvywgmH6SXpAk0^|Hq4xk zkhsp|u5#k%cDh&ZL1u3)q}Q(o#u@VqF#}L1X}?Gqr;)_wct22-E`sla zKL`J#1)wsmBvnq)yRO)9s-Q0rY^n&K38IEkZ!rfO$y~#%u7mmMxIt(UPBu+BR`kze zrA$?k`B4MIGRq+1#0R)_XPeGynS7TD&&mvRImLW-IUY;da~LoRWq)<8ONw?8={Q6FyL3& zK;xo)Y!&(U@_U1^n=5+zd=2xz93`3E|Lbi4tDME0^&cV=xSL(XZ^dyHnT_I$CRl{9 zdvqfKotrQ!a#5|JbB^7ti^TC5dOZHE=^=9kkpdF_kK$uMsYR1lV4oB|*w5{8tM72j zu@zhDr#hk$MYY2;Xw8XYlV&vjTq<`kak7p){v2|dMTE)rWD#{E&9Mp`XxqEpla#%^ zJ^j`Vh5x%4h&N0N;p^W{@>X3dm)Tb4cP8Qc0h#URBV_z!ybUM8?v*z zI7Y^maPdHI3TkV=WWce`CgRU+;;f{?<#)zdjH*Nxo&Z7Kj0)Z17+Mz`#yP*{tW74F zBQnHfihiDGXHS7J#ZWZ9YADaoADLV<-SZziuAjC>i?AX5)9%eNWQZUYaWH!xV6qvv zHlfx^zbY7rv%XatsIyKgi?fzXrP-JREO?W(28%4j1#DlssxtJe#3nx)a>QSL$}(Xv zmsu_W!=x6}Nj>ojOBn2P3V^_0gW#d~@2+)F?+;dAIRD|rPySq{!dQ= z)J7tJZt@*{vHfqh@^2Vm@UVl%N`54@{(A{z0fXR1GR6IWk4=l~k_95YRv0&#|FZ=i zAmVZg&GNLC*NjZ8Y5VJ&oUO2C zm)GYduW|xEo|XZQT1zWwq&qh0fFL+|8fwoV`19FP97(4Q=zi$MY4+#Fob7NPnFn<#j*-Q82t(qAdD-X}NZe0<^? z?*&+UgEKoiOKhtjl6+BK zT&nHtaNCs5N5k+ZU?PqomVf1#TAX_j$R(*nbL~CIoOo7MONtnx$GK1ca!~+H{l1!n zG~ez^;}Qw|<4tI|-R}5i9i@q5iL-~L?qYgb`Pg@vM>-%rnA?;DcXFQw2=Eu9y<$`tbvP?+TvyWCfoh16sd^10%)fXGvinDk)3=zjfcR_|;T3I-YORW~dbtA=^~cH17K6nB>(; z++MM;V4|tuP?%rPRFHxc*qGKGeA)GyEZyfZBd1vY+ zFp8FqZRu-OoKhgYSO4(cjhbT_C&#a;t+l~iHUHB^4M(W)b?-df9_Bf}er-9*%XN`E z67lVBc{-f4S+cQld`y_Dlg(*)g_Pg@bU~cB9Tu*Rg5JGDOQfpEBgWHYX{6sI_(;QE z>8h1`ZGpc0*i4I`o1m$zw3KADb8NP|YLu|`;V0o>(vMxqsY4)-k_a>p$Za>B9UJVy z1@-rl^=R+-JN8PM99~;kknyX*Yr5x>mhj|m5lWg7j+ODekntvi$#tY{?zsbFDnU7h zUWPL{GYiP;hHK4xr?03%b+%?(92wr3Gf@s+rKXY4%X0Zbaoe|mZAMR zZ7+E@IqAoMURxt&Wt6h0Wh<@5~i@2NTID@~!vp=Lb9) zJeg0oQ=?JXTaG-Yuh*BJ{4Kr)=V6&s=0(9p$(?JxT$IL?au1J!!?n&2v!(X-+@0<( z6V!pa?pvXrrO|qGDSNwbi7EJck2?eRqBa;NqJ!h*I=dK%=w}2uoJ*HKFvyF8J3X05 ze#vu{$LR&8A-J7{GKWzl4E9<38fh#u#=cLHUd5b>`=DjMNPnc$49NL8&PKI=((ng_nWq^gVx}PG>49bX}-xm z#c*Cf`N{k1h2CO~5I`#OuX_r;6hxNY(W^XE@m&}hXl&tU5MsVno)PzIAw8d7WF<(U zy_t|VXIa0A#5Xo-dE!2QS~-xWkrfG?d@^kt0{=^a`~kT zm8E}P2=q4tt+T%U!}!0_lGvEYo*`Ho`#%P_n(d^cth3!N(ind`*)3c~0x7 z>qfnwcYWQlRbWGgVe1Apb%s0L6~ry2%Mb?N<4GhCQ;(U<s*F_U{XhLSx9D7cY1b@Gflj7sr|F)M2`4aKjFpr?}B>3pWUK|(4j`Xri8 zultwNqJsu+LHAbkkf@NtvMPkv=+x)DBxS%-3F8)?xPES z$mVU1$KK+-_op)IJ{_2h_AR9HGz|zfo}SFhhE`Ud&0?cj!ZF!=w>(f%D>d*pvm49z ziH6zBB+i_3d}q~Nm&*)a!V*gsRD}^n9|P;V3V%+hN@Q1zxL64>GR}mc5F*`cPGIyifkTB^m0S zB4y>5#jkL!^S6+H!bSjP!ue2q$QKR21A$L26UO>ZCLM z1rcTz$=|Z$^7tU$3l>;E1G=(2u?)eMqFN8Q{?y|*&DCpd^!cD2$Gk9XS8>)%PxPCq zRKYk@gal^VMRcvheM^x~PEOgf1A8QWTWx@ zs&nm4EM4U)R&f~U2Wm?_-gg|=!6>gvG0x(p+z#=02+P2h_CKp7)fmW z&HRP`c^gT0DB>7rxk1P77|8#`N@*jC2^AW)`!(C-+2OmNOiB3nrYrN|_2A2Rh(`#5 zHQ$BP@{(SoYStQArQ^?o0T=fR|2O3knm=kM?%kDJjHBvHk@ZHY#9_@u1{fC7+yE8gM_|-KK$Zt+(Aha#`q6~q7WxB0CQ30zrM~~`LB}E$> zJO?x4%Gkx#K+B#C6vq+L}hh$ZkKfCHmkxC%qRSrd?-C z{6;OL&!U_u!(@w>pRPbDd3)!5(!Z`He< zdb3u3bL`*X4LDNm~!)t6LS0?D^fj>=FM_{JEH9 ze7g8e2H@!rtVfIN?zYYTwA|pwXw}G2+j7)uvPW`upWNujdMm&v2t|waZZmBmiE#oB zXX4&#bZrTCcByyvGZPb>pDy-&TYdXEF!l?`{D|}8`^Xg!q`Ch0DC}YiKj)+wao;Jn z>|08$eS+5N*54fLvz@m=K8#-Pi-hl5JPf2e@Y_~ly4+^7lWOs-(z)!eHU^X1ug`%GtKrMsYHIlWc*N_-zx*&9639<8{l|trt99oUrQ-ZyuWNg( zXraI~6XC*!Ew}gZ6Vhw_VOLe{_mm6+-K~i`4>pR|)m?Hl#=?v~We>K~ca;fByQq^< zU)?T^_P=C+2k{EHJ2Qk@`~Pg@+Lzm$my30RwRt~`MKU$k)@8**Yx0)r=|CcU*c#?T zGh@gA5tuq?GQ}|6nBT7qUVvpS|88@-akXbs1sg_?iJ}ZC^JMs(GF|QCAT@hWtytnt zJ#n8=P3mD{-J4C1dmkv3-f)>04aIo=h?nKIdEEzI;!P=ga{sF(IP;9tX1K<;Lz7!) zaU$XWY41IQqWYG1VL%il3J6FB5s)lVGD;8-B`7%~!bp~!84wW#$vNkoa}MH<93?YD zP9tFm149@FxEnmjbH2Rw*8OtpR^2}}#fPbx&0_8D-rY|>>*=U)9wjO2WM9{*uZhWe z^R?nzye_1u2)|3*k6uI7gToD!dd<1~^o z-sr0HgQ1`q-0tc6+ukPGdJgZ_=}PT>&Xzmc$U?vOvJXqTx@PZtmz-RY@)#OqCZ#oO zbcB1boVhvs>ZEDy(oY|<@07J1Eb%(3HpK53_`&V(r!{nC+Ai9k$?^4n(~ZL6rKehS zO7V80b$@f~<6R3L+l4OEp4y9sied)l>g3A| z?4PDyTm&S*lZm3FIvJ^^qrj1s5moHm$PQf>=gur}3N~ zbjB<{8Jrcj%0(=Xy++_)u>TJnC6HY4Pyyb~wUw?GZbCVY;d0MM@fjFf7X**;j3mE$OVE3Bmn%LSGTV2tUsJP}3?s4MZOad{@fZ+{6C8oG~w3xRAQCyo{HE zDzU=J6s9db13FKv_=S<_)O6YmQt{ zmNXU<@i?)DoL?XXazz@2bZy0(YwKF?<|g1NxcYK72 zdy__bTymmzDibeh!Bec7f=L=HsjoM?8uHBXSYAVHJn?!i9PZ0m9|D_|J zsLlK4W-cx+FZl&^Bi**AC}Z~fP-Zjp4^GmAx=bpo6=^^kl+){|@Z8tR!(84hJD9IADIqJ0I1_9phG|HYtzo2 zJ|_w7h8WS;Aasy67Znl1ZuQMxLxo85Y5M9q^eJ8mfs5loJe$9`L=80l1U$)Ck__0= zibjo4{#2;l)3G0Y3M80pECjZqI?LanJehO>SWr&1txYQZE@CtdA7>4;%CWK^hkXP9 zWv>}D64~zlj_Qb(1%2NYP>&bo2eyS0ODFT&s-6AaJy+v)c7!3fp5X4&yw%^}>}ifV z_}AAn_@+-iMhAv`l1n6tM1Bsg?D;HeYiYI$IF>~_A@Aih(58Cl&7&w(h;)2@PjmYA zUs1x(re+s5he#L($lmeK0kf?jJxe{j<6kdO8ZtPrUz`tk|f^4RpVxcD@Ob=<{(_8x-1l+%pWG2J&v2UWmz zTehC*Csd{BN?Zm+R)eYQ@As`%4ZGcik4ZHUev!++lq6y6;BaboOiv^cI4D=zTRf8@ z-IZt;mlDrRR285luHD>;L;kYfm>1Z4`Om=BmB&#ykkz+)z5jLjS@u`qujh9DKz7pr z5pM@j2cWFKAL*ftg<>_4^g%iMNC%un`}yB1C@JCM zB|%fuEL9T2SD~m02;}nj8J(jlT@&bgikbbk_aoP2qC>&5k}tKit2;Y3AP~qrFgGZ! ziK8XbRYRklzh0s}YeffriO%{SJXci|_0qjNkA9Y-Hn*TgWQLP#M&Q)B^B}#>=X`u) zRx@s0dqqbNqJ!u5PR0AB(n3-zIPXz<&wHUhX9GLRg~sLS&5nD->sp#r z@%*Z(v)WolpFo=Haj@8UdBd4@*hFw^{_$t`&visrZ#9fsR!_UntSwT-+G!k|C;O3! zfC#;nkJgWrbor1Z(R!)vo1;Er%s|zS+;&w6flGHaTCgA;jaq(E>4JBXTpHpJ2N%tl zWhegQB1y7g3^%gYk@~ElbosQ`jb#(rB zCuT_68cH5zGaeS&2Zb>1s0r1L;JejQ@#MblQ`WCA!`vWMI{WEAL}Wyd&?DQ!UDnl8 zZ(93Zm0mwg;Rw&fEH|M_jZQT)*JMGA@br7EY(wQ@bj4|h@HBO@cg38C)p7eTV=cNWwMgQS(;C}4SR6}WhdWzRnXo^y7j zjM344cDUHsHHls$=&Y)&r`oM_Z=DF|YeLs1 z{1aeq9=L1w{KSpnWVm8;gz|lwsIjD(&DnC7{%{G{{-2WUZ#|bH4Fy>%h=Z?Ba)w&m z{PP3OYskyf+uSosN;-yw_Ahr;2OBQn-vZ;aMr=um5ePfPrsQE5Te`OcbRr=Hr$w?; z?6Zqk6-WCN)NXnuXfLUsM~Z~{o%}dp}&^al*mk_^{OwB;2F4jPpY1SRTRlW_PC56NNv}} z$!_eOI*!Z^HJ%kdZ{wzi^IbMqhOk~Bv4}`xoic8^AA>;SDoM14fBOSAb{>(hWW9*n z%1TcN-k7|@NxIIlM(5>i;wu8^n|F3u8bNm4_V%08=u7*(wwOQ<=}B#^jmGk+p$8K+ zS8&_i`!d|;Z)h*c79UYB_kQ8JR2TO z+^M6svo||gPTHJ}f07A(SoxTf?@aNf9b!;?@qDV7FKW%8$qzhv1~ZPnsu(td-mdla zJaD&Ue>^d{b1FG2yWnZQKX8&d&t;tSv<*h~HoomXd9_LmHn{SYi+eFN?cAv|@empa zGU#lhq9lGr$LH0b5ubi;S|hKCTyr+Mfls8c8^V*$YJ{w<8n7$M#g2xaHn&G=Bt7OF z_Pz9+ej4nE(}+_pUaS7b@?lL@3$_=b;7M!KVf4e;26+e)Bn$wX?pj(gHs5FGUd2sK zE)d>Ix;?$?_VH+^yFELuQOroHRXtVuI0;+=ozY~QR^))cOevBVm+mR*jhwdg_I$+m zvTUqkWa{uD&6uuL<&9;0w6>;iwF{B(l+|RzRV=}o^i2YFjn6q*T275e+^r#oe^)ZW zQ7u)cbeulOP1s;Lxw1abuZ~xZJnygtdO@2EmiD&!``U9n^Jk3@nq$t*1V*$jBZ-8y z$9IG0H$H6duVqZrzON#v9&a%n5lwjt8EjptRTxm7Za5h?e+Z zdt`N1nymlCHFxpjR+0Z}yrI4@Ro>nYB%?3?)zBLJj1eR?l#{9ZI)L@w3Q1IC`rU!J zrkE$OEHEn(Y{-ygjl5$1hA+3woGgt;;0yO4eSN(yH<736Gy81sKE$#kx*n|wRudNSq z7A_#3HC5Pm9R@5um?^P$@K74M+;ISaOWJn#r72-Iq~)A`aNaL}X6G~-MEBChg>r=O z^61&%VGt=1y{d%BV?-F!5Y9^_4$gkxxzo#})d5f8%|(GM*aT*@El#^PKk}%g_9{Nb z@l|l%#|B7qXMW8iV_={N{!9GIdht5$Qloxdr*+EpUb7}~Lwb!a#=<${1^~ytm+ax8 zk|q}O2iz+H7XPZ&T$k7EVMJ8&Sbw{@EenwYaoA8v+C=!kSU)w0?oQL0S@%WbXP=7t zyI^#wjZgmC)J{cB5}%`8g~I3|SQ0Gk8!ln1IRKqhdh=El9RO}_tEj58Unqbzq^WXy zpZ0(#q;;XcK{8Xf-+y8$uR5E)XAQAxW6{?2SrPcy)Yhc79U?&|pkBWjQ-{e`-xLV>KMtnBc&xt@rib z#;hW+pUd!hY#e6aI(YSXrG9Nbe9THt&BTkH?0a8Y@H_$)1p?r#JN09Xn{tCOC00VS z|46@i={{*{IVn|9`sisnYQP{-baJ(BxoybYH$F8Y|2n@v9FM6M6ZQdWD#eb^K+T`1 zW>&@VLfHhCSgXVLr0874g>V;+YM2}Es`R9s{obMhz$W)RQf0*+OOV%#1Yt-~6;avi zd>v(}$(BGA9A_KTqLb!u>{4j&Mf>thWP3hL>c-D!mSah$h1zoM_y*&aCKKQu;ObG; z8Z7g+4-LGQa6jl}Hl){LV}P9fQr%61!}~?898GRS6mDa#pA_n9B*i|$yv6J%*>@Rg zbfOp^%QA+SUmxqoqkhO1!BMo5|x#!)9$F4TsBd;PSuGpF&6!7RUi%5(baPy zg0I0=PWq*JrJyIb3-^KMPqnbOplvT_XzN2);~6t+bLdR7!^nP_$Xyc`=Sj|hymz20 zbA`*6kCl2VsY4=e)*(zH(s;jop(sA0p_E3`sbtywK(8-*-=Uh(!dW2qdJiZi+6!U4 zCVJO0oJW+Q9W-6p9vA5BY4+P%w>5p<$JD+v_j8`q>q>7^(A+7d}n_vI6N zH7kFB`5c^A<5i)AH*c*|Mw6UVsK_#U&o(+TCFL`f?Kg_8b0pTC~RMYU(7vDef(kJ8-}! zvTlW3LiozF&|AND)+sdmZpVN8qABme7u8$7_FbS@)wY*w_{0rqzcVhvy1KIx(C*Xf z`$D&HqbmndgWRK^a{LaQUrtR;jU}HdGO9ISc&|jzn7#0RGNI);?(f2EVMW8i{Y;6N zc>@JVQThh|q5*P3eTeeI#Z-#Z#8&*%^cVlu2Y80%0yKlQ zKpNi_|MM0S7)4O(>v3p#{apX^QUd`55tkQTU;pc^b|9qwpSaiu4(yMR@IsA1OHI?< zAKYU19Rn35W#qq8@N|myl_m|Qq{{?^UI9E$x}=-lwB9#IkOUmymj`G=uCA_DR#u*# zVk)2>D!2#+Gy}gB)@j>YBvs;5G0i9`-Q!#pG}XhtV`pb4B_-9?*0#I58x|JUqpd)_;- z&iXvA8uJK2=-kn~`VfVUq;`sII+7qI+}Z?7&Emm!OxYct*8x&e)r{MH>APi*d0(&t z9GW(&<_YL*@pI+(g2X`)oq_ck4NFrVzh>24!X^j=N;dOR@B$0P+RNfsA$r$`+i9XO z+8Rx;ew>pBK5=q_@QQ=UIS3ywov!zm^AdYkGC{lD)416M`Z5oz0C`K=LMn^LNYy^m zFZW($^w$(5K4Y%Jd$gZ^HwOj^yFj@r6);JDx005ug-myyOT)VUt*F7=0T(^`5=Ry7 zhe>v7w|C+g`z30HBJGaBdy3GTI2(DLiPwp3+iYN)s6ZW$h=s7-A1cCC8Ez;~{$Bvy zmnpTiGXv5OPq3_enFz!ys0DXQdOj&!W1k%CvY-*uC<1jz+@u;GjcG>#3OQ z1>QVidx0k`m2N;~!(X4;00w>xc|($f{&KpW@B@DLV#HN=<{%4o|e{D(lg_aRTJholfGfho${tjb@c>{~Q=%$vIIcJXSt0Wygy%nZY zPSK;QS5g2$ujAESofQ}JJWWvTP`KYc5IH%y+u){+Z!IX)MRjSBJ*dQrXC5>}du@mr zUx3ydXudS!xR}^UkI!pz~3&A)we{aCbDzqKw-< z4%v-g3uFm3H4|LcBQLkpp6TjRdEQ5n^UTABZ`RWBi9*N~OMuyLnuAB6Sg^R57wflj z%m>t`0dHWbR=A^C-C;m)<cD!=wuP^2Sdi_Ha`U%MYNbu-g z`y$ktOXROF7GC!mkrWme|MF=-f+r5}#b3g7`2UgM*}5)0S_5^Z|AvQbK=aX}=5^1f zzud|MF(5p=wKts#{~I3upIDNe95z>}On|tXmFV1jb>!tsTifjqmgc4H=tO~=U4C`} zY;iGo!#iu1#Cj#i5~Rz?@7LFbmZi1SYeT(`Vx$2jtLqK^a4i!^_$ifG zh#BjN^Zb-!FPpv;-GNel?Roptnk1-bL;DkNt!K|@B*_P-7Rb+VZr4q}y&R0Y-uG9@ zz|FI)=e3^R$Lg z_|prg0cTbZn!BDW$7K79gs@d3M1X!qN@@!~|FDjZPF6wW4>~uxtLCCAnSUy4 zst%Br3lbHjskQU7HNSHvqSrNkI(pyKZ`go^M}K&s)ya7G^i1&FVdtTGjXk{qZqLq; z)Aa5YQ5a?_ecBi}t2NZe#v&y>q&%ecFi`n!IZtX#B8gLLkxp34I{0e)!WlqD$50|( zULsArbLXq+;v0oz$9B>dj_pc-{L!Vvx;f&Y1~ zfAoRddf#Mvskb~f(#C59Aa|OL3QLJU&#A5TJzO1fs-wTul~jcKWwzD!Jt@z!{$f^+Qz34c#kKfC)VUyksi!VuOg4q7-{*dIZ~8C7}( zV!L>|>?;q1m7`3z=Q=+L?i7;zUfh_}Uqrbd!B#253LcloiPRddera(r?)i1-=3Tqh z5pJG)_CyHyYJw=j46H3JAJxlxYq151v_J8_I@vAf=nuYUWoveIG+LiW=z;u|V`gc| zwk&X&Y&u+qshn>3)O<6f$81VjwC2N{Jqm8`TYr+z(oBIXKt2}6fJRvd7)zykbFr*9 zd==e_yLz76+UnWe_V#Lp1ZXCfGNW3Ydc?ztylGOl{} z0=5lBYzO&@BsyAcrK`eVtW0680XTwwz4X(w$e0N-#M-qrM);{;(}}X}q$n1? z;+nAhSTFX9ZX=J4m9{y*&p~MPU?70*_dIwJ*OmA??xrV8+?OjpG|=>WTu=jc^-<3r zD|&1EN(?XdnE|0UTHOv;1eq*3jwY4-7jC#^c+!GW8gm?)_5GzNmjCwE;8ymWyupsb+fc8|{1Y zbj(J8y*sOQ@vQOGIfRzy%mf7)@d9)3az}UrMEp6@1)qhuM$OpusQi!K?Jy|7P~LRW zHtiw<8il~WfMWeP^t7anp&Jc6xSyGf%)UN7AO1?L|CEkPT6xLjC^+fcVXaK?k$t1M zow2S`nOOI5!VumF3shQ?ym`GSKR32m|H(#opgZ>S3j^fz8p^9jLZ{+AQyh=o^9wPl znO*_8G}oVrgb@aB6$X!ywoLM0A_>gmsqxuY1P`o@^wd3fJMGxNttq~ijMPt=p2;s< zyVdipfery>y^Ks4r-%jyC$Y~_j#ut;Yhz zjFAd4eo@}qiW<*0hzl=hx`TcQ$Bkg~QEr!wk37T$2V7I{;GQ=foly9tvUlFWtFFsN z)X6me*wWRMKJ%L>d#x>dkay?%m&GkrEjc0zMiAUR+&N#qW4A^ac|8lQubuy-XDH=O z(D@s$XK+nySAXJv`EtkgH|;{UtYS|*PV0MdX9y*fvSjW&H14%nNoh&Q!1kl+j%;vG zkP+>Z!jdd+*x7tLtxil_a!g!mgb({}bx)i@yjD8VNxQ_pe9k<1J?PgDVD`HlB zypy##p)5;I#=vA8&THbSEr+c8u+nDVSA>-7mq)_n)890ZiW($ zWGd&8I)bStgV@LP^sN;2wW27=tBJ0BYby2;c48jAHD@Q>4{DdDK1n1D2^v&V!GZ)C zbR?@^kGDB6?fy`UqmD8>c-gPyT<0bRaB_4oJ-d>xZsL$7X~VDv`FM$-wLBK#%cV=- zx96_z&x}5gt)wj05B<=x3P>W3I_I2o&~+%q(t9_V)5%b8*y+_LDK512t?zyNUP`%! zUR~I7)g%TWB-Ct{O|N(kc+(|+1>FepZ+GQC8 za>zGFP=(C9$p(nMl!{^&Y#^(P2^kXMJS(763`76?1St++RP7=1CbTx2{1*|M`8sd? zW5k%ol<5F(Io4iA-7vAJf2WgHd0uJHNY%uPVUdb`!^G1-oru-1b z$|Rp038WtWds}aU!>aC5+aCI>8U7fTYm>c8UiTvTh;IIjy6f9$XV#V(X^qC3`;JA4 zgwIM`K8bRFDa6zgsd#dbknQ^WXp(Na?3)G>lf4flhsQ%qn?aGIEc?LAVdn?44{QHe6VdkNgg|SW%D@P&Gkz0oc@d(yReGtz<$ibJ zM#|$;S$>r!7f%O|zQ{vyIl)S@WC<{rP(rP#Mfq3y=sk4r)Pkm*Z0EP1Afz?K`nWs1 zwp`vXbpO!yuqnvJ!(%Of2B!6>CxY`B(Z!BiJq7M%QvdN83Hs}I)ShwbyEja@S9?SOb5Vd|H8gKE6$5m1*9g22h?;}0ba z@ZRaG;Ot-OPE8$9fXd6u!5O9`4cp$jMMJX@eNkmQ+#c=PUVSWS84S%B4qqZDm|HttS_)I?BWQK-ISM5v zF0QYyZ_W2`s~qE+W7cs!k~-0wtooDoUBRzvKQXr!(oB`u)q^h#mlyd<6dK&HT{9HB zB4L$Kz6AH$5Pl4>O^c-pA`AJ?ct%1(z1T%6{hkUb=HWQ z&XJ6aB@g+bYhwnj>%%}dg%qjibM*g)kC(`+otuQ;yU)tB-I<6lE?4)4Faq4%eett} zTAqbIa{CD_YT;>B$an3+4$V^MDGg0O+6AHmSX%C1V<8lo^tnsiaNC82s-l*$>+pkaK<=FPM1q(E5Xs{RYM~BoUeNbN;;)=_m_O zef-bDZub9wbH~1@c2sTfqaCY0{|g(zxJGI2Y{+AX4M8A~maRd^RwxFF)H7zG3eGZfYB%8^&T?p3JI9mZk5O2GKeAS^7bqM`z@b=<304DmO+7dcqxR!{}h zpQ$|~tE&Z2;n~^DbAm;i0RqcmbulxROxd?~vHqyp8=&?Muus$( zqc>FUKll)VKL+>lmr*>fTmMFoFz$W;)VK36@ml|U;s!^!cMS~7a8?lfYr_FY%DCp1 z+Na}WMC3g4c5RPZ@l?UeeJM*GQ9tBk0;o`TK_LySX^Xe zqzk8lrg?5)Y^?d~wW9vu{{A8kPV3|WdY1ti`^utV1cI9`h0dl>9NC>f^%ql{5XYqP z@;cv^s3{T@U_ri#l$A?}uMHJ?NcrAe6m=>hKD*v64-*e`7n`-}&*T?a_IBM|zcL0WuGa2><{9 literal 0 HcmV?d00001 diff --git a/docs/specifications/ipfs-repo-contents.png b/docs/specifications/ipfs-repo-contents.png new file mode 100644 index 0000000000000000000000000000000000000000..cfda9e5d9e3636deab2f9c7241b137fc18284b97 GIT binary patch literal 16097 zcmeHuRa9Kh^XFi}65QP-xVyVM1c%`6t_c?09RdW`!QI{6-QC^U$@l-0bM|Q;_w3n+ znYp)aS9N!Ns;jH()`Tj`OMHRDfdc>lU!){Ol>q<<&?O)P1|0M)0o3*e{Xm)t$q4}f zRnhRThESk;A|pvzJIz=aV2I5q$PxKjWCO#6&xC0@`2SbIrL zCjbB*_3sA^kd}c30Pt%_i3+K@gPmnUd!vcH3>;{k$H{b{#l@_nqDTrC__+5P6cdlpV#nC#OwmUhWlpz2}$vYE+-yRS&}sK)^kX=;?2y}4!B1T=|t`3 z@rl1_ZHaoq+stjhfu*LUOiVx$nUe?r=?_2xfC~a(K2w07cBy`&qWPa&02t^Q3>cE2 zJ;6Vh|1=AT0>ESoY3wN){Ff0DDFXt;{y&X6vq=Hq=96k%XjuQEfTV*#9{j5hP$R}e z7=Hkcvl;@_C-8r>2?Dyf0FeI~2sb#9|0mr%1{K3G?_)$nO?wxCyIKRKI zRoaW(8NKroiTzb@r#~48LP2$SEVf^;gD(}QW#mfBRaw`LV&V{Rw+3tKx0z5esQ*ap z06}@oa2>;d#3(Q5BLYUif>~Y~b7O^SmQ5z-Z zw{n2=%HZ(&g&(fRN|#t{d8~Fs9;PeywTj8$u`XnWcgW}-pPlv&$DH3Php;rEr&}hP zTT3;>Dz$fRO7kY9iV|8;lMz;$ykz?8UTk`p(U*vYtS1w>FUCtdzu@MkP=>YWtsGd@ z@Sv0Y%a^MZ>Pv5MLmSJUkWa}7>y!Dy70OYQM^xqLN-`Yx)_F~&lASzE!4{jced$k| zVo$L&l2G+^;TQ9oG1Ttq`o_K8OO4G8HX$HCL4wWyA^6cPg zln?&%TE~8j<$&H2J+&5Z+KV93%C205vdj6O*LV^Lwt!dR#;nNG?}r+9YkEuk1!|IE zyYz%n`Y1Njp}1)2@>JuDTXMlHo}E!`M*JFr2-F&HR1Xom?c6#IoF%$1#-D)3IvImL zMBg|f44YGrsvG3^$4v?RJvF(jKiFb%g+w!`3x`|j{a%_4=~Cdny#Iv@`v?7U7k>>H zGdQ@QpiH)|xE<~hbE-&DK+p4uPI~_Hu|&lzg>e01nM1CJes6r&?-mDIul=i+;;UAT z+d0H>;Xhg7lR-DbB^2b@rAj9-fZsC&h#rD5W9{T=Td?>@s(Ai1h>6 zvrIi6`U;FoWvQ6iEr@0Vcp`TqveO(qrdSs*#ToRXd3yGXV4$S}gh^@jI;DXiA_Upk zc@n^CiuN~ZE|)Dj_5G^qZwsQIQiEoF9yJF8_QI#L7SDlK{KqkE1uWo78aa>Wyh=>& zaHmt82-yCy#jd)lvrb5F$46EP=Sa;C?;J-;sd;>Q#po1rNoMxWAYc{3tOd@cFqUW zkh`T2RH9Wwy&Lr@hJUx2iwZGcc|pd=iyjU=T|h<^fF-h0`?ch7e#>ycRp{PcpL`kBO9Vb3V*c3*AtNv4xj#`Ir@yugbr{E@WNYOSI z?qkC4`&i^3PxGeZ(wnf61j>86KmG1;sEwrfM`)_l9Yg$d%4#gsMC4yfH1LO&U_?)0 zpizS948m<`#@+OQMv9yPy7X3tWF~-Q6A9qHg_^JHw|lXuYn{ZerDC|;7MvG3Img?B z>1cKZgDNFzE)je-$_bjqtLeFT1fveQlS?g*kmO;`J)vATfV|P~ZElDQayH1r6G`Qq zxw3Y`HlvqV?9^?_O*|5*NTUwg42$8|wJ=|H$YC;JaoZNIa@JA!;}wiUQe z-m=TL`qCx$q8^Ri6FbXb!EZO;Q`@yTI9cX`BG@35~312}K6kQbqT+qh! zPSmN>{}#)!3k%vSvdFWSb8E^5L`h1@HDwn@j3yqKkcSgEX4nHE-R{s9k50nkp>{u_ ztYq~HP)?`ymCI*&Jqrk9*f?}-!t%7*>tx14NY_Wz7)j~NLcvBGV|~MB*R!Ax&wHYb zFbww0T<8WR)ybd2v_GeB-9q?^pMo*`MJ5d}GkE9H9zzJ)hWvgDs)TOKa(v&Z;K(}i z)U|0*gvgvx-m@%dJLNhlbnKRmDENh&@X=J%`Qc`vCpXJgW&60B$QXZOevo^K$)K26WZC$6MS-BTtwNWth0AF+16Cjr9v5B_Hg)qh6j@8F95ipsOT-2 zfcX=+Uz#B7%)kZ{)L6iVj=1F!J$W7n z48nr6-a;|CJ~f7*rZyM+z33?|hk(}j`pXaT&q&EM^BczHpJ&!dp&soC20oB2EtN6m zOQvZOBt{}Ttd}Jn-LC&+bza~NPXvewNJS-+^R*9}VhigwXg;#>>O>9|Ku3&%E9wAg zkE|UQ_<8d@k~&WO?a@Geu2W397)`G+7<|J6!~7?T;Po0nyM?H4DW zp1AIOrw7|_(rH3IN5}62Tse&f<2x{GUo}pf${4Q?=XG~Qe$J;?0^4+h2p<<}Rnoqw z3|Y+~3VXK~BWLr27qP`*_jTJ9MpTKUj&3{K02V=8LG}dfY8Bs+Q#g^xUmKScoXJ_I z&Xa2p!I3*Mjom&X5lf-u;Y#5fjU+#2Ee;F`(!1IkZT#xR(~usZ+<)EWBo%yd%7ju@ zpPyLIC>T$m=Jd=y3pHC28Osoe2dB(|lMyFo@Bc=<)=b!JRvJYbo03(_l zfRyFn^|6LAh6Z`x2G~OdDHrsyq^91|mWH2=rL{#y9Js12)#!Evv3!*>!2+B>SVHEE z^t>ge4RNVV>9;g10-B_!c8Q7j3)oHsQ%;G^-fmLaH3zULS*q6(Ti$$V1Q3Q`g8mlx z(Eij0;Gm_lMuvpEJlEn;8`@YU(!4QemAfUzQTDWTn*ZoWG_tF~yH|pLU}DF@K+qeW zPNxnlEG+^$l1m79=#8+E^5`a17jB|Ix4P_T#+z`!z5OG;p+`oOxx>gOUu zW2c;m#RkLs*Lt16)0j^AC$O0z!38%JQ0=#AT~xh&3LC)3qm5ZK8jp>OU2FHFmY$*P z2{inqh1K-G@>qLLlCWqy&;;WP-d)re5bQM@`RYQ(lt`OU{fu+Cip5jy9wb&#dOT&D zX{t3xO&*-cU{N|I0F)IgvJ(lBXg>98GCh3z5)MM5`7 z{>Vf(_JOMYf`q6kO!x99?q`eP-m}p{QYGjEvf(M?Ny(~IsR}JM1;J^aNz(Yy3oYfp zj)_>N`dzko-3o=Wi>vU)V&;lZD`xw%psCdKjMq`9;r8XvA`~_bs+92drF`c?c~O7L z3c#I$f#8LP^lUgf4geR#5Hzqy>9pJof27ZYJ<+deOw$<8m^hS%!vb3@C^7sVDC%;D zUsY)zwU3M2wC2l~8;d9Bl{uuuX!%(#YdCZGvn6(@;ean$is5wLV%H!VDe)DpJ|e)j ztpNMi_j1X7=PSp-Uc*(W2=gAGI`dT%V(zD(lpwU*WB`zg7uP|vKLi<&J0ZCF4OUFv1exeyg1qWScP;&Z#yxT#I5NlnZyIDT1eY1$GKU zY1#;tGb(f4l4de9afaaaGCq{6UwkWYsPaV~4{o)8|k7CvwKp8{*#cTz6W;W8KFgKH>V5Ps>) z`>5PYbF+LmrUeL_f)#l>0Z${1*QreZAm2!_k4v~5HlCi?cC@ZE4sC+sHvcA&>tg0m zl0<~L zf~lkQ&W1;iEI^GAkA#8`ukVVLUF_El9Rny0Q8L(?j((U~4)r%|_6z`p&4_F6P(F6M zpDn<_i0s`Uzgb~iZA(g&{yp!6Yuf*fV0U{E?2WeyC!64ANtCu4*we3A@_WVUrLRo~ zwiOIv2E9`E;M8g$(b=egYQ@sexo?+FhLJeJVW$QGkwVO=CDlSM`NAHBcGh5bP8No$9M&!oXSnn|`@L1~Kv{#h`$u@IT@Vh(VLn{NH;7St6l~ zBq&}1`yX+YNT3t>gt7}t!Y1^E*K&vp-AzXA`lM$YJE|3BfzG{|x zY*pWJkQ?5VINvfg!;&}&)THGBuXg;Wrev`JOjNQTem}0QCs1|LtSShTK z!TwM^)$KpAy{Cc^4r# zdi$d9eqZIGq}60(L?f!R(1|qho1C}u`$Iaok^zF_D`Ey4iharvS?69H+8K`edNzHw z@Opuuql0cS8wS>pWby8F3thVXZd)h|Bpfi)tYfTkrEv{*W97(g;1di4Bo?@|WdQ4Y z+m7V0^sLv>L)07u(_CfVQGE9ke;wt6+1mHh+~yMm(}}OXFLD4)C_bt{Sa8QxIAXGq z60=#v_4oq@sWA>@-$~CA?qy^Y=RqycP(i!G4H;9BYLGqN()>V3g^Z3IE|)oXrr_R$ zM4A9|Isamv`}+ss$*Sn6F-{c&umJp}qjhs25xan86h%pKMyur61 zwWU>V!5t$f%B!2!r9H$7W#{UNJyf*Us2zH~p!lCeMg*Rs)%o#?PC$}N@N7a^Pp`~j zZUD)QICyuGekFOxg^$fd($x!x&>*6QvG6*&n z*mCIjbdc4p9Oatmg;&|g>&(t-IaXW>!m)+r6Y2&U_ij?#I+?vZqVL*0N|*7;dvQBF zN$NRK_^q&KiYyCaH1GAg!0*8Z?iyoay0Rvu;i*(!?Qy+aUyg?7Db1(Q=f1#40jTXC za!w%e8r<76@s)>T@|ttmwJ#i}zHmx5JRykaWZKwV?tYW7^3j!(Nry%7##D%{>HMVN zSSOQKQi9Vw6w7M<>_X*ye`{YS0SBdAyD+E9wsE&v4huoor;Wx)&n;*ioh%bdOC->lz>Lw~V_TffLoyau)EAf^@7OjcH4pin|KpLrv6L#9b&*2%StP zNb+`fxj8XYF4Otc6tPT*ObFDl@AFc_TpyA75K6`pFgBXa^AK+P{TeXeeYW7|r!q6# zNU4wb&_Kuc>h@H*01?uBBKlE#-@V~fu?aaK&RaJUDIbWLRrv=mq?oIklS3epuu8ze zv9;{9^alDpCzMK>8;_k(Ta&4J~`px|3T>QNKpReZF;1E2ei%@0$?H zdtdhqd7K=mo{kR_R~?Zq;6c-l=}U`&ofOkYDd9rw&bWdJ@1yl+wlOJa{iye5_M6g} z0Ng`enfH;%Z+jRhC2rVMefUe-mSNR*7dX7u5^bBuTO}wzG7EBWZoP%OZ+*?CB9L=NDEP%*-O^&7J8{A&64=I zKYlf=SUzNs0$zMvEaT^GO><`redxR?21=G@5qRznZO>+XT-9=g>7f8 zw_4WZOyDTb#xDN^rGe*w-{c_m- zK1MT8k#*gdgiGKS_GPhhpdWT-%Ld2HJ8Pa^?|V z$==aoWO39g`U(FI8y%TaLJQrYx!Ky%CiKQvot%g51%7wK&%{gX%ZdxC8=|2K7Aih! zx;`FC7JMSa=Us^j&&UV*GCZlCxuNFn@0A|FR{phc*q<>IeChli8Oj3JB|mWwlxM<2 zllGpYb(`<99;^al=@yPG??{uwO0}ebtA+9%RwpxMQl`%Lt;GTY@6X=MgEMJO2koNb z;8E%K=Z=p0L=2B-L5Jx1zoot6)@Hwr?cF4x~!8th=*P(OR^HqDMOZ26oxS#ONR z=BzjBY_~F05WM-*8xUwAwck3qNmQH^VFn#he?J}ZVgKH3{#t6y@8mKN=gN&IjL`Fd zNQgUuF&6$y!1+xYZb!~H@yh`4y*2_t)7jDb5R?+dZ~6@zjlK({l9!_0Z;yRU#(a#s z!E{@-x~5q0F*1+gk(X9)`&j;sKD#Hb?3(4ulu@0!E6n>T!pZk3lSyb1N9v9c(bgli zi+H)(ePO37kBIxmpvq1TKj=aG>jTA`UF80_`Q5C~hxBKZM+L1&es4k(vJbmY+k6@y z!%p;P*oeMwWGuJSnT?!hi*2N?K$dY z_n29tWT)QSFQ< zHV41Is_aZTJT$|)GPDT&PJH3hQcc_Uke1z8100FyW=B4w1BD2p+x&*;Qyw)De2nK1 zFC_exjQf)ode^f; z;Af|81<&^&RErDa-_NE`)T}3WAH00s)OH&!R*1)c$QgIlEUeURMpc}yJbm6;LP>15 zS5v!5wTo+(_7dkF;&~W7h8FBv?{H@_2Ub6hS02RS11>y#wqp?$j`B6#-WL4Y8){TD z4YJ-3S7&Z5+Eq<;uFSr0CC*IPW&mE+8cjHY=4~qy-m7JV~EHb6$jG3F(1u8vP z@tBG72YsYUeJ_32P+NY3wq0loIV1|GxFzzT^EIuzfQJo%djU(TQ8w9|+E&l7%!Ay} z)w4#{m84^qw4z3mcONF`3+~VOZ4vip3GXEih)7})((4OK0`4C*H__g{@jB|ru!syq zV65`h7YEo8&q9NCPok9GlGRo%>TjEGK>J&86ra<^y{fb#jCw;<9EI%qjMAwR!d8Z( z##e*sk;Q5|6Q0iC?vSQ?umHrg2tvSo=4^$>pL7#MASku1ENIn0{;5?>YiJ5oV$pfrg^)tqt&U=GUZiLqSMr&oq z^|P&|)+a7R@;6}ZrP*}AQA=9*z%Nx4(I(3!60s%2fS6(RV_D_FS?nor@u@zf@o%vl z#o7C#3~Uhcvg7Fam@_G7KW=bahyq!^pkoVoo0zL^2`FSO+@RXIe?MrJgP!Nl@$>2+ zqKZvgULKF(=5f$r_7ZD3@3%o$*+F>?OvIy3&eCr@IttooEhbn#N_cnoo0er; zU46rd&)I*-pP`g&u*R)ZY~ZnId({l3fO%###IwaBH{rPe&U#L3GvF@=$aJ~fBe3#* zCw}Sjw!9Qqw-?kFu$)O>woQyvSz(LPQLGOIpT4Fd;|e)M)x{5c-8=xh)j~~-D4{3} zt?-S#)y0CH^UXUy6!;qbUZeK`NgVPi*6E%M(Ik8R^z>_wvW(rHl9SH4@8h4FTU2C2 zEpO5hBscA@pwW!iR@^;VQemVK6IZ<|`1m3dowNK70?yKvZ$s#}-PSELw^}pUooo9+Bsl>D8L%T$sn~#^AJ} z*!Y3|%5*js0y7di&RZLdI^d1jNB_nZ>_nf+0QYarkcXqwyE}@lDTXLk_;J*8-9F>- zIu^ztnYFFuK>Egu8m8l7W|wc+j=#vxkQQLwa>g3jq@Jp_Q>WH-E>d1D7#3Sm39EE3 zvni!29*^0p!zY_?%^bTA#O*UkDcb5ditCz77#nuCLsvyE*f95%!OE_p0|?m=W~Oyq za#gOr9#@nVsl1FMH6vxvk@p)*^h{AK`Bd=oQO_tlj4=wqHhDfSW2|4gANZhO#c?F+ zoq9`ZCX$Ot-NHy5kguir{k!4SInw7BB^ILz}j|&vLKM6FA|ARr&$OqHN4dewu=R>zK>{r> z4E}09IW<|`EBfj(^On)>Mt+q$Qj#FbhkPld7#kWT|1}(0K<$m$X~-GVi+*6ehX>;$ zi*di0?aNZjeYsY!S^_%v-H7|J_JzI1Oi8z8LP%C$K^m?IlFg~Sv?%o)e#uOz;M(c& z>4rm1etA{5WcGdfcWlS=1Ym58&!O0zCmly=1RKHjv?tWG&*n*Lpj?(Lp#tQOC@YIZ z&cz-1gm&mTuI!GbvBs>-R$#fq+Dd$Z`-)>z{W)^iLEm8W3$ zx~_nNCor<`K?iFuG|Q1=TZg3RpgRI@%RL^pU7S?nQ*&~}^zN^BEAuj8@%>ik%+{&R zF3US1hahk<%ayrcKDNT+jO}v=d!*_`;osV1?{A1zQcO>FlnIiI%%+$(gw3HHeBvDDY%$BD3AwRA>`!f zAYeR^1v+&F&a^|puSIQty+$&w;iM&T#5$|>aWM|d@YHFhz_+v^20MB#>*=v@0%587 zB-h$1ZtI~KM(ldUa>n-E*?2f5pIxMX05XS$jZo~<_oC}`9*#pTy|KD_ry4as<1 z9WM=WWqFzudo944dF zt8i4z;x`$dVotmD%9XQ4M4tnHndMcuKom95FfWjQIPfYK`QdEx7v{n)an51mVll-H z3*Kx`p$sS?#x3OSx zqiZzDhDu*oGTbe^cLsBQ7A4o45Xcxm8-7pEjgBtc%h)PK4&lY^U_}mvXKu(;Nl&|z z^F5oU;t076iay{NC)=?u$JUtGXNHoB^4WqNh+4f#pRdI{r|tYGhTsRC@G8lE?<8U2 z1Tqgw#<_5Luwd-*?iyTR>$;5CV~m=0-3cP9db&$F91+shp>Qz#m^Ax5e8lRt%{H`N z$;W|6&U_lE5%D-7oUi>^dH1>3<%ERg*ZfFJg7sGLrzk;ki7(Y@%n504hTh4&k;Lh8 zW@ffJ6+q#F$0Msx6v6imD-K2+@}7$_zD{FHcF`OK+aFY!WIqY_pRoi+_gEc6S-5SD zu_)LIwNM098D|-g^Uchi@*7?$9ygjQU_T*pTzu9v3>JFsZqgR-+nUHKYq5@9Q1+tt zP0pj!7)0gDVdgCWUhwAD1{lFvCj2_HJ^7htbr-NDg&7-dn>&2fqG3*%ymw}GQIw>i z(V(7{w;miri^H=Jb!N%Yn_CrVaq(HD`rgMuuI}@ft*cDl$D*S6pWe~&8>2T# z+rw!H)o_Bt(|GL~VN9}~-n7u2Bwb$yLvb6A;tw*L&pXUh;2DfhA7AxnC-7nU0!Ui} z?;32;*rd}>zFvOltg$CYXD}&%NjoQcG$cWdGYU&3!<8Xp^nk=_-+!8GtJHpyyT3p&rL~8Xj zrRl>ndA#lPJI4AZKu=4g9-o&M%z6=Diwut{ zW-XD$`D>$>J^{8^Vfnju`;!KDgl%{}X7?YrWxtX_y@cb`#??x^RgPANmu?4SMd94K z*s_({FFt~P8Ihvb*lej8B-^*mJfpd>oo+kIc9^k02n~0c13X9q|GY_%ugNLNWkQ6K;_jB0UTEWOW?^Q2cFoEEh}L=G)lt`g&oDYpSX_` z7J6J4Sqoz{{}|}wEAUqONXjC{uW8yJ_tjKn)|*;(5Aick&r}*9AQRK)Z52~}6`2l$ zJDzIJHlMCM;gT0DYN7MRjafg@PCPDV!(+aAB>%(VAwm(Qq~Wh&Z2ir=x9Cx^%^9t( z!IE10*1O!cusWl;TGvc~ak|pF>p>wq&}$x>&w^w@8_67N={ z{d#uWcYW?svg7Qb6fjNaGLqJ|q2EQ&9he;7AF>mFxbRc^MYG%XD!ex$efMy~Qs{2;@B~8so1Ef(=K3!qi7APH2lg z?^hCT9l1^ww7Bi>eT+AZd++Y#lK^%eH}1=P}#`9$$eD4OdiV|Q@JP(te=UiDMCimJ{K zsa&JVVIY%`vy5!jrq@IYhRjz%tu!f$JTxv3(YYGkKW3DWio}Nk2%#$5rQwj|7QGAklI3@4?VU6EdG;Ol&JqLvmoo|5ic+t>__ z6jj7?g?xU<69`xGvi`u_I9gi0))T)kk&4YTR7%L4&zgQdUmQ0h@FH6`Jv<%oEiE1% z??&|em6FF@?REk^FEjVYEsx_j?H7Tw6XMEfZ({1p_T_2epvdG>KgPA@9UwC!{#8;L z>J18Iv}p@jU-_U#1?@o1xwYZ1wwMfp>S031lwziOy~v}=oCVyiZ`{6Q$Zxu9e6!cl zWi+TE0}_>DDk$~^CYsX-JQ5pN?eYt`n7Ry(ey6GxOEHPJ-xFFot@GSya1Olvhtk?8s)RRo+hR?v;NO`T<7Sei1qc7k&A0D6{OEI@idGj_q zVV^gr2$N|P`;QJ5TsY3B*a|D&nfc^5nRb#FX5hkV!ukd`DA`k7qOFEjK_qqm!*Hf}watxWPNnh?6)?|WO5swt`Us@SpKiYS^J5q&8g z$KGVB!rJF-Qh{&n(fT8#tu-#cu8;W~=|@O%L0GE&BcBHJN&#Kt;Piij4!BHBm>dZ z>u&YL7nYjF*NXhUBilM3^UWp8;$-&sIKq6U=+D^sQyt-ocLnm`tUqP6AKd zHg7dXjosM?3w||?L=Aa*=g4SV3K|-^%P-naE?39;Kbs|4pL^*jDQ| zEP)ABF^l!7{3wDo6n(3m)%S6Fn>Na`w@g-gyuOhbkJCg!fMw@)$5Iz?7rKqglo1#% zBcrUbn#@4n{VY*!7oC8dLa*1e9fE+ngFgS(NS#dR@dTL&PtqhCi6aJj`64v`;N<%n zLl&i5cw40}{T#32_O7}rUs1c6v(=@y1$xu7tFyM*_@?_c?OwsFFoZwqpdzC zheIfnp<5w~j>Tgla6rEyMwUw+h)v{ z0sa$bd?wd#N5DUFVN=80wGjGr79j|E$?OLD?QMf1WY-|om(_8f*-NYEQe*@u~M+ndCJls>ElGLFtd05zHP7drn>k3emxxd zJhGqncq8$4_$_OKOhg}Il}nuOgaBu7AS=_By4h!c#1yr#c&FOQJp~%E=OPtd*S1x1 zi$DdFr-jQQU)jM%=x*tv7TuQD8~D;sH;qkx+P2y_g`mgMbXXt90vS4!W~nS^(&yqa z*d>*%x@pIuj^(?vrkWveFmbnkt&?!Zkua!z*wQJkm$U0dlU`BBnnwa0lLFOZEhUC; zjI)@Jyz8jz_NGndvD~kVakh!rAo;?I=3^7-VT|J6<)b z3v$MKom8j7%%3YTWpwxrt3})0pm0508<#tJtKzn^y%)TgVgN1iL&vjaFG(Iw_V}^X zP<)zF;_6_v@E7D6^Q%_J@J>)#SsilAy4EH;N7oEu$A<_B(-qTG#g2-^Lo(j6co9D$ zi9t)?%H`#EGh&&zjVT>DPd(iMhwn}?C<3?rSDT^2oN-?hC&lL6+aLsXP}*G0vw2EA z?fQa9)826u_!dPCSd;>- z%vl`P;td`Pa&^1v#m-zBa6ewV@hdXJ3rpL+gybHY+gVt$rW!G*EVdmOFdP_=cRvy%Cl~Ln?k?&Q5|)G;!sK;3v4WOq_Wu zeWWyeycPP0ft#$o*Jjdu_9A%8=G%Bt0WUgO5{9z`hfoE$=n4?r*KD|Mk*K{Fns7lq z3z6aIT=DvD`kLw(xqn^-MV)T>P&q76AC_&fyu5 zs5X*KEk6=T30&*UzuVtlINm-O8B8;`7wklVVU@D;7H?;frTf+Ysgyg7)?g}{JO&E) zhae$xX&5X~Ap_7^<{{=4h`wX@VFkP;F#1Pnc-z~BF<1Ej>{MJt32e*P~_GpmyT literal 0 HcmV?d00001 diff --git a/docs/specifications/keystore.md b/docs/specifications/keystore.md new file mode 100644 index 00000000000..7e588ca9853 --- /dev/null +++ b/docs/specifications/keystore.md @@ -0,0 +1,295 @@ +# ![](https://img.shields.io/badge/status-wip-orange.svg?style=flat-square) Keystore + +**Authors(s):** +- [whyrusleeping](github.com/whyrusleeping) +- [Hector Sanjuan](github.com/hsanjuan) + +**Abstract** + +This spec provides definitions and operations for the keystore feature in IPFS. + +# Table of Contents + +- [Goals](#goals) +- [Planned Implementation](#planned-implementation) + - [Key storage](#key-storage) + - [Interface](#interface) + - [Code changes and additions](#code-changes-and-additions) + - [Structures](#structures) + +## Goals + +To have a secure, simple and user-friendly way of storing and managing keys +for use by ipfs. As well as the ability to share these keys, encrypt, decrypt, +sign and verify data. + +## Planned Implementation + +### Key storage + +Storage layout and format is defined in the [`repository_fs`](repository_fs.md) part of the spec. + +### Interface + +#### ipfs key + +``` +USAGE + ipfs key - Create and list IPNS name keypairs + + ipfs key + + 'ipfs key gen' generates a new keypair for usage with IPNS and 'ipfs name + publish'. + + > ipfs key gen --type=rsa --size=2048 mykey + > ipfs name publish --key=mykey QmSomeHash + + 'ipfs key list' lists the available keys. + + > ipfs key list + self + mykey + + +SUBCOMMANDS + ipfs key export - Export a keypair + ipfs key gen - Create a new keypair + ipfs key import - Import a key and prints imported key id + ipfs key list - List all local keypairs. + ipfs key rename - Rename a keypair. + ipfs key rm ... - Remove a keypair. + ipfs key rotate - Rotates the IPFS identity. + + For more information about each command, use: + 'ipfs key --help' +``` + +#### ipfs crypt + +**NOTE:** as of 2023 Q4, `ipfs crypt` commands are not implemented yet. + +``` + ipfs crypt - Perform cryptographic operations using ipfs keypairs + +SUBCOMMANDS: + + ipfs crypt sign - Generates a signature for the given data with a specified key + ipfs crypt verify - Verify that the given data and signature match + ipfs crypt encrypt - Encrypt the given data + ipfs crypt decrypt - Decrypt the given data + +DESCRIPTION: + + `ipfs crypt` is a command used to perform various cryptographic operations + using ipfs keypairs, including: signing, verifying, encrypting and decrypting. +``` + +#### Some subcommands: + +##### ipfs key Gen + + +``` +USAGE + ipfs key gen - Create a new keypair + +SYNOPSIS + ipfs key gen [--type= | -t] [--size= | -s] + [--ipns-base=] [--] + +ARGUMENTS + + - name of key to create + +OPTIONS + + -t, --type string - type of the key to create: rsa, ed25519. Default: + ed25519. + -s, --size int - size of the key to generate. + --ipns-base string - Encoding used for keys: Can either be a multibase + encoded CID or a base58btc encoded multihash. Takes + {b58mh|base36|k|base32|b...}. Default: base36. +``` + +* * * + +##### Key Send + +``` +USAGE + ipfs key - Create and list IPNS name keypairs + +SYNOPSIS + ipfs key + +DESCRIPTION + + 'ipfs key gen' generates a new keypair for usage with IPNS and 'ipfs name + publish'. + + > ipfs key gen --type=rsa --size=2048 mykey + > ipfs name publish --key=mykey QmSomeHash + + 'ipfs key list' lists the available keys. + + > ipfs key list + self + mykey + + +SUBCOMMANDS + ipfs key export - Export a keypair + ipfs key gen - Create a new keypair + ipfs key import - Import a key and prints imported key id + ipfs key list - List all local keypairs. + ipfs key rename - Rename a keypair. + ipfs key rm ... - Remove a keypair. + ipfs key rotate - Rotates the IPFS identity. + + For more information about each command, use: + 'ipfs key --help' +``` + +##### Comments: + +Ensure that the user knows the implications of sending a key. + +* * * + +##### Crypt Encrypt + +``` + ipfs crypt encrypt - Encrypt the given data with a specified key + +ARGUMENTS: + + data - The filename of the data to be encrypted ("-" for stdin) + +OPTIONS: + + -k, -key string - The name of the key to use for encryption (default: localkey) + -o, -output string - The name of the output file (default: stdout) + -c, -cipher string - The cipher to use for the operation + -m, -mode string - The block cipher mode to use for the operation + +DESCRIPTION: + + 'ipfs crypt encrypt' is a command used to encypt data so that only holders of a certain + key can read it. +``` + +##### Comments: + +This should probably just operate on raw data and not on DAGs. + +* * * + +##### Other Interface Changes + +We will also need to make additions to support keys in other commands, these changes are as follows: + +- `ipfs add` + - Support for a `-encrypt-key` option, for block encrypting the file being added with the key + - also adds an 'encrypted' node above the root unixfs node + - Support for a `-sign-key` option to attach a signature node above the root unixfs node + +- `ipfs block put` + - Support for a `-encrypt-key` option, for encrypting the block before hashing and storing + +- `ipfs object put` + - Support for a `-encrypt-key` option, for encrypting the object before hashing and storing + +- `ipfs name publish` + - Support for a `-key` option to select which keyspace to publish to + +### Code changes and additions + +This sections outlines code organization around this feature. + +#### Keystore package + +The fsrepo carries a `keystore` that can be used to load/store keys. The keystore is implemented following this interface: + +```go +// Keystore provides a key management interface +type Keystore interface { + // Has returns whether or not a key exist in the Keystore + Has(string) (bool, error) + // Put stores a key in the Keystore, if a key with the same name already exists, returns ErrKeyExists + Put(string, ci.PrivKey) error + // Get retrieves a key from the Keystore if it exists, and returns ErrNoSuchKey + // otherwise. + Get(string) (ci.PrivKey, error) + // Delete removes a key from the Keystore + Delete(string) error + // List returns a list of key identifier + List() ([]string, error) +} +``` + +Note: Never store passwords as strings, strings cannot be zeroed out after they are used. +using a byte array allows you to write zeroes over the memory so that the users password +does not linger in memory. + +#### Unixfs + +- new node types, 'encrypted' and 'signed', probably shouldn't be in unixfs, just understood by it +- if new node types are not unixfs nodes, special consideration must be given to the interop + +- DagReader needs to be able to access keystore to seamlessly stream encrypted data we have keys for + - also needs to be able to verify signatures + +#### Importer + +- DagBuilderHelper needs to be able to encrypt blocks + - Dag Nodes should be generated like normal, then encrypted, and their parents should + link to the hash of the encrypted node +- DagBuilderParams should have extra parameters to accommodate creating a DBH that encrypts the blocks + +#### New 'Encrypt' package + +Should contain code for crypto operations on dags. + +Encryption of dags should work by first generating a symmetric key, and using +that key to encrypt all the data. That key should then be encrypted with the +public key chosen and stored in the Encrypted DAG structure. + +Note: One option is to simply add it to the key interface. + +### Structures +Some tentative mockups (in json) of the new DAG structures for signing and encrypting + +Signed DAG: +``` +{ + "Links" : [ + { + "Name":"@content", + "Hash":"QmTheContent", + } + ], + "Data": protobuf{ + "Type":"Signed DAG", + "Signature": "thesignature", + "PubKeyID": "QmPubKeyHash", + } +} +``` + +Encrypted DAG: +``` +{ + "Links" : [ + { + "Name":"@content", + "Hash":"QmRawEncryptedDag", + } + ], + "Data": protobuf{ + "Type":"Encrypted DAG", + "PubKeyID": "QmPubKeyHash", + "Key": "ephemeral symmetric key, encrypted with public key", + } +} +``` diff --git a/docs/specifications/repository.md b/docs/specifications/repository.md new file mode 100644 index 00000000000..0e7d663d59e --- /dev/null +++ b/docs/specifications/repository.md @@ -0,0 +1,131 @@ +# ![](https://img.shields.io/badge/status-wip-orange.svg?style=flat-square) IPFS Repo Spec + +**Author(s)**: +- [Juan Benet](github.com/jbenet) + +**Abstract** + +This spec defines an IPFS Repo, its contents, and its interface. It does not specify how the repo data is actually stored, as that is done via swappable implementations. + +# Table of Contents + +- [Definition](#definition) +- [Repo Contents](#repo-contents) + - [version](#version) + - [datastore](#datastore) + - [keystore](#keystore) + - [config (state)](#config-state) + - [locks](#locks) + - [datastore\_spec](#datastore_spec) + - [hooks (TODO)](#hooks-todo) +- [Notes](#notes) + +## Definition + +A `repo` is the storage repository of an IPFS node. It is the subsystem that +actually stores the data IPFS nodes use. All IPFS objects are stored +in a repo (similar to git). + +There are many possible repo implementations, depending on the storage media +used. Most commonly, IPFS nodes use an [fs-repo](repository_fs.md). + +Repo Implementations: +- [fs-repo](repository_fs.md) - stored in the os filesystem +- mem-repo - stored in process memory +- s3-repo - stored in amazon s3 + +## Repo Contents + +The Repo stores a collection of [IPLD](https://github.com/ipld/specs#readme) objects that represent: + +- **config** - node configuration and settings +- **datastore** - content stored locally, and indexing data +- **keystore** - cryptographic keys, including node's identity +- **hooks** - scripts to run at predefined times (not yet implemented) + +Note that the IPLD objects a repo stores are divided into: +- **state** (system, control plane) used for the node's internal state +- **content** (userland, data plane) which represent the user's cached and pinned data. + +Additionally, the repo state must determine the following. These need not be IPLD objects, though it is of course encouraged: + +- **version** - the repo version, required for safe migrations +- **locks** - process semaphores for correct concurrent access +- **datastore_spec** - array of mounting points and their properties + +Finally, the repo also stores the blocks with blobs containing binary data. + +![](./ipfs-repo-contents.png) + +### version + +Repo implementations may change over time, thus they MUST include a `version` recognizable across versions. Meaning that a tool MUST be able to read the `version` of a given repo type. + +For example, the `fs-repo` simply includes a `version` file with the version number. This way, the repo contents can evolve over time but the version remains readable the same way across versions. + +### datastore + +IPFS nodes store some IPLD objects locally. These are either (a) **state objects** required for local operation -- such as the `config` and `keys` -- or (b) **content objects** used to represent data locally available. **Content objects** are either _pinned_ (stored until they are unpinned) or _cached_ (stored until the next repo garbage collection). + +The name "datastore" comes from [go-datastore](https://github.com/jbenet/go-datastore), a library for swappable key-value stores. Like its name-sake, some repo implementations feature swappable datastores, for example: +- an fs-repo with a leveldb datastore +- an fs-repo with a boltdb datastore +- an fs-repo with a union fs and leveldb datastore +- an fs-repo with an s3 datastore +- an s3-repo with a cached fs and s3 datastore + +This makes it easy to change properties or performance characteristics of a repo without an entirely new implementation. + +### keystore + +A Repo typically holds the keys a node has access to, for signing and for encryption. + +Details on operation and storage of the keystore can be found in [`repository_fs.md`](repository_fs.md) and [`keystore.md`](keystore.md). + +### config (state) + +The node's `config` (configuration) is a tree of variables, used to configure various aspects of operation. For example: +- the set of bootstrap peers IPFS uses to connect to the network +- the Swarm, API, and Gateway network listen addresses +- the Datastore configuration regarding the construction and operation of the on-disk storage system. + +There is a set of properties, which are mandatory for the repo usage. Those are `Addresses`, `Discovery`, `Bootstrap`, `Identity`, `Datastore` and `Keychain`. + +It is recommended that `config` files avoid identifying information, so that they may be re-shared across multiple nodes. + +**CHANGES**: today, implementations like js-ipfs and go-ipfs store the peer-id and private key directly in the config. These will be removed and moved out. + +### locks + +IPFS implementations may use multiple processes, or may disallow multiple processes from using the same repo simultaneously. Others may disallow using the same repo but may allow sharing _datastores_ simultaneously. This synchronization is accomplished via _locks_. + +All repos contain the following standard locks: +- `repo.lock` - prevents concurrent access to the repo. Must be held to _read_ or _write_. + +### datastore_spec + +This file is created according to the Datastore configuration specified in the `config` file. It contains an array with all the mounting points that the repo is using, as well as its properties. This way, the `datastore_spec` file must have the same mounting points as defined in the Datastore configuration. + +It is important pointing out that the `Datastore` in config must have a `Spec` property, which defines the structure of the ipfs datastore. It is a composable structure, where each datastore is represented by a json object. + +### hooks (TODO) + +Like git, IPFS nodes will allow `hooks`, a set of user configurable scripts to run at predefined moments in IPFS operations. This makes it easy to customize the behavior of IPFS nodes without changing the implementations themselves. + +## Notes + +#### A Repo uniquely identifies an IPFS Node + +A repository uniquely identifies a node. Running two different IPFS programs with identical repositories -- and thus identical identities -- WILL cause problems. + +Datastores MAY be shared -- with proper synchronization -- though note that sharing datastore access MAY erode privacy. + +#### Repo implementation changes MUST include migrations + +**DO NOT BREAK USERS' DATA.** This is critical. Thus, any changes to a repo's implementation **MUST** be accompanied by a **SAFE** migration tool. + +See https://github.com/jbenet/go-ipfs/issues/537 and https://github.com/jbenet/random-ideas/issues/33 + +#### Repo Versioning + +A repo version is a single incrementing integer. All versions are considered non-compatible. Repos of different versions MUST be run through the appropriate migration tools before use. diff --git a/docs/specifications/repository_fs.md b/docs/specifications/repository_fs.md new file mode 100644 index 00000000000..01e30d1c393 --- /dev/null +++ b/docs/specifications/repository_fs.md @@ -0,0 +1,279 @@ +# ![](https://img.shields.io/badge/status-wip-orange.svg?style=flat-square) fs-repo + +**Author(s)**: +- [Juan Benet](github.com/jbenet) +- [David Dias](github.com/daviddias) +- [Hector Sanjuan](github.com/hsanjuan) + +**Abstract** + +This spec defines `fs-repo` version `1`, its formats, and semantics. + +# Table of Contents + +- [Definition](#definition) +- [Contents](#contents) + - [api](#api) + - [blocks/](#blocks) + - [config](#config) + - [hooks/](#hooks) + - [keystore/](#keystore) + - [datastore/](#datastore) + - [logs/](#logs) + - [repo.lock](#repolock) + - [version](#version) +- [Datastore](#datastore-1) +- [Notes](#notes) + - [Location](#location) + - [blocks/ with an fs-datastore](#blocks-with-an-fs-datastore) + - [Reading without the `repo.lock`](#reading-without-the-repolock) + +## Definition + +`fs-repo` is a filesystem implementation of the IPFS [repo](repository.md). + + +## Contents + +![](img/ipfs-repo-contents.png?) + +``` +.ipfs/ +├── api <--- running daemon api addr +├── blocks/ <--- objects stored directly on disk +│ └── aa <--- prefix namespacing like git +│ └── aa <--- N tiers +├── config <--- config file (json or toml) +├── hooks/ <--- hook scripts +├── keystore/ <--- cryptographic keys +│ ├── key_b32name <--- private key with base32-encoded name +├── datastore/ <--- datastore +├── logs/ <--- 1 or more files (log rotate) +│ └── events.log <--- can be tailed +├── repo.lock <--- mutex for repo +└── version <--- version file +``` + +### api + +`./api` is a file that exists to denote an API endpoint to listen to. +- It MAY exist even if the endpoint is no longer live (i.e. it is a _stale_ or left-over `./api` file). + +In the presence of an `./api` file, ipfs tools (e.g. go-ipfs `ipfs daemon`) MUST attempt to delegate to the endpoint, and MAY remove the file if reasonably certain the file is stale. (e.g. endpoint is local, but no process is live) + +The `./api` file is used in conjunction with the `repo.lock`. Clients may opt to use the api service, or wait until the process holding `repo.lock` exits. The file's content is the api endpoint as a [multiaddr](https://github.com/jbenet/multiaddr) + +``` +> cat .ipfs/api +/ip4/127.0.0.1/tcp/5001 +``` + +Notes: +- The API server must remove the api file before releasing the `repo.lock`. +- It is not enough to use the `config` file, as the API addr of a daemon may + have been overridden via ENV or flag. + +#### api file for remote control + +One use case of the `api` file is to have a repo directory like: + +``` +> tree $IPFS_PATH +/Users/jbenet/.ipfs +└── api + +0 directories, 1 files + +> cat $IPFS_PATH/api +/ip4/1.2.3.4/tcp/5001 +``` + +In go-ipfs, this has the same effect as: + +``` +ipfs --api /ip4/1.2.3.4/tcp/5001 +``` + +Meaning that it makes ipfs tools use an ipfs node at the given endpoint, instead of the local directory as a repo. + +In this use case, the rest of the `$IPFS_PATH` may be completely empty, and no other information is necessary. It cannot be said it is a _repo_ per-se. (TODO: come up with a good name for this). + +### blocks/ + +The `block/` component contains the raw data representing all IPFS objects +stored locally, whether pinned or cached. This component is controlled by the ` +datastore`. For example, it may be stored within a leveldb instance in ` +datastore/`, or it may be stored entirely with independent files, like git. + +In the default case, the user uses fs-datastore for all `/blocks` so the +objects are stored in individual files. In other cases, `/blocks` may even be +stored remotely + +- [blocks/ with an fs-datastore](#blocks-with-an-fs-datastore) + +### config + +The `config` file is a JSON or TOML file that contains the tree of +configuration variables. It MUST only be changed while holding the +`repo.lock`, or potentially lose edits. + +### hooks/ + +The `hooks` directory contains executable scripts to be called on specific +events to alter ipfs node behavior. + +Currently available hooks: + +``` +none +``` + +### keystore/ + + +The `keystore` directory holds additional private keys that the node has +access to (the public keys can be derived from them). + +The keystore repository should have `0700` permissions (readable, writable by +the owner only). + +The key files are named as `key_base32encodedNameNoPadding` where `key_` is a +fixed prefix followed by a base32 encoded identifier, **without padding and +downcased**. The identifier usually corresponds to a human-friendly name given +by the user. + +The key files should have '0400' permissions (read-only, by the owner only). + +The `self` key identifier is reserved for the peer's main key, and therefore key named +`key_onswyzq` is allowed in this folder. + +The key files themselves contain a serialized representation of the keys as +defined in the +[libp2p specification](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#keys). + +### datastore/ + +The `datastore` directory contains the data for a leveldb instance used to +store operation data for the IPFS node. If the user uses a `boltdb` datastore +instead, the directory will be named `boltdb`. Thus the data files of each +database will not clash. + +TODO: consider whether all should just be named `leveldb/` + +### logs/ + +IPFS implementations put event log files inside the `logs/` directory. The +latest log file is `logs/events`. Others, rotated out may exist, with a +timestamp of their creation. For example: + + + +### repo.lock + +`repo.lock` prevents concurrent access to the repo. Its content SHOULD BE the +PID of the process currently holding the lock. This allows clients to detect +a failed lock and cleanup. + +``` +> cat .ipfs/repo.lock +42 +> ps | grep "ipfs daemon" +42 ttys000 79:05.83 ipfs daemon +``` + +**TODO, ADDRESS DISCREPANCY:** the go-ipfs implementation does not currently store the PID in the file, which in some systems causes failures after a failure or a teardown. This SHOULD NOT require any manual intervention-- a present lock should give new processes enough information to recover. Doing this correctly in a portable, safe way, with good UX is very tricky. We must be careful with TOCTTOU bugs, and multiple concurrent processes capable of running at any moment. The goal is for all processes to operate safely, to avoid bothering the user, and for the repo to always remain in a correct, consistent state. + +### version + +The `version` file contains the repo implementation name and version. This format has changed over time: + +``` +# in version 0 +> cat $repo-at-version-0/version +cat: /Users/jbenet/.ipfs/version: No such file or directory + +# in versions 1 and 2 +> cat $repo-at-version-1/version +1 +> cat $repo-at-version-2/version +2 + +# in versions >3 +> cat $repo-at-version-3/version +fs-repo/3 +``` + +_Any_ fs-repo implementation of _any_ versions `>0` MUST be able to read the +`version` file. It MUST NOT change format between versions. The sole exception is version 0, which had no file. + +**TODO: ADDRESS DISCREPANCY:** versions 1 and 2 of the go-ipfs implementation use just the integer number. It SHOULD have used `fs-repo/`. We could either change the spec and always just use the int, or change go-ipfs in version `>3`. we will have to be backwards compatible. + +## Datastore + +Both the `/blocks` and `/datastore` directories are controlled by the +`datastore` component of the repo. + +## Notes + +### Location + +The `fs-repo` can be located anywhere on the filesystem. By default +clients should search for a repo in: + +``` +~/.ipfs +``` + +Users can tell IPFS programs to look elsewhere with the env var: + +``` +IPFS_PATH=/path/to/repo +``` + +### blocks/ with an fs-datastore + +![](fs-datastore.png) + +Each object is stored in its own file. The filename is the hash of the object. +The files are nested in directories whose names are prefixes of the hash, as +in `.git/objects`. + +For example: +```sh +# multihashes +1220fe389b55ea958590769f9046b0f7268bca90a92e4a9f45cbb30930f4bf89269d # sha2 +1114f623e0ec7f8719fb14a18838d2a3ef4e550b5e53 # sha1 + +# locations of the blocks +.ipfs/blocks/1114/f6/23/e0ec7f8719fb14a18838d2a3ef4e550b5e53 +.ipfs/blocks/1220/fe/38/9b55ea958590769f9046b0f7268bca90a92e4a9f45cbb30930f4bf89269d +``` + +**Important Notes:** +- the hashes are encoded in hex, not the usual base58, because some + filesystems are case insensitive. +- the multihash prefix is two bytes, which would waste two directory levels, + thus these are combined into one. +- the git `idx` and `pack` file formats could be used to coalesce objects + +**TODO: ADDRESS DISCREPANCY:** + +the go-ipfs fs-repo in version 2 uses a different `blocks/` dir layout: + +``` +/Users/jbenet/.ipfs/blocks +├── 12200007 +│ └── 12200007d4e3a319cd8c7c9979280e150fc5dbaae1ce54e790f84ae5fd3c3c1a0475.data +├── 1220000f +│ └── 1220000fadd95a98f3a47c1ba54a26c77e15c1a175a975d88cf198cc505a06295b12.data +``` + +We MUST address whether we should change the fs-repo spec to match go-ipfs in version 2, or we should change go-ipfs to match the fs-repo spec (more tiers). We MUST also address whether the levels are a repo version parameter or a config parameter. There are filesystems in which a different fanout will have wildly different performance. These are mostly networked and legacy filesystems. + +### Reading without the `repo.lock` + +Programs MUST hold the `repo.lock` while reading and writing most files in the +repo. The only two exceptions are: + +- `repo.lock` - so clients may check for it +- `api` - so clients may use the API From 2b347a914d631b79a63246e1e028dc1b9a15512a Mon Sep 17 00:00:00 2001 From: Jorropo Date: Sat, 18 Nov 2023 00:54:09 +0300 Subject: [PATCH 273/286] graphsync: remove support for the server Updates: #9396 Closes: #6831 Closes: #6208 Currently the Graphsync server is not widely used due to lack of compatible software. There have been many years yet we are unable to find any production software making use of the graphsync server in Kubo. There exists some in the filecoin ecosystem but we are not aware of uses with Kubo. Even in filecoin graphsync is not the only datatransfer solution available like it could have been in the past. `go-graphsync` is also developped on many concurrent branches. The specification for graphsync are less clear than the trustless gateway one and lack a complete conformance test suite any implementation can run. It is not easily extansible either because selectors are too limited for interesting queries without sideloading ADLs, which for now are hardcoded solutions. Finaly Kubo is consistently one of the fastest software to update to a new go-libp2p release. This means the burden to track go-libp2p changes in go-graphsync falls on us, else Kubo cannot compile even if almost all users do not use this feature. We are then removing the graphsync server experiment. For people who want alternatives we would like you to try the Trustless-Gateway-over-Libp2p experiment instead, the protocol is simpler (request-response-based) and let us reuse both clients and servers with minimal injection in the network layer. If you think this is a mistake and we should put it back you should try to answer theses points: - Find a piece of opensource code which uses a graphsync client to download data from Kubo. - Why is Trustless-Gateway-over-Libp2p not suitable instead ? - Why is bitswap not suitable instead ? Implementation details such as go-graphsync performance vs boxo/gateway is not very interesting to us in this discussion unless they are really huge (in the range of 10x~100x+ more) because the gateway code is under high development and we would be interested in fixing theses. --- config/experiments.go | 5 +- config/types.go | 24 ++ core/core.go | 2 - core/node/graphsync.go | 23 -- core/node/groups.go | 1 - docs/changelogs/v0.25.md | 10 + docs/examples/kubo-as-a-library/go.mod | 5 - docs/examples/kubo-as-a-library/go.sum | 11 - docs/experimental-features.md | 20 +- go.mod | 3 - go.sum | 8 - test/bin/Rules.mk | 5 - test/dependencies/go.mod | 58 +---- test/dependencies/go.sum | 211 +----------------- .../graphsync-get/graphsync-get.go | 128 ----------- test/sharness/Rules.mk | 2 +- test/sharness/t0221-graphsync.sh | 35 --- 17 files changed, 49 insertions(+), 502 deletions(-) delete mode 100644 core/node/graphsync.go delete mode 100644 test/dependencies/graphsync-get/graphsync-get.go delete mode 100755 test/sharness/t0221-graphsync.sh diff --git a/config/experiments.go b/config/experiments.go index 3a63d253da4..fab1f953c2e 100644 --- a/config/experiments.go +++ b/config/experiments.go @@ -4,12 +4,13 @@ type Experiments struct { FilestoreEnabled bool UrlstoreEnabled bool ShardingEnabled bool `json:",omitempty"` // deprecated by autosharding: https://github.com/ipfs/kubo/pull/8527 - GraphsyncEnabled bool Libp2pStreamMounting bool P2pHttpProxy bool //nolint StrategicProviding bool - AcceleratedDHTClient experimentalAcceleratedDHTClient `json:",omitempty"` OptimisticProvide bool OptimisticProvideJobsPoolSize int GatewayOverLibp2p bool `json:",omitempty"` + + GraphsyncEnabled graphsyncEnabled `json:",omitempty"` + AcceleratedDHTClient experimentalAcceleratedDHTClient `json:",omitempty"` } diff --git a/config/types.go b/config/types.go index 131324efe2d..506139318ee 100644 --- a/config/types.go +++ b/config/types.go @@ -481,3 +481,27 @@ func (experimentalAcceleratedDHTClient) UnmarshalJSON(b []byte) error { // does not support omitempty on structs and I can't be bothered to write custom // marshalers on all structs that have a doNotUse field. type doNotUse bool + +type graphsyncEnabled doNotUse + +var _ json.Unmarshaler = graphsyncEnabled(false) + +func (graphsyncEnabled) UnmarshalJSON(b []byte) error { + d := json.NewDecoder(bytes.NewReader(b)) + for { + switch tok, err := d.Token(); err { + case io.EOF: + return nil + case nil: + switch tok { + case json.Delim('{'), json.Delim('}'), false: + // accept empty objects and false + continue + } + //nolint + return fmt.Errorf("Support for Experimental.GraphsyncEnabled has been removed in Kubo 0.25.0, please remove this key. For more details see https://github.com/ipfs/kubo/pull/9747.") + default: + return err + } + } +} diff --git a/core/core.go b/core/core.go index 40c6808596d..0c9333e0683 100644 --- a/core/core.go +++ b/core/core.go @@ -26,7 +26,6 @@ import ( mfs "github.com/ipfs/boxo/mfs" pathresolver "github.com/ipfs/boxo/path/resolver" provider "github.com/ipfs/boxo/provider" - "github.com/ipfs/go-graphsync" ipld "github.com/ipfs/go-ipld-format" logging "github.com/ipfs/go-log" goprocess "github.com/jbenet/goprocess" @@ -107,7 +106,6 @@ type IpfsNode struct { Namesys namesys.NameSystem // the name system, resolves paths to hashes Provider provider.System // the value provider system IpnsRepub *ipnsrp.Republisher `optional:"true"` - GraphExchange graphsync.GraphExchange `optional:"true"` ResourceManager network.ResourceManager `optional:"true"` PubSub *pubsub.PubSub `optional:"true"` diff --git a/core/node/graphsync.go b/core/node/graphsync.go deleted file mode 100644 index 4425d66fff3..00000000000 --- a/core/node/graphsync.go +++ /dev/null @@ -1,23 +0,0 @@ -package node - -import ( - blockstore "github.com/ipfs/boxo/blockstore" - "github.com/ipfs/go-graphsync" - gsimpl "github.com/ipfs/go-graphsync/impl" - "github.com/ipfs/go-graphsync/network" - "github.com/ipfs/go-graphsync/storeutil" - libp2p "github.com/libp2p/go-libp2p/core" - "go.uber.org/fx" - - "github.com/ipfs/kubo/core/node/helpers" -) - -// Graphsync constructs a graphsync -func Graphsync(lc fx.Lifecycle, mctx helpers.MetricsCtx, host libp2p.Host, bs blockstore.GCBlockstore) graphsync.GraphExchange { - ctx := helpers.LifecycleCtx(mctx, lc) - - network := network.NewFromLibp2pHost(host) - return gsimpl.New(ctx, network, - storeutil.LinkSystemForBlockstore(bs), - ) -} diff --git a/core/node/groups.go b/core/node/groups.go index e101bb3ed93..e1e2e4b9c98 100644 --- a/core/node/groups.go +++ b/core/node/groups.go @@ -290,7 +290,6 @@ func Online(bcfg *BuildCfg, cfg *config.Config, userResourceOverrides rcmgr.Part return fx.Options( fx.Provide(BitswapOptions(cfg, shouldBitswapProvide)), fx.Provide(OnlineExchange()), - maybeProvide(Graphsync, cfg.Experimental.GraphsyncEnabled), fx.Provide(DNSResolver), fx.Provide(Namesys(ipnsCacheSize)), fx.Provide(Peering), diff --git a/docs/changelogs/v0.25.md b/docs/changelogs/v0.25.md index 1ad032ed305..98e2a04f9d4 100644 --- a/docs/changelogs/v0.25.md +++ b/docs/changelogs/v0.25.md @@ -7,6 +7,7 @@ - [Overview](#overview) - [🔦 Highlights](#-highlights) - [RPC `API.Authorizations`](#rpc-apiauthorizations) + - [Graphsync Experiment Removal](#graphsync-experiment-removal) - [📝 Changelog](#-changelog) - [👨‍👩‍👧‍👦 Contributors](#-contributors) @@ -27,6 +28,15 @@ This feature is opt-in. By default, no authorization is set up. For configuration instructions, refer to the [documentation](https://github.com/ipfs/kubo/blob/master/docs/config.md#apiauthorizations). +#### Graphsync Experiment Removal + +Currently the Graphsync server is to our knowledge not used +due to lack of compatible software. +And we are left to have to maintain the go-graphsync implementation when trying +to update Kubo because some dependency changed and it fails to build anymore. + +For more information see https://github.com/ipfs/kubo/pull/9747. + ### 📝 Changelog ### 👨‍👩‍👧‍👦 Contributors diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index a370e26a362..d930f99fbf8 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -55,7 +55,6 @@ require ( github.com/google/uuid v1.3.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect @@ -74,11 +73,8 @@ require ( github.com/ipfs/go-ds-leveldb v0.5.0 // indirect github.com/ipfs/go-ds-measure v0.2.0 // indirect github.com/ipfs/go-fs-lock v0.0.7 // indirect - github.com/ipfs/go-graphsync v0.16.0 // indirect - github.com/ipfs/go-ipfs-blockstore v1.3.0 // indirect github.com/ipfs/go-ipfs-delay v0.0.1 // indirect github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect - github.com/ipfs/go-ipfs-files v0.3.0 // indirect github.com/ipfs/go-ipfs-pq v0.0.3 // indirect github.com/ipfs/go-ipfs-redirects-file v0.1.1 // indirect github.com/ipfs/go-ipfs-util v0.0.3 // indirect @@ -195,7 +191,6 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.1 // indirect go.uber.org/fx v1.20.1 // indirect go.uber.org/mock v0.3.0 // indirect diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index 52792597383..1dc80d22972 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -280,8 +280,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QG github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e h1:3YKHER4nmd7b5qy5t0GWDTwSn4OyRgfAXSmo6VnryBY= -github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e/go.mod h1:I8h3MITA53gN9OnWGCgaMa0JWVRdXthWw4M3CPM54OY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -343,10 +341,7 @@ github.com/ipfs/go-ds-measure v0.2.0 h1:sG4goQe0KDTccHMyT45CY1XyUbxe5VwTKpg2LjAp github.com/ipfs/go-ds-measure v0.2.0/go.mod h1:SEUD/rE2PwRa4IQEC5FuNAmjJCyYObZr9UvVh8V3JxE= github.com/ipfs/go-fs-lock v0.0.7 h1:6BR3dajORFrFTkb5EpCUFIAypsoxpGpDSVUdFwzgL9U= github.com/ipfs/go-fs-lock v0.0.7/go.mod h1:Js8ka+FNYmgQRLrRXzU3CB/+Csr1BwrRilEcvYrHhhc= -github.com/ipfs/go-graphsync v0.16.0 h1:0BX7whXlV13Y9FZ/jRg+xaGHaGYbtGxGppKD6tncw6k= -github.com/ipfs/go-graphsync v0.16.0/go.mod h1:WfbMW3hhmX5GQEQ+KJxsFzVJVBKgC5szfrYK7Zc7xIM= github.com/ipfs/go-ipfs-blockstore v1.3.0 h1:m2EXaWgwTzAfsmt5UdJ7Is6l4gJcaM/A12XwJyvYvMM= -github.com/ipfs/go-ipfs-blockstore v1.3.0/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8= github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= @@ -356,9 +351,6 @@ github.com/ipfs/go-ipfs-ds-help v1.1.0 h1:yLE2w9RAsl31LtfMt91tRZcrx+e61O5mDxFRR9 github.com/ipfs/go-ipfs-ds-help v1.1.0/go.mod h1:YR5+6EaebOhfcqVCyqemItCLthrpVNot+rsOU/5IatU= github.com/ipfs/go-ipfs-exchange-interface v0.2.0 h1:8lMSJmKogZYNo2jjhUs0izT+dck05pqUw4mWNW9Pw6Y= github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA= -github.com/ipfs/go-ipfs-files v0.3.0 h1:fallckyc5PYjuMEitPNrjRfpwl7YFt69heCOUhsbGxQ= -github.com/ipfs/go-ipfs-files v0.3.0/go.mod h1:xAUtYMwB+iu/dtf6+muHNSFQCJG2dSiStR2P6sn9tIM= -github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE= github.com/ipfs/go-ipfs-pq v0.0.3/go.mod h1:btNw5hsHBpRcSSgZtiNm/SLj5gYIZ18AKtv3kERkRb4= github.com/ipfs/go-ipfs-redirects-file v0.1.1 h1:Io++k0Vf/wK+tfnhEh63Yte1oQK5VGT2hIEYpD0Rzx8= @@ -376,7 +368,6 @@ github.com/ipfs/go-ipld-git v0.1.1 h1:TWGnZjS0htmEmlMFEkA3ogrNCqWjIxwr16x1OsdhG+ github.com/ipfs/go-ipld-git v0.1.1/go.mod h1:+VyMqF5lMcJh4rwEppV0e6g4nCCHXThLYYDpKUkJubI= github.com/ipfs/go-ipld-legacy v0.2.1 h1:mDFtrBpmU7b//LzLSypVrXsD8QxkEWxu5qVxN99/+tk= github.com/ipfs/go-ipld-legacy v0.2.1/go.mod h1:782MOUghNzMO2DER0FlBR94mllfdCJCkTtDtPM51otM= -github.com/ipfs/go-libipfs v0.7.0 h1:Mi54WJTODaOL2/ZSm5loi3SwI3jI2OuFWUrQIkJ5cpM= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-log v1.0.3/go.mod h1:OsLySYkwIbiSUR/yBTdv1qPtcE4FW3WPWk/ewz9Ru+A= github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= @@ -409,7 +400,6 @@ github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7Bd github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-cienv v0.1.0 h1:Vc/s0QbQtoxX8MwwSLWWh+xNNZvM3Lw7NsTcHrvvhMc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= -github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c h1:uUx61FiAa1GI6ZmVd2wf2vULeQZIKG66eybjNXKYCz4= github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= @@ -852,7 +842,6 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.20.1 h1:zVwVQGS8zYvhh9Xxcu4w1M6ESyeMzebzj2NbSayZ4Mk= diff --git a/docs/experimental-features.md b/docs/experimental-features.md index 6826a38c2f2..09640274ea9 100644 --- a/docs/experimental-features.md +++ b/docs/experimental-features.md @@ -518,25 +518,11 @@ ipfs config --json Experimental.StrategicProviding true ### State -Experimental, disabled by default. - -[GraphSync](https://github.com/ipfs/go-graphsync) is the next-gen graph exchange -protocol for IPFS. - -When this feature is enabled, IPFS will make files available over the graphsync -protocol. However, IPFS will not currently use this protocol to _fetch_ files. +Removed, no plans to reintegrate either as experimental or stable feature. -### How to enable - -Modify your ipfs config: - -``` -ipfs config --json Experimental.GraphsyncEnabled true -``` - -### Road to being a real feature +[Trustless Gateway over Libp2p](#http-gateway-over-libp2p) should be easier to use for unixfs usecases and support basic wildcard car streams for non unixfs. -- [ ] We need to confirm that it can't be used to DoS a node. The server-side logic for GraphSync is quite complex and, if we're not careful, the server might end up performing unbounded work when responding to a malicious request. +See https://github.com/ipfs/kubo/pull/9747 for more information. ## Noise diff --git a/go.mod b/go.mod index b4797b84a4c..6b114c9f75f 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,6 @@ require ( github.com/ipfs/go-ds-leveldb v0.5.0 github.com/ipfs/go-ds-measure v0.2.0 github.com/ipfs/go-fs-lock v0.0.7 - github.com/ipfs/go-graphsync v0.16.0 github.com/ipfs/go-ipfs-cmds v0.10.0 github.com/ipfs/go-ipld-format v0.6.0 github.com/ipfs/go-ipld-git v0.1.1 @@ -129,7 +128,6 @@ require ( github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect @@ -145,7 +143,6 @@ require ( github.com/ipfs/go-ipfs-redirects-file v0.1.1 // indirect github.com/ipfs/go-ipfs-util v0.0.3 // indirect github.com/ipfs/go-ipld-cbor v0.0.6 // indirect - github.com/ipfs/go-libipfs v0.7.0 // indirect github.com/ipfs/go-merkledag v0.11.0 // indirect github.com/ipfs/go-peertaskqueue v0.8.1 // indirect github.com/ipfs/go-verifcid v0.0.2 // indirect diff --git a/go.sum b/go.sum index 0a52cb58518..a28c6ab3b03 100644 --- a/go.sum +++ b/go.sum @@ -314,8 +314,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QG github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU= github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48= -github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e h1:3YKHER4nmd7b5qy5t0GWDTwSn4OyRgfAXSmo6VnryBY= -github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e/go.mod h1:I8h3MITA53gN9OnWGCgaMa0JWVRdXthWw4M3CPM54OY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -379,8 +377,6 @@ github.com/ipfs/go-ds-measure v0.2.0 h1:sG4goQe0KDTccHMyT45CY1XyUbxe5VwTKpg2LjAp github.com/ipfs/go-ds-measure v0.2.0/go.mod h1:SEUD/rE2PwRa4IQEC5FuNAmjJCyYObZr9UvVh8V3JxE= github.com/ipfs/go-fs-lock v0.0.7 h1:6BR3dajORFrFTkb5EpCUFIAypsoxpGpDSVUdFwzgL9U= github.com/ipfs/go-fs-lock v0.0.7/go.mod h1:Js8ka+FNYmgQRLrRXzU3CB/+Csr1BwrRilEcvYrHhhc= -github.com/ipfs/go-graphsync v0.16.0 h1:0BX7whXlV13Y9FZ/jRg+xaGHaGYbtGxGppKD6tncw6k= -github.com/ipfs/go-graphsync v0.16.0/go.mod h1:WfbMW3hhmX5GQEQ+KJxsFzVJVBKgC5szfrYK7Zc7xIM= github.com/ipfs/go-ipfs-blockstore v1.3.0 h1:m2EXaWgwTzAfsmt5UdJ7Is6l4gJcaM/A12XwJyvYvMM= github.com/ipfs/go-ipfs-blockstore v1.3.0/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= @@ -395,8 +391,6 @@ github.com/ipfs/go-ipfs-ds-help v1.1.0/go.mod h1:YR5+6EaebOhfcqVCyqemItCLthrpVNo github.com/ipfs/go-ipfs-exchange-interface v0.2.0 h1:8lMSJmKogZYNo2jjhUs0izT+dck05pqUw4mWNW9Pw6Y= github.com/ipfs/go-ipfs-exchange-interface v0.2.0/go.mod h1:z6+RhJuDQbqKguVyslSOuVDhqF9JtTrO3eptSAiW2/Y= github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA= -github.com/ipfs/go-ipfs-files v0.3.0 h1:fallckyc5PYjuMEitPNrjRfpwl7YFt69heCOUhsbGxQ= -github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE= github.com/ipfs/go-ipfs-pq v0.0.3/go.mod h1:btNw5hsHBpRcSSgZtiNm/SLj5gYIZ18AKtv3kERkRb4= github.com/ipfs/go-ipfs-redirects-file v0.1.1 h1:Io++k0Vf/wK+tfnhEh63Yte1oQK5VGT2hIEYpD0Rzx8= @@ -415,8 +409,6 @@ github.com/ipfs/go-ipld-git v0.1.1 h1:TWGnZjS0htmEmlMFEkA3ogrNCqWjIxwr16x1OsdhG+ github.com/ipfs/go-ipld-git v0.1.1/go.mod h1:+VyMqF5lMcJh4rwEppV0e6g4nCCHXThLYYDpKUkJubI= github.com/ipfs/go-ipld-legacy v0.2.1 h1:mDFtrBpmU7b//LzLSypVrXsD8QxkEWxu5qVxN99/+tk= github.com/ipfs/go-ipld-legacy v0.2.1/go.mod h1:782MOUghNzMO2DER0FlBR94mllfdCJCkTtDtPM51otM= -github.com/ipfs/go-libipfs v0.7.0 h1:Mi54WJTODaOL2/ZSm5loi3SwI3jI2OuFWUrQIkJ5cpM= -github.com/ipfs/go-libipfs v0.7.0/go.mod h1:KsIf/03CqhICzyRGyGo68tooiBE2iFbI/rXW7FhAYr0= github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM= github.com/ipfs/go-log v1.0.3/go.mod h1:OsLySYkwIbiSUR/yBTdv1qPtcE4FW3WPWk/ewz9Ru+A= github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= diff --git a/test/bin/Rules.mk b/test/bin/Rules.mk index 02b0a4e5b8b..4e264106a95 100644 --- a/test/bin/Rules.mk +++ b/test/bin/Rules.mk @@ -18,11 +18,6 @@ $(d)/go-sleep: github.com/ipfs/kubo/test/dependencies/go-sleep $(go-build-testdep) TGTS_$(d) += $(d)/go-sleep -.PHONY: github.com/ipfs/kubo/test/dependencies/graphsync-get -$(d)/graphsync-get: github.com/ipfs/kubo/test/dependencies/graphsync-get - $(go-build-testdep) -TGTS_$(d) += $(d)/graphsync-get - .PHONY: github.com/ipfs/kubo/test/dependencies/go-timeout $(d)/go-timeout: github.com/ipfs/kubo/test/dependencies/go-timeout $(go-build-testdep) diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index dd6346b62e2..5bfe4383fcc 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -7,19 +7,13 @@ replace github.com/ipfs/kubo => ../../ require ( github.com/Kubuxu/gocovmerge v0.0.0-20161216165753-7ecaa51963cd github.com/golangci/golangci-lint v1.54.1 - github.com/ipfs/boxo v0.15.0 - github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cidutil v0.1.0 - github.com/ipfs/go-datastore v0.6.0 - github.com/ipfs/go-graphsync v0.16.0 github.com/ipfs/go-log v1.0.5 github.com/ipfs/hang-fds v0.1.0 github.com/ipfs/iptb v1.4.0 github.com/ipfs/iptb-plugins v0.5.0 - github.com/ipld/go-ipld-prime v0.21.0 github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c github.com/jbenet/go-random-files v0.0.0-20190219210431-31b3f20ebded - github.com/libp2p/go-libp2p v0.32.1 github.com/multiformats/go-multiaddr v0.12.0 github.com/multiformats/go-multihash v0.2.3 gotest.tools/gotestsum v0.4.2 @@ -37,13 +31,11 @@ require ( github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect - github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect - github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect @@ -55,32 +47,24 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect - github.com/containerd/cgroups v1.1.0 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/daixiang0/gci v0.11.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect - github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/elastic/gosigar v0.14.2 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ettle/strcase v0.1.1 // indirect github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 // indirect github.com/fatih/color v1.15.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect - github.com/flynn/noise v1.0.0 // indirect - github.com/francoispqt/gojay v1.2.13 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -90,7 +74,6 @@ require ( github.com/go-toolsmith/typep v1.1.0 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect - github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect @@ -105,16 +88,13 @@ require ( github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gopacket v1.1.19 // indirect - github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect github.com/google/uuid v1.3.1 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect - github.com/gorilla/websocket v1.5.0 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect github.com/gostaticanalysis/nilerr v0.1.1 // indirect github.com/gxed/go-shellwords v1.0.3 // indirect - github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-version v1.6.0 // indirect @@ -122,26 +102,20 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect - github.com/huin/goupnp v1.3.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/bbloom v0.0.4 // indirect - github.com/ipfs/go-bitfield v1.1.0 // indirect + github.com/ipfs/boxo v0.15.0 // indirect github.com/ipfs/go-block-format v0.2.0 // indirect - github.com/ipfs/go-ipfs-blockstore v1.3.0 // indirect - github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect - github.com/ipfs/go-ipfs-files v0.2.0 // indirect - github.com/ipfs/go-ipfs-pq v0.0.3 // indirect + github.com/ipfs/go-cid v0.4.1 // indirect + github.com/ipfs/go-datastore v0.6.0 // indirect github.com/ipfs/go-ipfs-util v0.0.3 // indirect github.com/ipfs/go-ipld-format v0.6.0 // indirect github.com/ipfs/go-ipld-legacy v0.2.1 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect github.com/ipfs/go-metrics-interface v0.0.1 // indirect - github.com/ipfs/go-peertaskqueue v0.8.1 // indirect - github.com/ipfs/go-unixfsnode v1.8.1 // indirect github.com/ipfs/kubo v0.16.0 // indirect github.com/ipld/go-codec-dagpb v1.6.0 // indirect - github.com/jackpal/go-nat-pmp v1.0.2 // indirect - github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect + github.com/ipld/go-ipld-prime v0.21.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect github.com/jgautheron/goconst v1.5.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect @@ -151,9 +125,7 @@ require ( github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect - github.com/klauspost/compress v1.17.2 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect - github.com/koron/go-ssdp v0.0.4 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.8 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect @@ -162,22 +134,18 @@ require ( github.com/leonklingele/grouper v1.1.1 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect - github.com/libp2p/go-flow-metrics v0.1.0 // indirect + github.com/libp2p/go-libp2p v0.32.1 // indirect github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect github.com/libp2p/go-libp2p-kad-dht v0.24.4 // indirect github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect github.com/libp2p/go-libp2p-record v0.2.0 // indirect github.com/libp2p/go-libp2p-routing-helpers v0.7.3 // indirect github.com/libp2p/go-msgio v0.3.0 // indirect - github.com/libp2p/go-nat v0.2.0 // indirect github.com/libp2p/go-netroute v0.2.1 // indirect - github.com/libp2p/go-reuseport v0.4.0 // indirect - github.com/libp2p/go-yamux/v4 v4.0.1 // indirect github.com/lufeee/execinquery v1.2.1 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/maratori/testableexamples v1.0.0 // indirect github.com/maratori/testpackage v1.1.1 // indirect - github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -186,8 +154,6 @@ require ( github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.2 // indirect github.com/miekg/dns v1.1.56 // indirect - github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect - github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -196,7 +162,6 @@ require ( github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect - github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect github.com/multiformats/go-multicodec v0.9.0 // indirect github.com/multiformats/go-multistream v0.5.0 // indirect @@ -207,10 +172,8 @@ require ( github.com/nishanths/predeclared v0.2.2 // indirect github.com/nunnatsa/ginkgolinter v0.13.3 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/onsi/ginkgo/v2 v2.13.0 // indirect - github.com/opencontainers/runtime-spec v1.1.0 // indirect + github.com/onsi/gomega v1.27.10 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect - github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -225,11 +188,6 @@ require ( github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/quic-go/qpack v0.4.0 // indirect - github.com/quic-go/qtls-go1-20 v0.3.4 // indirect - github.com/quic-go/quic-go v0.39.3 // indirect - github.com/quic-go/webtransport-go v0.6.0 // indirect - github.com/raulk/go-watchdog v1.3.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect @@ -279,10 +237,6 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect go.tmz.dev/musttag v0.7.1 // indirect - go.uber.org/atomic v1.11.0 // indirect - go.uber.org/dig v1.17.1 // indirect - go.uber.org/fx v1.20.1 // indirect - go.uber.org/mock v0.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/crypto v0.14.0 // indirect diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index 8c901272223..b1f18cd5fe9 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -3,9 +3,7 @@ 4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= 4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgoo= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= @@ -41,12 +39,7 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= github.com/4meepo/tagalign v1.3.2 h1:1idD3yxlRGV18VjqtDbqYvQ5pXqQS0wO2dn6M3XstvI= github.com/4meepo/tagalign v1.3.2/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= github.com/Abirdcfly/dupword v0.0.12 h1:56NnOyrXzChj07BDFjeRA+IUzSz01jmzEq+G4kEgFhc= @@ -74,23 +67,18 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= -github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alexkohler/nakedret/v2 v2.0.2 h1:qnXuZNvv3/AxkAb22q/sEsEpcA99YxLFACDtEw9TPxE= github.com/alexkohler/nakedret/v2 v2.0.2/go.mod h1:2b8Gkk0GsOrqQv/gPWjNLDSKwG8I5moSXG1K4VIBcTQ= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8gerOIVIY= github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= -github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -101,12 +89,10 @@ github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= github.com/bombsimon/wsl/v3 v3.4.0/go.mod h1:KkIB+TXkqy6MvK9BDZVbZxKNYsE1/oLRJbIFtf14qqo= -github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/breml/bidichk v0.2.4 h1:i3yedFWWQ7YzjdZJHnPo9d/xURinSq3OM+gyM43K4/8= github.com/breml/bidichk v0.2.4/go.mod h1:7Zk0kRFt1LIZxtQdl9W9JwGAcLTTkOs+tN7wuEYGJ3s= github.com/breml/errchkjson v0.3.1 h1:hlIeXuspTyt8Y/UmP5qy1JocGNR00KQHgfaNtRAjoxQ= github.com/breml/errchkjson v0.3.1/go.mod h1:XroxrzKjdiutFyW3nWhw34VGg7kiMsDQox73yWCGI2U= -github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/butuzov/ireturn v0.2.0 h1:kCHi+YzC150GE98WFuZQu9yrTn6GEydO2AuPLbTgnO4= github.com/butuzov/ireturn v0.2.0/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= @@ -123,23 +109,15 @@ github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8/go.mod h1:gakxgyXa github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= -github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg= github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= @@ -149,21 +127,15 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= -github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= -github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/elastic/gosigar v0.12.0/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4= -github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -183,22 +155,16 @@ github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4 github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ= -github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= -github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-critic/go-critic v0.9.0 h1:Pmys9qvU3pSML/3GEQ2Xd9RZ/ip+aXHKILuxczKGV/U= github.com/go-critic/go-critic v0.9.0/go.mod h1:5P8tdXL7m/6qnyG6oRAlYLORvoXH0WDypYgAEmagT40= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -215,7 +181,6 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= @@ -238,14 +203,10 @@ github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6C github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= -github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -253,7 +214,6 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -316,8 +276,6 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= @@ -335,14 +293,10 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= -github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= @@ -351,7 +305,6 @@ github.com/gopherjs/gopherjs v0.0.0-20190430165422-3e4dfb77656c h1:7lF+Vz0LqiRid github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 h1:mrEEilTAUmaAORhssPPkxj84TsHrPMLBGW2Z4SoTxm8= github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= @@ -363,12 +316,8 @@ github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3 github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/gxed/go-shellwords v1.0.3 h1:2TP32H4TAklZUdz84oj95BJhVnIrRasyx2j1cqH5K38= github.com/gxed/go-shellwords v1.0.3/go.mod h1:N7paucT91ByIjmVJHhvoarjoQnmsi3Jd3vH7VqgtMxQ= -github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e h1:3YKHER4nmd7b5qy5t0GWDTwSn4OyRgfAXSmo6VnryBY= -github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e/go.mod h1:I8h3MITA53gN9OnWGCgaMa0JWVRdXthWw4M3CPM54OY= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -389,7 +338,6 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= -github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -398,84 +346,52 @@ 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.15.0 h1:BriLydj2nlK1nKeJQHxcKSuG5ZXcoutzhBklOtxC5pk= github.com/ipfs/boxo v0.15.0/go.mod h1:X5ulcbR5Nh7sm3Db8+08AApUo6FsGC5mb23QDKAoB/M= -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.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs= github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM= -github.com/ipfs/go-blockservice v0.5.0 h1:B2mwhhhVQl2ntW2EIpaWPwSCxSuqr5fFA93Ms4bYLEY= -github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/ipfs/go-cidutil v0.1.0 h1:RW5hO7Vcf16dplUU60Hs0AKDkQAVPVplr7lk97CFL+Q= github.com/ipfs/go-cidutil v0.1.0/go.mod h1:e7OEVBMIv9JaOxt9zaGEmAoSlXW9jdFZ5lP/0PwcfpA= -github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-graphsync v0.16.0 h1:0BX7whXlV13Y9FZ/jRg+xaGHaGYbtGxGppKD6tncw6k= -github.com/ipfs/go-graphsync v0.16.0/go.mod h1:WfbMW3hhmX5GQEQ+KJxsFzVJVBKgC5szfrYK7Zc7xIM= -github.com/ipfs/go-ipfs-blockstore v1.3.0 h1:m2EXaWgwTzAfsmt5UdJ7Is6l4gJcaM/A12XwJyvYvMM= -github.com/ipfs/go-ipfs-blockstore v1.3.0/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= -github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8= -github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw= github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ= -github.com/ipfs/go-ipfs-ds-help v1.1.0 h1:yLE2w9RAsl31LtfMt91tRZcrx+e61O5mDxFRR994w4Q= -github.com/ipfs/go-ipfs-ds-help v1.1.0/go.mod h1:YR5+6EaebOhfcqVCyqemItCLthrpVNot+rsOU/5IatU= -github.com/ipfs/go-ipfs-exchange-interface v0.2.0 h1:8lMSJmKogZYNo2jjhUs0izT+dck05pqUw4mWNW9Pw6Y= -github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA= -github.com/ipfs/go-ipfs-files v0.2.0 h1:z6MCYHQSZpDWpUSK59Kf0ajP1fi4gLCf6fIulVsp8A8= -github.com/ipfs/go-ipfs-files v0.2.0/go.mod h1:vT7uaQfIsprKktzbTPLnIsd+NGw9ZbYwSq0g3N74u0M= -github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs= github.com/ipfs/go-ipfs-pq v0.0.3 h1:YpoHVJB+jzK15mr/xsWC574tyDLkezVrDNeaalQBsTE= -github.com/ipfs/go-ipfs-pq v0.0.3/go.mod h1:btNw5hsHBpRcSSgZtiNm/SLj5gYIZ18AKtv3kERkRb4= github.com/ipfs/go-ipfs-util v0.0.3 h1:2RFdGez6bu2ZlZdI+rWfIdbQb1KudQp3VGwPtdNCmE0= github.com/ipfs/go-ipfs-util v0.0.3/go.mod h1:LHzG1a0Ig4G+iZ26UUOMjHd+lfM84LZCrn17xAKWBvs= -github.com/ipfs/go-ipld-cbor v0.0.6 h1:pYuWHyvSpIsOOLw4Jy7NbBkCyzLDcl64Bf/LZW7eBQ0= github.com/ipfs/go-ipld-format v0.6.0 h1:VEJlA2kQ3LqFSIm5Vu6eIlSxD/Ze90xtc4Meten1F5U= github.com/ipfs/go-ipld-format v0.6.0/go.mod h1:g4QVMTn3marU3qXchwjpKPKgJv+zF+OlaKMyhJ4LHPg= github.com/ipfs/go-ipld-legacy v0.2.1 h1:mDFtrBpmU7b//LzLSypVrXsD8QxkEWxu5qVxN99/+tk= github.com/ipfs/go-ipld-legacy v0.2.1/go.mod h1:782MOUghNzMO2DER0FlBR94mllfdCJCkTtDtPM51otM= -github.com/ipfs/go-libipfs v0.7.0 h1:Mi54WJTODaOL2/ZSm5loi3SwI3jI2OuFWUrQIkJ5cpM= github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8= github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo= github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g= github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= -github.com/ipfs/go-merkledag v0.11.0 h1:DgzwK5hprESOzS4O1t/wi6JDpyVQdvm9Bs59N/jqfBY= github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg= github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY= github.com/ipfs/go-peertaskqueue v0.8.1 h1:YhxAs1+wxb5jk7RvS0LHdyiILpNmRIRnZVztekOF0pg= -github.com/ipfs/go-peertaskqueue v0.8.1/go.mod h1:Oxxd3eaK279FxeydSPPVGHzbwVeHjatZ2GA8XD+KbPU= -github.com/ipfs/go-unixfs v0.4.5 h1:wj8JhxvV1G6CD7swACwSKYa+NgtdWC1RUit+gFnymDU= -github.com/ipfs/go-unixfsnode v1.8.1 h1:nEWQl2XL+Zoyh6u0OMzNI8mUeCKLyRgg65WDbTm/oNU= -github.com/ipfs/go-unixfsnode v1.8.1/go.mod h1:HxRu9HYHOjK6HUqFBAi++7DVoWAHn0o4v/nZ/VA+0g8= -github.com/ipfs/go-verifcid v0.0.2 h1:XPnUv0XmdH+ZIhLGKg6U2vaPaRDXb9urMyNVCE7uvTs= github.com/ipfs/hang-fds v0.1.0 h1:deBiFlWHsVGzJ0ZMaqscEqRM1r2O1rFZ59UiQXb1Xko= github.com/ipfs/hang-fds v0.1.0/go.mod h1:29VLWOn3ftAgNNgXg/al7b11UzuQ+w7AwtCGcTaWkbM= github.com/ipfs/iptb v1.4.0 h1:YFYTrCkLMRwk/35IMyC6+yjoQSHTEcNcefBStLJzgvo= github.com/ipfs/iptb v1.4.0/go.mod h1:1rzHpCYtNp87/+hTxG5TfCVn/yMY3dKnLn8tBiMfdmg= github.com/ipfs/iptb-plugins v0.5.0 h1:zEMLlWAb531mLpD36KFy/yc0egT6FkBEHQtdERexNao= github.com/ipfs/iptb-plugins v0.5.0/go.mod h1:/6crDf3s58T70BhZ+m9SyyKpK7VvSDS2Ny4kafxXDp4= -github.com/ipld/go-car v0.5.0 h1:kcCEa3CvYMs0iE5BzD5sV7O2EwMiCIp3uF8tA6APQT8= -github.com/ipld/go-car/v2 v2.10.2-0.20230622090957-499d0c909d33 h1:0OZwzSYWIuiKEOXd/2vm5cMcEmmGLFn+1h6lHELCm3s= github.com/ipld/go-codec-dagpb v1.6.0 h1:9nYazfyu9B1p3NAgfVdpRco3Fs2nFC72DqVsMj6rOcc= github.com/ipld/go-codec-dagpb v1.6.0/go.mod h1:ANzFhfP2uMJxRBr8CE+WQWs5UsNa0pYtmKZ+agnUw9s= github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH9C2E= github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= -github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c h1:uUx61FiAa1GI6ZmVd2wf2vULeQZIKG66eybjNXKYCz4= github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c/go.mod h1:sdx1xVM9UuLw1tXnhJWN3piypTUO3vCIHYmG15KE/dU= github.com/jbenet/go-random-files v0.0.0-20190219210431-31b3f20ebded h1:fHCa28iw+qaRWZK4IqrntHxXALD5kKr/ESrpOCRRdrg= github.com/jbenet/go-random-files v0.0.0-20190219210431-31b3f20ebded/go.mod h1:FKvZrl5nnaGnTAMewcq0i7wM5zHD75e0lwlnF8q46uo= github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= -github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o= github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= @@ -498,7 +414,6 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM8= github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= @@ -507,21 +422,16 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= -github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= -github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= @@ -541,7 +451,6 @@ github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QT github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= -github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= github.com/libp2p/go-libp2p v0.32.1 h1:wy1J4kZIZxOaej6NveTWCZmHiJ/kY7GoAqXgqNCnPps= github.com/libp2p/go-libp2p v0.32.1/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= @@ -558,25 +467,19 @@ github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUI github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= github.com/libp2p/go-nat v0.2.0 h1:Tyz+bUFAYqGyJ/ppPPymMGbIgNRH+WqC5QrT5fKrrGk= -github.com/libp2p/go-nat v0.2.0/go.mod h1:3MJr+GRpRkyT65EpVPBstXLvOlAPzUVlG6Pwg9ohLJk= github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9tksU= github.com/libp2p/go-netroute v0.2.1/go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ= github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s= -github.com/libp2p/go-reuseport v0.4.0/go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU= github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ= -github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= -github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= @@ -598,16 +501,11 @@ github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwg github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/revive v1.3.2 h1:Wb8NQKBaALBJ3xrrj4zpwJwqwNA6nDpyJSEQWcCka6U= github.com/mgechev/revive v1.3.2/go.mod h1:UCLtc7o5vg5aXCwdUTU1kEBQ1v+YXPAkYDIDXbrs5I0= -github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= -github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= -github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= -github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= -github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= @@ -623,37 +521,29 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= -github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= -github.com/multiformats/go-multiaddr v0.1.1/go.mod h1:aMKBKNEYmzmDmxfX88/vz+J5IU55txyt0p4aiWVohjo= github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4= github.com/multiformats/go-multiaddr v0.12.0 h1:1QlibTFkoXJuDjjYsMHhE73TnzJQl8FSWatk/0gxGzE= github.com/multiformats/go-multiaddr v0.12.0/go.mod h1:WmZXgObOQOYp9r3cslLlppkrz1FYSHmE834dfz/lWu8= github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A= github.com/multiformats/go-multiaddr-dns v0.3.1/go.mod h1:G/245BRQ6FJGmryJCrOuTdB37AMA5AMOVuO6NY3JwTk= github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= -github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= -github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg= github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k= github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew= -github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf/QGkvOGQAyiE= github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= -github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -662,8 +552,6 @@ github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81 github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= -github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8pzda2l0= github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= @@ -673,17 +561,15 @@ github.com/nunnatsa/ginkgolinter v0.13.3/go.mod h1:aTKXo8WddENYxNEFT+4ZxEgWXqlD9 github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= -github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= -github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= -github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= -github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -691,12 +577,10 @@ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6 github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= -github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= -github.com/petar/GoLLRB v0.0.0-20210522233825-ae3b015fd3e9 h1:1/WtZae0yGtPq+TI6+Tv1WTxkukpXeMlviSxvL7SRgk= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -708,7 +592,6 @@ github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4 github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw= github.com/polyfloyd/go-errorlint v1.4.3 h1:P6NALOLV8BrWhm6PsqOraUK05E5h8IZnpXYJ+CIg+0U= github.com/polyfloyd/go-errorlint v1.4.3/go.mod h1:VPlWPh6hB/wruVG803SuNpLuTGNjLHYlvcdSy4RhdPA= -github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -722,14 +605,12 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= @@ -746,18 +627,12 @@ github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:r github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= -github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= -github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= github.com/quic-go/quic-go v0.39.3 h1:o3YB6t2SR+HU/pgwF29kJ6g4jJIJEwEZ8CKia1h1TKg= -github.com/quic-go/quic-go v0.39.3/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= -github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= -github.com/raulk/go-watchdog v1.3.0/go.mod h1:fIvOnLbF0b0ZwkB9YU4mOW9Did//4vPZtDqv66NfsMU= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -773,37 +648,15 @@ github.com/sashamelentyev/usestdlibvars v1.23.0 h1:01h+/2Kd+NblNItNeux0veSL5cBF1 github.com/sashamelentyev/usestdlibvars v1.23.0/go.mod h1:YPwr/Y1LATzHI93CqoPUN/2BzGQ/6N/cl/KwgR0B/aU= github.com/securego/gosec/v2 v2.16.0 h1:Pi0JKoasQQ3NnoRao/ww/N/XdynIB9NRYYZT5CyOs5U= github.com/securego/gosec/v2 v2.16.0/go.mod h1:xvLcVZqUfo4aAQu56TNv7/Ltz6emAOQAEsrZrt7uGlI= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= @@ -818,10 +671,8 @@ github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hg github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= @@ -851,7 +702,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -863,7 +713,6 @@ github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -885,21 +734,15 @@ github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqD github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.10 h1:p8Fspmz3iTctJstry1PYS3HVdllxnEzTEsgIgtxTrCk= github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/uudashr/gocognit v1.0.7 h1:e9aFXgKgUJrQ5+bs61zBigmj7bFJ/5cC6HmMahVzuDo= github.com/uudashr/gocognit v1.0.7/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= -github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= -github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/warpfork/go-testmark v0.12.1 h1:rMgCpJfwy1sJ50x0M0NgyphxYYPMOODIJHhsXyEHU0s= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc h1:BCPnHtcboadS0DvysUuJXZ4lWVv5Bh5i7+tbIyi+ck4= github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc/go.mod h1:r45hJU7yEoA81k6MWNhpMj/kms0n14dkzkxYHoB96UM= -github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 h1:5HZfQkwe0mIfyDmc1Em5GqlNRzcdtlv4HTNmdpt7XH0= -github.com/whyrusleeping/cbor-gen v0.0.0-20230126041949-52956bd4c9aa h1:EyA027ZAkuaCLoxVX4r1TZMPy1d31fM6hbfQ4OU4I5o= -github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc= github.com/xen0n/gosmopolitan v1.2.1 h1:3pttnTuFumELBRSh+KQs1zcz4fN6Zy7aB0xlnQSn1Iw= @@ -920,7 +763,6 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t gitlab.com/bosi/decorder v0.4.0 h1:HWuxAhSxIvsITcXeP+iIRg9d1cVfvVkmlF7M68GaoDY= gitlab.com/bosi/decorder v0.4.0/go.mod h1:xarnteyUoJiOTEldDysquWKTVDCKo2TOIOIibSuWqOg= go-simpler.org/assert v0.5.0 h1:+5L/lajuQtzmbtEfh69sr5cRf2/xZzyJhFjoOz/PPqs= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -933,23 +775,17 @@ go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= go.tmz.dev/musttag v0.7.1 h1:9lFmeSFnFfPuMq4IksHGomItE6NgKMNW2Nt2FPOhCfU= go.tmz.dev/musttag v0.7.1/go.mod h1:oJLkpR56EsIryktZJk/B0IroSMi37YWver47fibGh5U= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.17.1 h1:Tga8Lz8PcYNsWsyHMZ1Vm0OQOUaJNDyvPImgbAu9YSc= -go.uber.org/dig v1.17.1/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/fx v1.20.1 h1:zVwVQGS8zYvhh9Xxcu4w1M6ESyeMzebzj2NbSayZ4Mk= -go.uber.org/fx v1.20.1/go.mod h1:iSYNbHf2y55acNCwCXKx7LbWb5WG1Bnue5RDXz1OREg= go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= -go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -959,19 +795,13 @@ go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -996,7 +826,6 @@ golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCm golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1030,13 +859,10 @@ golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -1064,7 +890,6 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1077,8 +902,6 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1088,7 +911,6 @@ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1104,15 +926,12 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1121,13 +940,11 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1138,7 +955,6 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1195,14 +1011,10 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -1282,12 +1094,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1308,8 +1116,6 @@ google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= @@ -1317,10 +1123,6 @@ google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCID google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20190306203927-b5d61aea6440/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1356,9 +1158,6 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1395,11 +1194,9 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -1419,8 +1216,6 @@ gotest.tools/gotestsum v0.4.2 h1:QOdtb6bnnPUuHKkR9+/QQa8e6qjpTTP7cDi7G9/10C4= gotest.tools/gotestsum v0.4.2/go.mod h1:a32lmn/7xfm0+QHj8K5NyQY1NNNNhZoAp+/OHkLs77Y= gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1443,5 +1238,3 @@ mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RF rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/test/dependencies/graphsync-get/graphsync-get.go b/test/dependencies/graphsync-get/graphsync-get.go deleted file mode 100644 index 9e59379ec05..00000000000 --- a/test/dependencies/graphsync-get/graphsync-get.go +++ /dev/null @@ -1,128 +0,0 @@ -package main - -import ( - "context" - "fmt" - "io" - "log" - "os" - - "github.com/ipfs/boxo/blockservice" - blockstore "github.com/ipfs/boxo/blockstore" - offline "github.com/ipfs/boxo/exchange/offline" - "github.com/ipfs/boxo/ipld/merkledag" - uio "github.com/ipfs/boxo/ipld/unixfs/io" - "github.com/ipfs/go-cid" - "github.com/ipfs/go-datastore" - dssync "github.com/ipfs/go-datastore/sync" - graphsync "github.com/ipfs/go-graphsync" - gsimpl "github.com/ipfs/go-graphsync/impl" - "github.com/ipfs/go-graphsync/network" - "github.com/ipfs/go-graphsync/storeutil" - "github.com/ipld/go-ipld-prime" - cidlink "github.com/ipld/go-ipld-prime/linking/cid" - basicnode "github.com/ipld/go-ipld-prime/node/basicnode" - ipldselector "github.com/ipld/go-ipld-prime/traversal/selector" - "github.com/ipld/go-ipld-prime/traversal/selector/builder" - "github.com/libp2p/go-libp2p" - "github.com/libp2p/go-libp2p/core/host" - "github.com/libp2p/go-libp2p/core/peer" - "github.com/multiformats/go-multiaddr" -) - -func newGraphsync(ctx context.Context, p2p host.Host, bs blockstore.Blockstore) (graphsync.GraphExchange, error) { - network := network.NewFromLibp2pHost(p2p) - return gsimpl.New(ctx, - network, - storeutil.LinkSystemForBlockstore(bs), - ), nil -} - -var selectAll ipld.Node = func() ipld.Node { - ssb := builder.NewSelectorSpecBuilder(basicnode.Prototype.Any) - return ssb.ExploreRecursive( - ipldselector.RecursionLimitDepth(100), // default max - ssb.ExploreAll(ssb.ExploreRecursiveEdge()), - ).Node() -}() - -func fetch(ctx context.Context, gs graphsync.GraphExchange, p peer.ID, c cid.Cid) error { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - resps, errs := gs.Request(ctx, p, cidlink.Link{Cid: c}, selectAll) - for { - select { - case <-ctx.Done(): - return ctx.Err() - case _, ok := <-resps: - if !ok { - resps = nil - } - case err, ok := <-errs: - if !ok { - // done. - return nil - } - if err != nil { - return fmt.Errorf("got an unexpected error: %s", err) - } - } - } -} - -func main() { - if len(os.Args) != 3 { - log.Fatalf("expected a multiaddr and a CID, got %d args", len(os.Args)-1) - } - addr, err := multiaddr.NewMultiaddr(os.Args[1]) - if err != nil { - log.Fatalf("failed to multiaddr '%q': %s", os.Args[1], err) - } - ai, err := peer.AddrInfoFromP2pAddr(addr) - if err != nil { - log.Fatal(err) - } - - target, err := cid.Decode(os.Args[2]) - if err != nil { - log.Fatalf("failed to decode CID '%q': %s", os.Args[2], err) - } - - p2p, err := libp2p.New(libp2p.NoListenAddrs) - if err != nil { - log.Fatal(err) - } - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - err = p2p.Connect(ctx, *ai) - if err != nil { - log.Fatal(err) - } - - bs := blockstore.NewBlockstore(dssync.MutexWrap(datastore.NewMapDatastore())) - gs, err := newGraphsync(ctx, p2p, bs) - if err != nil { - log.Fatal("failed to start", err) - } - err = fetch(ctx, gs, ai.ID, target) - if err != nil { - log.Fatal(err) - } - - dag := merkledag.NewDAGService(blockservice.New(bs, offline.Exchange(bs))) - root, err := dag.Get(ctx, target) - if err != nil { - log.Fatal(err) - } - reader, err := uio.NewDagReader(ctx, root, dag) - if err != nil { - log.Fatal(err) - } - _, err = io.Copy(os.Stdout, reader) - if err != nil { - log.Fatal(err) - } -} diff --git a/test/sharness/Rules.mk b/test/sharness/Rules.mk index 0dcd8d2e4ae..c1e70eb0925 100644 --- a/test/sharness/Rules.mk +++ b/test/sharness/Rules.mk @@ -7,7 +7,7 @@ T_$(d) = $(sort $(wildcard $(d)/t[0-9][0-9][0-9][0-9]-*.sh)) DEPS_$(d) := test/bin/random test/bin/multihash test/bin/pollEndpoint \ test/bin/iptb test/bin/go-sleep test/bin/random-files \ test/bin/go-timeout test/bin/hang-fds test/bin/ma-pipe-unidir \ - test/bin/cid-fmt test/bin/graphsync-get + test/bin/cid-fmt DEPS_$(d) += cmd/ipfs/ipfs DEPS_$(d) += $(d)/clean-test-results DEPS_$(d) += $(SHARNESS_$(d)) diff --git a/test/sharness/t0221-graphsync.sh b/test/sharness/t0221-graphsync.sh deleted file mode 100755 index 771ff4f8c89..00000000000 --- a/test/sharness/t0221-graphsync.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -test_description="Test fetching from graphsync." - -# imports -. lib/test-lib.sh - -test_init_ipfs - -test_expect_success 'configuring ipfs' ' - ipfs config --json Experimental.GraphsyncEnabled true -' - -test_expect_success 'add content' ' - HASH=$(random 1000000 | ipfs add -q) -' - -test_launch_ipfs_daemon - -test_expect_success 'get addrs' ' - ADDR="$(ipfs id --format="" | head -1)" -' - -test_expect_success 'fetch' ' - graphsync-get "$ADDR" "$HASH" > result -' - -test_expect_success 'check' ' - ipfs add -q < result > hash_actual && - echo "$HASH" > hash_expected && - test_cmp hash_expected hash_actual -' - -test_kill_ipfs_daemon -test_done From 6a51849c299dd991eb566cab42da0f7e15817d3c Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 22 Aug 2023 14:21:20 +0200 Subject: [PATCH 274/286] libp2p: remove mplex Fixes: #10069 --- core/node/libp2p/internal/mplex/conn.go | 49 -------------- core/node/libp2p/internal/mplex/stream.go | 65 ------------------- core/node/libp2p/internal/mplex/transport.go | 29 --------- .../libp2p/internal/mplex/transport_test.go | 53 --------------- core/node/libp2p/smux.go | 44 +++---------- docs/changelogs/v0.25.md | 11 ++++ docs/config.md | 17 +---- docs/examples/kubo-as-a-library/go.mod | 1 - docs/examples/kubo-as-a-library/go.sum | 2 - go.mod | 1 - go.sum | 2 - test/cli/transports_test.go | 14 ---- 12 files changed, 23 insertions(+), 265 deletions(-) delete mode 100644 core/node/libp2p/internal/mplex/conn.go delete mode 100644 core/node/libp2p/internal/mplex/stream.go delete mode 100644 core/node/libp2p/internal/mplex/transport.go delete mode 100644 core/node/libp2p/internal/mplex/transport_test.go diff --git a/core/node/libp2p/internal/mplex/conn.go b/core/node/libp2p/internal/mplex/conn.go deleted file mode 100644 index 4a6ca87c389..00000000000 --- a/core/node/libp2p/internal/mplex/conn.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code copied from https://github.com/libp2p/go-libp2p/blob/9bd85029550a084fca63ec6ff9184122cdf06591/p2p/muxer/mplex/conn.go -package mplex - -import ( - "context" - - "github.com/libp2p/go-libp2p/core/network" - - mp "github.com/libp2p/go-mplex" -) - -type conn mp.Multiplex - -var _ network.MuxedConn = &conn{} - -// NewMuxedConn constructs a new Conn from a *mp.Multiplex. -func NewMuxedConn(m *mp.Multiplex) network.MuxedConn { - return (*conn)(m) -} - -func (c *conn) Close() error { - return c.mplex().Close() -} - -func (c *conn) IsClosed() bool { - return c.mplex().IsClosed() -} - -// OpenStream creates a new stream. -func (c *conn) OpenStream(ctx context.Context) (network.MuxedStream, error) { - s, err := c.mplex().NewStream(ctx) - if err != nil { - return nil, err - } - return (*stream)(s), nil -} - -// AcceptStream accepts a stream opened by the other side. -func (c *conn) AcceptStream() (network.MuxedStream, error) { - s, err := c.mplex().Accept() - if err != nil { - return nil, err - } - return (*stream)(s), nil -} - -func (c *conn) mplex() *mp.Multiplex { - return (*mp.Multiplex)(c) -} diff --git a/core/node/libp2p/internal/mplex/stream.go b/core/node/libp2p/internal/mplex/stream.go deleted file mode 100644 index 34d9cfb14af..00000000000 --- a/core/node/libp2p/internal/mplex/stream.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code copied from https://github.com/libp2p/go-libp2p/blob/9bd85029550a084fca63ec6ff9184122cdf06591/p2p/muxer/mplex/stream.go -package mplex - -import ( - "time" - - "github.com/libp2p/go-libp2p/core/network" - - mp "github.com/libp2p/go-mplex" -) - -// stream implements network.MuxedStream over mplex.Stream. -type stream mp.Stream - -var _ network.MuxedStream = &stream{} - -func (s *stream) Read(b []byte) (n int, err error) { - n, err = s.mplex().Read(b) - if err == mp.ErrStreamReset { - err = network.ErrReset - } - - return n, err -} - -func (s *stream) Write(b []byte) (n int, err error) { - n, err = s.mplex().Write(b) - if err == mp.ErrStreamReset { - err = network.ErrReset - } - - return n, err -} - -func (s *stream) Close() error { - return s.mplex().Close() -} - -func (s *stream) CloseWrite() error { - return s.mplex().CloseWrite() -} - -func (s *stream) CloseRead() error { - return s.mplex().CloseRead() -} - -func (s *stream) Reset() error { - return s.mplex().Reset() -} - -func (s *stream) SetDeadline(t time.Time) error { - return s.mplex().SetDeadline(t) -} - -func (s *stream) SetReadDeadline(t time.Time) error { - return s.mplex().SetReadDeadline(t) -} - -func (s *stream) SetWriteDeadline(t time.Time) error { - return s.mplex().SetWriteDeadline(t) -} - -func (s *stream) mplex() *mp.Stream { - return (*mp.Stream)(s) -} diff --git a/core/node/libp2p/internal/mplex/transport.go b/core/node/libp2p/internal/mplex/transport.go deleted file mode 100644 index e7df384b9de..00000000000 --- a/core/node/libp2p/internal/mplex/transport.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code copied from https://github.com/libp2p/go-libp2p/blob/9bd85029550a084fca63ec6ff9184122cdf06591/p2p/muxer/mplex/transport.go -package mplex - -import ( - "net" - - "github.com/libp2p/go-libp2p/core/network" - - mp "github.com/libp2p/go-mplex" -) - -// DefaultTransport has default settings for Transport -var DefaultTransport = &Transport{} - -const ID = "/mplex/6.7.0" - -var _ network.Multiplexer = &Transport{} - -// Transport implements mux.Multiplexer that constructs -// mplex-backed muxed connections. -type Transport struct{} - -func (t *Transport) NewConn(nc net.Conn, isServer bool, scope network.PeerScope) (network.MuxedConn, error) { - m, err := mp.NewMultiplex(nc, isServer, scope) - if err != nil { - return nil, err - } - return NewMuxedConn(m), nil -} diff --git a/core/node/libp2p/internal/mplex/transport_test.go b/core/node/libp2p/internal/mplex/transport_test.go deleted file mode 100644 index 1e3a1dec9e8..00000000000 --- a/core/node/libp2p/internal/mplex/transport_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code copied from https://github.com/libp2p/go-libp2p/blob/9bd85029550a084fca63ec6ff9184122cdf06591/p2p/muxer/mplex/transport_test.go -package mplex - -import ( - "errors" - "net" - "testing" - - "github.com/libp2p/go-libp2p/core/network" - test "github.com/libp2p/go-libp2p/p2p/muxer/testsuite" -) - -func TestDefaultTransport(t *testing.T) { - test.SubtestAll(t, DefaultTransport) -} - -type memoryScope struct { - network.PeerScope - limit int - reserved int -} - -func (m *memoryScope) ReserveMemory(size int, prio uint8) error { - if m.reserved+size > m.limit { - return errors.New("too much") - } - m.reserved += size - return nil -} - -func (m *memoryScope) ReleaseMemory(size int) { - m.reserved -= size - if m.reserved < 0 { - panic("too much memory released") - } -} - -type memoryLimitedTransport struct { - Transport -} - -func (t *memoryLimitedTransport) NewConn(nc net.Conn, isServer bool, scope network.PeerScope) (network.MuxedConn, error) { - return t.Transport.NewConn(nc, isServer, &memoryScope{ - limit: 3 * 1 << 20, - PeerScope: scope, - }) -} - -func TestDefaultTransportWithMemoryLimit(t *testing.T) { - test.SubtestAll(t, &memoryLimitedTransport{ - Transport: *DefaultTransport, - }) -} diff --git a/core/node/libp2p/smux.go b/core/node/libp2p/smux.go index 0966dfaf256..a276b5ddc16 100644 --- a/core/node/libp2p/smux.go +++ b/core/node/libp2p/smux.go @@ -3,51 +3,25 @@ package libp2p import ( "fmt" "os" - "strings" "github.com/ipfs/kubo/config" - "github.com/ipfs/kubo/core/node/libp2p/internal/mplex" "github.com/libp2p/go-libp2p" "github.com/libp2p/go-libp2p/p2p/muxer/yamux" ) func makeSmuxTransportOption(tptConfig config.Transports) (libp2p.Option, error) { if prefs := os.Getenv("LIBP2P_MUX_PREFS"); prefs != "" { - // Using legacy LIBP2P_MUX_PREFS variable. - log.Error("LIBP2P_MUX_PREFS is now deprecated.") - log.Error("Use the `Swarm.Transports.Multiplexers' config field.") - muxers := strings.Fields(prefs) - enabled := make(map[string]bool, len(muxers)) - - var opts []libp2p.Option - for _, tpt := range muxers { - if enabled[tpt] { - return nil, fmt.Errorf( - "duplicate muxer found in LIBP2P_MUX_PREFS: %s", - tpt, - ) - } - switch tpt { - case yamux.ID: - opts = append(opts, libp2p.Muxer(tpt, yamux.DefaultTransport)) - case mplex.ID: - opts = append(opts, libp2p.Muxer(tpt, mplex.DefaultTransport)) - default: - return nil, fmt.Errorf("unknown muxer: %s", tpt) - } - } - return libp2p.ChainOptions(opts...), nil + return nil, fmt.Errorf("configuring muxers with LIBP2P_MUX_PREFS is no longer supported, use Swarm.Transports.Multiplexers") + } + if tptConfig.Multiplexers.Mplex != 0 { + return nil, fmt.Errorf("Swarm.Transports.Multiplexers.Mplex is no longer supported, remove it from your config, see https://github.com/libp2p/specs/issues/553") } - return prioritizeOptions([]priorityOption{{ - priority: tptConfig.Multiplexers.Yamux, - defaultPriority: 100, - opt: libp2p.Muxer(yamux.ID, yamux.DefaultTransport), - }, { - priority: tptConfig.Multiplexers.Mplex, - defaultPriority: config.Disabled, - opt: libp2p.Muxer(mplex.ID, mplex.DefaultTransport), - }}), nil + if tptConfig.Multiplexers.Yamux < 0 { + return nil, fmt.Errorf("running libp2p with Swarm.Transports.Multiplexers.Yamux disabled is not supported") + } + + return libp2p.Muxer(yamux.ID, yamux.DefaultTransport), nil } func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error) { diff --git a/docs/changelogs/v0.25.md b/docs/changelogs/v0.25.md index 98e2a04f9d4..1e1f05f7151 100644 --- a/docs/changelogs/v0.25.md +++ b/docs/changelogs/v0.25.md @@ -7,6 +7,7 @@ - [Overview](#overview) - [🔦 Highlights](#-highlights) - [RPC `API.Authorizations`](#rpc-apiauthorizations) + - [MPLEX removal](#mplex-removal) - [Graphsync Experiment Removal](#graphsync-experiment-removal) - [📝 Changelog](#-changelog) - [👨‍👩‍👧‍👦 Contributors](#-contributors) @@ -28,6 +29,16 @@ This feature is opt-in. By default, no authorization is set up. For configuration instructions, refer to the [documentation](https://github.com/ipfs/kubo/blob/master/docs/config.md#apiauthorizations). +#### MPLEX Removal + +After deprecating and removing mplex support by default in [v0.23.0](https://github.com/ipfs/kubo/blob/master/docs/changelogs/v0.23.md#mplex-deprecation). + +We now fully removed it. If you still need mplex support to talk with other pieces of software, +please try updating them, and if they don't support yamux or QUIC [talk to us about it](https://github.com/ipfs/kubo/issues/new/choose). + +Mplex is unreliable by design, it will drop data and generete errors when sending data *too fast*, +yamux and QUIC support backpressure, that means if we send data faster than the remote machine can process it, we slows down to match the remote's speed. + #### Graphsync Experiment Removal Currently the Graphsync server is to our knowledge not used diff --git a/docs/config.md b/docs/config.md index 0b33fa3fdcf..df35d2ce87e 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2253,21 +2253,10 @@ Type: `priority` ### `Swarm.Transports.Multiplexers.Mplex` -**DEPRECATED**: See https://github.com/ipfs/kubo/issues/9958 +**REMOVED**: See https://github.com/ipfs/kubo/issues/9958 -Mplex is deprecated, this is because it is unreliable and -randomly drop streams when sending data *too fast*. - -New pieces of code rely on backpressure, that means the stream will dynamically -slow down the sending rate if data is getting backed up. -Backpressure is provided by **Yamux** and **QUIC**. - -If you want to turn it back on make sure to have a higher (lower is better) -priority than `Yamux`, you don't want your Kubo to start defaulting to Mplex. - -Default: `200` - -Type: `priority` +Support for Mplex has been [removed from Kubo and go-libp2p](https://github.com/libp2p/specs/issues/553). +Please remove this option from your config. ## `DNS` diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index d930f99fbf8..7b2e4e1bdd8 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -108,7 +108,6 @@ require ( github.com/libp2p/go-libp2p-record v0.2.0 // indirect github.com/libp2p/go-libp2p-routing-helpers v0.7.3 // indirect github.com/libp2p/go-libp2p-xor v0.1.0 // indirect - github.com/libp2p/go-mplex v0.7.0 // indirect github.com/libp2p/go-msgio v0.3.0 // indirect github.com/libp2p/go-nat v0.2.0 // indirect github.com/libp2p/go-netroute v0.2.1 // indirect diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index 1dc80d22972..a15178ee24e 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -476,8 +476,6 @@ github.com/libp2p/go-libp2p-routing-helpers v0.7.3/go.mod h1:cN4mJAD/7zfPKXBcs9z github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA= github.com/libp2p/go-libp2p-xor v0.1.0/go.mod h1:LSTM5yRnjGZbWNTA/hRwq2gGFrvRIbQJscoIL/u6InY= -github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY= -github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU= github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= diff --git a/go.mod b/go.mod index 6b114c9f75f..6832b4091fe 100644 --- a/go.mod +++ b/go.mod @@ -55,7 +55,6 @@ require ( github.com/libp2p/go-libp2p-record v0.2.0 github.com/libp2p/go-libp2p-routing-helpers v0.7.3 github.com/libp2p/go-libp2p-testing v0.12.0 - github.com/libp2p/go-mplex v0.7.0 github.com/libp2p/go-socket-activation v0.1.0 github.com/mitchellh/go-homedir v1.1.0 github.com/multiformats/go-multiaddr v0.12.0 diff --git a/go.sum b/go.sum index a28c6ab3b03..fbf947edc47 100644 --- a/go.sum +++ b/go.sum @@ -539,8 +539,6 @@ github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUI github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA= github.com/libp2p/go-libp2p-xor v0.1.0/go.mod h1:LSTM5yRnjGZbWNTA/hRwq2gGFrvRIbQJscoIL/u6InY= -github.com/libp2p/go-mplex v0.7.0 h1:BDhFZdlk5tbr0oyFq/xv/NPGfjbnrsDam1EvutpBDbY= -github.com/libp2p/go-mplex v0.7.0/go.mod h1:rW8ThnRcYWft/Jb2jeORBmPd6xuG3dGxWN/W168L9EU= github.com/libp2p/go-msgio v0.0.4/go.mod h1:63lBBgOTDKQL6EWazRMCwXsEeEeK9O2Cd+0+6OOuipQ= github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= diff --git a/test/cli/transports_test.go b/test/cli/transports_test.go index c1642c602cd..a523351816d 100644 --- a/test/cli/transports_test.go +++ b/test/cli/transports_test.go @@ -72,20 +72,6 @@ func TestTransports(t *testing.T) { runTests(nodes) }) - t.Run("tcp with mplex", func(t *testing.T) { - // FIXME(#10069): we don't want this to exists anymore - t.Parallel() - nodes := tcpNodes(t) - nodes.ForEachPar(func(n *harness.Node) { - n.UpdateConfig(func(cfg *config.Config) { - cfg.Swarm.Transports.Multiplexers.Yamux = config.Disabled - cfg.Swarm.Transports.Multiplexers.Mplex = 200 - }) - }) - nodes.StartDaemons().Connect() - runTests(nodes) - }) - t.Run("tcp with NOISE", func(t *testing.T) { t.Parallel() nodes := tcpNodes(t) From 3ae04c536e65954db9e6465346108f97d285c244 Mon Sep 17 00:00:00 2001 From: sukun Date: Wed, 22 Nov 2023 14:53:29 +0530 Subject: [PATCH 275/286] docs: clarify WebRTCDirect cannot reuse the same port as QUIC --- docs/config.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/config.md b/docs/config.md index df35d2ce87e..495e9090682 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2169,9 +2169,9 @@ nodes to connect to other nodes without special configuration, such as TLS certificates. This can be useful for browser nodes that do not yet support [WebTransport](https://blog.libp2p.io/2022-12-19-libp2p-webtransport/). -Enabling this transport allows Kubo node to act on `/udp/4001/webrtc-direct` +Enabling this transport allows Kubo node to act on `/udp/4002/webrtc-direct` listeners defined in `Addresses.Swarm`, `Addresses.Announce` or -`Addresses.AppendAnnounce`. +`Addresses.AppendAnnounce`. At the moment, WebRTC Direct doesn't support listening on the same port as a QUIC or WebTransport listener **NOTE:** at the moment, WebRTC Direct cannot be used to connect to a browser node to a node that is behind a NAT or firewall. From 58c29399cf83d12a1d997ce44ec5ac6a696301dc Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 29 Nov 2023 10:40:50 +0100 Subject: [PATCH 276/286] chore: clean migration --- assets/assets.go | 2 +- client/rpc/api.go | 4 ++-- client/rpc/api_test.go | 4 ++-- client/rpc/block.go | 4 ++-- client/rpc/dag.go | 2 +- client/rpc/dht.go | 2 +- client/rpc/key.go | 4 ++-- client/rpc/name.go | 4 ++-- client/rpc/object.go | 4 ++-- client/rpc/pin.go | 4 ++-- client/rpc/pubsub.go | 4 ++-- client/rpc/routing.go | 2 +- client/rpc/swarm.go | 2 +- client/rpc/unixfs.go | 4 ++-- cmd/ipfs/add_migrations.go | 4 ++-- cmd/ipfs/daemon.go | 2 +- cmd/ipfs/init.go | 2 +- commands/context.go | 4 ++-- config/init.go | 2 +- config/init_test.go | 2 +- core/commands/add.go | 4 ++-- core/commands/block.go | 2 +- core/commands/cat.go | 2 +- core/commands/cmdenv/env.go | 4 ++-- core/commands/cmdutils/utils.go | 2 +- core/commands/dag/export.go | 2 +- core/commands/dag/import.go | 2 +- core/commands/files.go | 2 +- core/commands/keystore.go | 2 +- core/commands/ls.go | 4 ++-- core/commands/name/ipns.go | 2 +- core/commands/name/publish.go | 4 ++-- core/commands/object/object.go | 2 +- core/commands/object/patch.go | 2 +- core/commands/pin/pin.go | 4 ++-- core/commands/pubsub.go | 2 +- core/commands/refs.go | 2 +- core/commands/resolve.go | 2 +- core/commands/routing.go | 4 ++-- core/commands/urlstore.go | 2 +- core/coreapi/block.go | 4 ++-- core/coreapi/coreapi.go | 4 ++-- core/coreapi/dht.go | 4 ++-- core/coreapi/key.go | 4 ++-- core/coreapi/name.go | 4 ++-- core/coreapi/object.go | 4 ++-- core/coreapi/path.go | 2 +- core/coreapi/pin.go | 4 ++-- core/coreapi/pubsub.go | 4 ++-- core/coreapi/routing.go | 4 ++-- core/coreapi/swarm.go | 2 +- core/coreapi/test/api_test.go | 4 ++-- core/coreapi/test/path_test.go | 2 +- core/coreapi/unixfs.go | 4 ++-- core/corehttp/gateway.go | 2 +- core/corehttp/gateway_test.go | 2 +- core/coreiface/block.go | 2 +- core/coreiface/coreapi.go | 2 +- core/coreiface/dht.go | 2 +- core/coreiface/key.go | 2 +- core/coreiface/name.go | 2 +- core/coreiface/object.go | 2 +- core/coreiface/pin.go | 2 +- core/coreiface/pubsub.go | 2 +- core/coreiface/routing.go | 2 +- core/coreiface/tests/api.go | 2 +- core/coreiface/tests/block.go | 4 ++-- core/coreiface/tests/dag.go | 2 +- core/coreiface/tests/dht.go | 4 ++-- core/coreiface/tests/key.go | 4 ++-- core/coreiface/tests/name.go | 4 ++-- core/coreiface/tests/object.go | 4 ++-- core/coreiface/tests/path.go | 2 +- core/coreiface/tests/pin.go | 4 ++-- core/coreiface/tests/pubsub.go | 4 ++-- core/coreiface/tests/routing.go | 4 ++-- core/coreiface/tests/unixfs.go | 4 ++-- core/coreiface/unixfs.go | 2 +- core/coreunix/add.go | 2 +- core/coreunix/add_test.go | 2 +- docs/examples/kubo-as-a-library/go.mod | 2 +- docs/examples/kubo-as-a-library/go.sum | 4 ++-- docs/examples/kubo-as-a-library/main.go | 2 +- fuse/ipns/ipns_unix.go | 4 ++-- go.mod | 4 ++-- go.sum | 4 ++-- plugin/daemon.go | 2 +- repo/fsrepo/migrations/ipfsfetcher/ipfsfetcher.go | 4 ++-- test/dependencies/go.mod | 3 ++- test/dependencies/go.sum | 7 +++++-- 90 files changed, 137 insertions(+), 133 deletions(-) diff --git a/assets/assets.go b/assets/assets.go index bb320b4fd7a..17bfa89413a 100644 --- a/assets/assets.go +++ b/assets/assets.go @@ -8,10 +8,10 @@ import ( "github.com/ipfs/kubo/core" "github.com/ipfs/kubo/core/coreapi" - options "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/path" cid "github.com/ipfs/go-cid" + options "github.com/ipfs/kubo/core/coreiface/options" ) //go:embed init-doc diff --git a/client/rpc/api.go b/client/rpc/api.go index c00f6b598a2..48a80388fd8 100644 --- a/client/rpc/api.go +++ b/client/rpc/api.go @@ -13,12 +13,12 @@ import ( "time" "github.com/blang/semver/v4" - iface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/ipld/merkledag" "github.com/ipfs/go-cid" legacy "github.com/ipfs/go-ipld-legacy" ipfs "github.com/ipfs/kubo" + iface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" dagpb "github.com/ipld/go-codec-dagpb" _ "github.com/ipld/go-ipld-prime/codec/dagcbor" "github.com/ipld/go-ipld-prime/node/basicnode" diff --git a/client/rpc/api_test.go b/client/rpc/api_test.go index e2838cb16c6..25bd26ceea6 100644 --- a/client/rpc/api_test.go +++ b/client/rpc/api_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - iface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/tests" "github.com/ipfs/boxo/path" + iface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/tests" "github.com/ipfs/kubo/test/cli/harness" ma "github.com/multiformats/go-multiaddr" "go.uber.org/multierr" diff --git a/client/rpc/block.go b/client/rpc/block.go index a5882a57e9d..9345a5f1964 100644 --- a/client/rpc/block.go +++ b/client/rpc/block.go @@ -6,10 +6,10 @@ import ( "fmt" "io" - iface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" + iface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" mc "github.com/multiformats/go-multicodec" mh "github.com/multiformats/go-multihash" ) diff --git a/client/rpc/dag.go b/client/rpc/dag.go index 098a959d8f1..63cac8f61ac 100644 --- a/client/rpc/dag.go +++ b/client/rpc/dag.go @@ -6,11 +6,11 @@ import ( "fmt" "io" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" format "github.com/ipfs/go-ipld-format" + "github.com/ipfs/kubo/core/coreiface/options" multicodec "github.com/multiformats/go-multicodec" ) diff --git a/client/rpc/dht.go b/client/rpc/dht.go index 852c189764c..1b2c863980d 100644 --- a/client/rpc/dht.go +++ b/client/rpc/dht.go @@ -4,8 +4,8 @@ import ( "context" "encoding/json" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" + caopts "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/routing" ) diff --git a/client/rpc/key.go b/client/rpc/key.go index 40027aa464e..daddffb2399 100644 --- a/client/rpc/key.go +++ b/client/rpc/key.go @@ -4,10 +4,10 @@ import ( "context" "errors" - iface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/ipns" "github.com/ipfs/boxo/path" + iface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/peer" ) diff --git a/client/rpc/name.go b/client/rpc/name.go index eb01ee3cdf0..023f0cde808 100644 --- a/client/rpc/name.go +++ b/client/rpc/name.go @@ -6,11 +6,11 @@ import ( "fmt" "io" - iface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/ipns" "github.com/ipfs/boxo/namesys" "github.com/ipfs/boxo/path" + iface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" ) type NameAPI HttpApi diff --git a/client/rpc/object.go b/client/rpc/object.go index b8d09752fc5..9e00bfb7711 100644 --- a/client/rpc/object.go +++ b/client/rpc/object.go @@ -6,13 +6,13 @@ import ( "fmt" "io" - iface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/ipld/merkledag" ft "github.com/ipfs/boxo/ipld/unixfs" "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + iface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" ) type ObjectAPI HttpApi diff --git a/client/rpc/pin.go b/client/rpc/pin.go index 486e5115b5b..632d8f08da4 100644 --- a/client/rpc/pin.go +++ b/client/rpc/pin.go @@ -6,10 +6,10 @@ import ( "io" "strings" - iface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" + iface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "github.com/pkg/errors" ) diff --git a/client/rpc/pubsub.go b/client/rpc/pubsub.go index f255da5addf..d12d7a5de21 100644 --- a/client/rpc/pubsub.go +++ b/client/rpc/pubsub.go @@ -6,8 +6,8 @@ import ( "encoding/json" "io" - iface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" + iface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/peer" mbase "github.com/multiformats/go-multibase" ) diff --git a/client/rpc/routing.go b/client/rpc/routing.go index babed15fb2a..2ecf25f8b45 100644 --- a/client/rpc/routing.go +++ b/client/rpc/routing.go @@ -6,7 +6,7 @@ import ( "encoding/base64" "encoding/json" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/routing" ) diff --git a/client/rpc/swarm.go b/client/rpc/swarm.go index 7d257a2d19e..d54d06604e8 100644 --- a/client/rpc/swarm.go +++ b/client/rpc/swarm.go @@ -4,7 +4,7 @@ import ( "context" "time" - iface "github.com/ipfs/boxo/coreiface" + iface "github.com/ipfs/kubo/core/coreiface" "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/protocol" diff --git a/client/rpc/unixfs.go b/client/rpc/unixfs.go index be8ddb22d22..501e8d02511 100644 --- a/client/rpc/unixfs.go +++ b/client/rpc/unixfs.go @@ -7,13 +7,13 @@ import ( "fmt" "io" - iface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" unixfs "github.com/ipfs/boxo/ipld/unixfs" unixfs_pb "github.com/ipfs/boxo/ipld/unixfs/pb" "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" + iface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" mh "github.com/multiformats/go-multihash" ) diff --git a/cmd/ipfs/add_migrations.go b/cmd/ipfs/add_migrations.go index 566158d0f7e..14a98e04c6b 100644 --- a/cmd/ipfs/add_migrations.go +++ b/cmd/ipfs/add_migrations.go @@ -8,12 +8,12 @@ import ( "os" "path/filepath" - coreiface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/path" "github.com/ipfs/kubo/core" "github.com/ipfs/kubo/core/coreapi" + coreiface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/ipfs/kubo/repo/fsrepo/migrations" "github.com/ipfs/kubo/repo/fsrepo/migrations/ipfsfetcher" "github.com/libp2p/go-libp2p/core/peer" diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index 1375d464de3..f46dbdd8cb2 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -15,7 +15,6 @@ import ( multierror "github.com/hashicorp/go-multierror" - options "github.com/ipfs/boxo/coreiface/options" cmds "github.com/ipfs/go-ipfs-cmds" mprome "github.com/ipfs/go-metrics-prometheus" version "github.com/ipfs/kubo" @@ -27,6 +26,7 @@ import ( commands "github.com/ipfs/kubo/core/commands" "github.com/ipfs/kubo/core/coreapi" corehttp "github.com/ipfs/kubo/core/corehttp" + options "github.com/ipfs/kubo/core/coreiface/options" corerepo "github.com/ipfs/kubo/core/corerepo" libp2p "github.com/ipfs/kubo/core/node/libp2p" nodeMount "github.com/ipfs/kubo/fuse/node" diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go index 6d03b12c906..82c622ab5d0 100644 --- a/cmd/ipfs/init.go +++ b/cmd/ipfs/init.go @@ -18,10 +18,10 @@ import ( "github.com/ipfs/kubo/core/commands" fsrepo "github.com/ipfs/kubo/repo/fsrepo" - options "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" cmds "github.com/ipfs/go-ipfs-cmds" config "github.com/ipfs/kubo/config" + options "github.com/ipfs/kubo/core/coreiface/options" ) const ( diff --git a/commands/context.go b/commands/context.go index 855db1afe53..cc95d55f439 100644 --- a/commands/context.go +++ b/commands/context.go @@ -10,11 +10,11 @@ import ( coreapi "github.com/ipfs/kubo/core/coreapi" loader "github.com/ipfs/kubo/plugin/loader" - coreiface "github.com/ipfs/boxo/coreiface" - options "github.com/ipfs/boxo/coreiface/options" cmds "github.com/ipfs/go-ipfs-cmds" logging "github.com/ipfs/go-log" config "github.com/ipfs/kubo/config" + coreiface "github.com/ipfs/kubo/core/coreiface" + options "github.com/ipfs/kubo/core/coreiface/options" ) var log = logging.Logger("command") diff --git a/config/init.go b/config/init.go index f40d373bb1e..e4cb1e95a54 100644 --- a/config/init.go +++ b/config/init.go @@ -7,7 +7,7 @@ import ( "io" "time" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" ) diff --git a/config/init_test.go b/config/init_test.go index 762ad3976ac..8a6888de319 100644 --- a/config/init_test.go +++ b/config/init_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" crypto_pb "github.com/libp2p/go-libp2p/core/crypto/pb" ) diff --git a/core/commands/add.go b/core/commands/add.go index bdde6cb4182..33d79a2eb1f 100644 --- a/core/commands/add.go +++ b/core/commands/add.go @@ -11,13 +11,13 @@ import ( "github.com/ipfs/kubo/core/commands/cmdenv" "github.com/cheggaaa/pb" - coreiface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" mfs "github.com/ipfs/boxo/mfs" "github.com/ipfs/boxo/path" cmds "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" + coreiface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" mh "github.com/multiformats/go-multihash" ) diff --git a/core/commands/block.go b/core/commands/block.go index 103addcafaf..6ceb258f62c 100644 --- a/core/commands/block.go +++ b/core/commands/block.go @@ -11,7 +11,7 @@ import ( cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" "github.com/ipfs/kubo/core/commands/cmdutils" - options "github.com/ipfs/boxo/coreiface/options" + options "github.com/ipfs/kubo/core/coreiface/options" cmds "github.com/ipfs/go-ipfs-cmds" mh "github.com/multiformats/go-multihash" diff --git a/core/commands/cat.go b/core/commands/cat.go index 79e78cc772d..6fa1f71b79d 100644 --- a/core/commands/cat.go +++ b/core/commands/cat.go @@ -10,9 +10,9 @@ import ( "github.com/ipfs/kubo/core/commands/cmdutils" "github.com/cheggaaa/pb" - iface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/files" cmds "github.com/ipfs/go-ipfs-cmds" + iface "github.com/ipfs/kubo/core/coreiface" ) const ( diff --git a/core/commands/cmdenv/env.go b/core/commands/cmdenv/env.go index 69ad2dc74cc..fb538dc1200 100644 --- a/core/commands/cmdenv/env.go +++ b/core/commands/cmdenv/env.go @@ -8,10 +8,10 @@ import ( "github.com/ipfs/kubo/commands" "github.com/ipfs/kubo/core" - coreiface "github.com/ipfs/boxo/coreiface" - options "github.com/ipfs/boxo/coreiface/options" cmds "github.com/ipfs/go-ipfs-cmds" logging "github.com/ipfs/go-log" + coreiface "github.com/ipfs/kubo/core/coreiface" + options "github.com/ipfs/kubo/core/coreiface/options" ) var log = logging.Logger("core/commands/cmdenv") diff --git a/core/commands/cmdutils/utils.go b/core/commands/cmdutils/utils.go index 87ddb9655ed..be295f9e314 100644 --- a/core/commands/cmdutils/utils.go +++ b/core/commands/cmdutils/utils.go @@ -5,9 +5,9 @@ import ( cmds "github.com/ipfs/go-ipfs-cmds" - coreiface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" + coreiface "github.com/ipfs/kubo/core/coreiface" ) const ( diff --git a/core/commands/dag/export.go b/core/commands/dag/export.go index d97718d200e..a729cf75240 100644 --- a/core/commands/dag/export.go +++ b/core/commands/dag/export.go @@ -9,12 +9,12 @@ import ( "time" "github.com/cheggaaa/pb" - iface "github.com/ipfs/boxo/coreiface" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" "github.com/ipfs/kubo/core/commands/cmdenv" "github.com/ipfs/kubo/core/commands/cmdutils" + iface "github.com/ipfs/kubo/core/coreiface" cmds "github.com/ipfs/go-ipfs-cmds" gocar "github.com/ipld/go-car" diff --git a/core/commands/dag/import.go b/core/commands/dag/import.go index 76fa045ff76..d95ff7198a4 100644 --- a/core/commands/dag/import.go +++ b/core/commands/dag/import.go @@ -5,13 +5,13 @@ import ( "fmt" "io" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" cmds "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" ipldlegacy "github.com/ipfs/go-ipld-legacy" + "github.com/ipfs/kubo/core/coreiface/options" gocarv2 "github.com/ipld/go-car/v2" "github.com/ipfs/kubo/core/commands/cmdenv" diff --git a/core/commands/files.go b/core/commands/files.go index 73ce9c8264f..9a7ee639a2c 100644 --- a/core/commands/files.go +++ b/core/commands/files.go @@ -15,7 +15,6 @@ import ( "github.com/ipfs/kubo/core/commands/cmdenv" bservice "github.com/ipfs/boxo/blockservice" - iface "github.com/ipfs/boxo/coreiface" offline "github.com/ipfs/boxo/exchange/offline" dag "github.com/ipfs/boxo/ipld/merkledag" ft "github.com/ipfs/boxo/ipld/unixfs" @@ -26,6 +25,7 @@ import ( cmds "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" logging "github.com/ipfs/go-log" + iface "github.com/ipfs/kubo/core/coreiface" mh "github.com/multiformats/go-multihash" ) diff --git a/core/commands/keystore.go b/core/commands/keystore.go index d68801cad46..2ad2f7dbd03 100644 --- a/core/commands/keystore.go +++ b/core/commands/keystore.go @@ -12,7 +12,6 @@ import ( "strings" "text/tabwriter" - options "github.com/ipfs/boxo/coreiface/options" keystore "github.com/ipfs/boxo/keystore" cmds "github.com/ipfs/go-ipfs-cmds" oldcmds "github.com/ipfs/kubo/commands" @@ -20,6 +19,7 @@ import ( cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" "github.com/ipfs/kubo/core/commands/e" ke "github.com/ipfs/kubo/core/commands/keyencode" + options "github.com/ipfs/kubo/core/coreiface/options" fsrepo "github.com/ipfs/kubo/repo/fsrepo" migrations "github.com/ipfs/kubo/repo/fsrepo/migrations" "github.com/libp2p/go-libp2p/core/crypto" diff --git a/core/commands/ls.go b/core/commands/ls.go index ee360796fb1..6fd53528271 100644 --- a/core/commands/ls.go +++ b/core/commands/ls.go @@ -10,11 +10,11 @@ import ( cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" "github.com/ipfs/kubo/core/commands/cmdutils" - iface "github.com/ipfs/boxo/coreiface" - options "github.com/ipfs/boxo/coreiface/options" unixfs "github.com/ipfs/boxo/ipld/unixfs" unixfs_pb "github.com/ipfs/boxo/ipld/unixfs/pb" cmds "github.com/ipfs/go-ipfs-cmds" + iface "github.com/ipfs/kubo/core/coreiface" + options "github.com/ipfs/kubo/core/coreiface/options" ) // LsLink contains printable data for a single ipld link in ls output diff --git a/core/commands/name/ipns.go b/core/commands/name/ipns.go index e03b9c66bc9..f556baf7c12 100644 --- a/core/commands/name/ipns.go +++ b/core/commands/name/ipns.go @@ -7,12 +7,12 @@ import ( "strings" "time" - options "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/namesys" "github.com/ipfs/boxo/path" cmds "github.com/ipfs/go-ipfs-cmds" logging "github.com/ipfs/go-log" cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" + options "github.com/ipfs/kubo/core/coreiface/options" ) var log = logging.Logger("core/commands/ipns") diff --git a/core/commands/name/publish.go b/core/commands/name/publish.go index 6365470b670..9c8d837cb83 100644 --- a/core/commands/name/publish.go +++ b/core/commands/name/publish.go @@ -9,11 +9,11 @@ import ( cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" "github.com/ipfs/kubo/core/commands/cmdutils" - iface "github.com/ipfs/boxo/coreiface" - options "github.com/ipfs/boxo/coreiface/options" ipns "github.com/ipfs/boxo/ipns" cmds "github.com/ipfs/go-ipfs-cmds" ke "github.com/ipfs/kubo/core/commands/keyencode" + iface "github.com/ipfs/kubo/core/coreiface" + options "github.com/ipfs/kubo/core/coreiface/options" ) var errAllowOffline = errors.New("can't publish while offline: pass `--allow-offline` to override") diff --git a/core/commands/object/object.go b/core/commands/object/object.go index 8024edfe399..5a8577cf295 100644 --- a/core/commands/object/object.go +++ b/core/commands/object/object.go @@ -12,10 +12,10 @@ import ( "github.com/ipfs/kubo/core/commands/cmdutils" humanize "github.com/dustin/go-humanize" - "github.com/ipfs/boxo/coreiface/options" dag "github.com/ipfs/boxo/ipld/merkledag" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + "github.com/ipfs/kubo/core/coreiface/options" ) type Node struct { diff --git a/core/commands/object/patch.go b/core/commands/object/patch.go index 7e440b1af21..7c35151fbe2 100644 --- a/core/commands/object/patch.go +++ b/core/commands/object/patch.go @@ -8,7 +8,7 @@ import ( "github.com/ipfs/kubo/core/commands/cmdenv" "github.com/ipfs/kubo/core/commands/cmdutils" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" ) var ObjectPatchCmd = &cmds.Command{ diff --git a/core/commands/pin/pin.go b/core/commands/pin/pin.go index aa4470d700b..db623a7e6c9 100644 --- a/core/commands/pin/pin.go +++ b/core/commands/pin/pin.go @@ -9,14 +9,14 @@ import ( "time" bserv "github.com/ipfs/boxo/blockservice" - coreiface "github.com/ipfs/boxo/coreiface" - options "github.com/ipfs/boxo/coreiface/options" offline "github.com/ipfs/boxo/exchange/offline" dag "github.com/ipfs/boxo/ipld/merkledag" verifcid "github.com/ipfs/boxo/verifcid" cid "github.com/ipfs/go-cid" cidenc "github.com/ipfs/go-cidutil/cidenc" cmds "github.com/ipfs/go-ipfs-cmds" + coreiface "github.com/ipfs/kubo/core/coreiface" + options "github.com/ipfs/kubo/core/coreiface/options" core "github.com/ipfs/kubo/core" cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" diff --git a/core/commands/pubsub.go b/core/commands/pubsub.go index 1c2e82799a1..8f52881a36e 100644 --- a/core/commands/pubsub.go +++ b/core/commands/pubsub.go @@ -11,8 +11,8 @@ import ( mbase "github.com/multiformats/go-multibase" "github.com/pkg/errors" - options "github.com/ipfs/boxo/coreiface/options" cmds "github.com/ipfs/go-ipfs-cmds" + options "github.com/ipfs/kubo/core/coreiface/options" ) var PubsubCmd = &cmds.Command{ diff --git a/core/commands/refs.go b/core/commands/refs.go index 3c58fe96113..cefd8af9071 100644 --- a/core/commands/refs.go +++ b/core/commands/refs.go @@ -10,12 +10,12 @@ import ( cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" "github.com/ipfs/kubo/core/commands/cmdutils" - iface "github.com/ipfs/boxo/coreiface" merkledag "github.com/ipfs/boxo/ipld/merkledag" cid "github.com/ipfs/go-cid" cidenc "github.com/ipfs/go-cidutil/cidenc" cmds "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" + iface "github.com/ipfs/kubo/core/coreiface" ) var refsEncoderMap = cmds.EncoderMap{ diff --git a/core/commands/resolve.go b/core/commands/resolve.go index 67450f4cb15..d60eb0633bd 100644 --- a/core/commands/resolve.go +++ b/core/commands/resolve.go @@ -13,9 +13,9 @@ import ( "github.com/ipfs/kubo/core/commands/cmdutils" ncmd "github.com/ipfs/kubo/core/commands/name" - options "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" cmds "github.com/ipfs/go-ipfs-cmds" + options "github.com/ipfs/kubo/core/coreiface/options" ) const ( diff --git a/core/commands/routing.go b/core/commands/routing.go index 1f96c4deaad..2442570acb5 100644 --- a/core/commands/routing.go +++ b/core/commands/routing.go @@ -11,13 +11,13 @@ import ( cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" - iface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" dag "github.com/ipfs/boxo/ipld/merkledag" "github.com/ipfs/boxo/ipns" cid "github.com/ipfs/go-cid" cmds "github.com/ipfs/go-ipfs-cmds" ipld "github.com/ipfs/go-ipld-format" + iface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" peer "github.com/libp2p/go-libp2p/core/peer" routing "github.com/libp2p/go-libp2p/core/routing" ) diff --git a/core/commands/urlstore.go b/core/commands/urlstore.go index e5dd1ce4d53..c4ee08c900a 100644 --- a/core/commands/urlstore.go +++ b/core/commands/urlstore.go @@ -8,9 +8,9 @@ import ( filestore "github.com/ipfs/boxo/filestore" cmdenv "github.com/ipfs/kubo/core/commands/cmdenv" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" cmds "github.com/ipfs/go-ipfs-cmds" + "github.com/ipfs/kubo/core/coreiface/options" ) var urlStoreCmd = &cmds.Command{ diff --git a/core/coreapi/block.go b/core/coreapi/block.go index ffbe89c8bf6..0c5597c8dcf 100644 --- a/core/coreapi/block.go +++ b/core/coreapi/block.go @@ -6,12 +6,12 @@ import ( "errors" "io" - coreiface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" pin "github.com/ipfs/boxo/pinning/pinner" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" + coreiface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" diff --git a/core/coreapi/coreapi.go b/core/coreapi/coreapi.go index 81d05b58d49..3efe0377862 100644 --- a/core/coreapi/coreapi.go +++ b/core/coreapi/coreapi.go @@ -17,8 +17,6 @@ import ( bserv "github.com/ipfs/boxo/blockservice" blockstore "github.com/ipfs/boxo/blockstore" - coreiface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" exchange "github.com/ipfs/boxo/exchange" offlinexch "github.com/ipfs/boxo/exchange/offline" "github.com/ipfs/boxo/fetcher" @@ -28,6 +26,8 @@ import ( provider "github.com/ipfs/boxo/provider" offlineroute "github.com/ipfs/boxo/routing/offline" ipld "github.com/ipfs/go-ipld-format" + coreiface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" pubsub "github.com/libp2p/go-libp2p-pubsub" record "github.com/libp2p/go-libp2p-record" ci "github.com/libp2p/go-libp2p/core/crypto" diff --git a/core/coreapi/dht.go b/core/coreapi/dht.go index c960ee0844c..7b5d4eb8461 100644 --- a/core/coreapi/dht.go +++ b/core/coreapi/dht.go @@ -6,13 +6,13 @@ import ( blockservice "github.com/ipfs/boxo/blockservice" blockstore "github.com/ipfs/boxo/blockstore" - coreiface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" offline "github.com/ipfs/boxo/exchange/offline" dag "github.com/ipfs/boxo/ipld/merkledag" "github.com/ipfs/boxo/path" cid "github.com/ipfs/go-cid" cidutil "github.com/ipfs/go-cidutil" + coreiface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "github.com/ipfs/kubo/tracing" peer "github.com/libp2p/go-libp2p/core/peer" routing "github.com/libp2p/go-libp2p/core/routing" diff --git a/core/coreapi/key.go b/core/coreapi/key.go index 4c914ff3d20..e78868067c7 100644 --- a/core/coreapi/key.go +++ b/core/coreapi/key.go @@ -7,10 +7,10 @@ import ( "fmt" "sort" - coreiface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/ipns" "github.com/ipfs/boxo/path" + coreiface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "github.com/ipfs/kubo/tracing" crypto "github.com/libp2p/go-libp2p/core/crypto" peer "github.com/libp2p/go-libp2p/core/peer" diff --git a/core/coreapi/name.go b/core/coreapi/name.go index 4f6c1a3cc1e..3c4145ed501 100644 --- a/core/coreapi/name.go +++ b/core/coreapi/name.go @@ -13,9 +13,9 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" - coreiface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" + coreiface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" ci "github.com/libp2p/go-libp2p/core/crypto" peer "github.com/libp2p/go-libp2p/core/peer" ) diff --git a/core/coreapi/object.go b/core/coreapi/object.go index 3c63372e01d..e8f94b1d5d4 100644 --- a/core/coreapi/object.go +++ b/core/coreapi/object.go @@ -10,8 +10,6 @@ import ( "fmt" "io" - coreiface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" dag "github.com/ipfs/boxo/ipld/merkledag" "github.com/ipfs/boxo/ipld/merkledag/dagutils" ft "github.com/ipfs/boxo/ipld/unixfs" @@ -19,6 +17,8 @@ import ( pin "github.com/ipfs/boxo/pinning/pinner" cid "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + coreiface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" diff --git a/core/coreapi/path.go b/core/coreapi/path.go index 1d8e868e463..1eb1f718171 100644 --- a/core/coreapi/path.go +++ b/core/coreapi/path.go @@ -11,10 +11,10 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" - coreiface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/path" ipfspathresolver "github.com/ipfs/boxo/path/resolver" ipld "github.com/ipfs/go-ipld-format" + coreiface "github.com/ipfs/kubo/core/coreiface" ) // ResolveNode resolves the path `p` using Unixfs resolver, gets and returns the diff --git a/core/coreapi/pin.go b/core/coreapi/pin.go index 7c33b3ee0a7..5cb92a81924 100644 --- a/core/coreapi/pin.go +++ b/core/coreapi/pin.go @@ -5,13 +5,13 @@ import ( "fmt" bserv "github.com/ipfs/boxo/blockservice" - coreiface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" offline "github.com/ipfs/boxo/exchange/offline" "github.com/ipfs/boxo/ipld/merkledag" "github.com/ipfs/boxo/path" pin "github.com/ipfs/boxo/pinning/pinner" "github.com/ipfs/go-cid" + coreiface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" diff --git a/core/coreapi/pubsub.go b/core/coreapi/pubsub.go index 9e180c14943..27c6813fe26 100644 --- a/core/coreapi/pubsub.go +++ b/core/coreapi/pubsub.go @@ -4,8 +4,8 @@ import ( "context" "errors" - coreiface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" + coreiface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" "github.com/ipfs/kubo/tracing" pubsub "github.com/libp2p/go-libp2p-pubsub" peer "github.com/libp2p/go-libp2p/core/peer" diff --git a/core/coreapi/routing.go b/core/coreapi/routing.go index 3b28e0472c1..d784a738d2a 100644 --- a/core/coreapi/routing.go +++ b/core/coreapi/routing.go @@ -5,8 +5,8 @@ import ( "errors" "strings" - coreiface "github.com/ipfs/boxo/coreiface" - caopts "github.com/ipfs/boxo/coreiface/options" + coreiface "github.com/ipfs/kubo/core/coreiface" + caopts "github.com/ipfs/kubo/core/coreiface/options" peer "github.com/libp2p/go-libp2p/core/peer" ) diff --git a/core/coreapi/swarm.go b/core/coreapi/swarm.go index d3b6a0e432e..e5332a217f5 100644 --- a/core/coreapi/swarm.go +++ b/core/coreapi/swarm.go @@ -5,7 +5,7 @@ import ( "sort" "time" - coreiface "github.com/ipfs/boxo/coreiface" + coreiface "github.com/ipfs/kubo/core/coreiface" "github.com/ipfs/kubo/tracing" inet "github.com/libp2p/go-libp2p/core/network" "github.com/libp2p/go-libp2p/core/peer" diff --git a/core/coreapi/test/api_test.go b/core/coreapi/test/api_test.go index d9591f83522..d647a32c87c 100644 --- a/core/coreapi/test/api_test.go +++ b/core/coreapi/test/api_test.go @@ -17,11 +17,11 @@ import ( "github.com/ipfs/kubo/core/node/libp2p" "github.com/ipfs/kubo/repo" - coreiface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/tests" "github.com/ipfs/go-datastore" syncds "github.com/ipfs/go-datastore/sync" "github.com/ipfs/kubo/config" + coreiface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/tests" "github.com/libp2p/go-libp2p/core/crypto" "github.com/libp2p/go-libp2p/core/peer" mocknet "github.com/libp2p/go-libp2p/p2p/net/mock" diff --git a/core/coreapi/test/path_test.go b/core/coreapi/test/path_test.go index 6ba80423d35..692853a9a3f 100644 --- a/core/coreapi/test/path_test.go +++ b/core/coreapi/test/path_test.go @@ -6,11 +6,11 @@ import ( "testing" "time" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/ipld/merkledag" uio "github.com/ipfs/boxo/ipld/unixfs/io" "github.com/ipfs/boxo/path" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/ipld/go-ipld-prime" ) diff --git a/core/coreapi/unixfs.go b/core/coreapi/unixfs.go index a7cac6a00d5..452e6017bc1 100644 --- a/core/coreapi/unixfs.go +++ b/core/coreapi/unixfs.go @@ -14,8 +14,6 @@ import ( blockservice "github.com/ipfs/boxo/blockservice" bstore "github.com/ipfs/boxo/blockstore" - coreiface "github.com/ipfs/boxo/coreiface" - options "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" filestore "github.com/ipfs/boxo/filestore" merkledag "github.com/ipfs/boxo/ipld/merkledag" @@ -28,6 +26,8 @@ import ( cid "github.com/ipfs/go-cid" cidutil "github.com/ipfs/go-cidutil" ipld "github.com/ipfs/go-ipld-format" + coreiface "github.com/ipfs/kubo/core/coreiface" + options "github.com/ipfs/kubo/core/coreiface/options" ) type UnixfsAPI CoreAPI diff --git a/core/corehttp/gateway.go b/core/corehttp/gateway.go index 3e0380d5a3c..a2567d8f0fd 100644 --- a/core/corehttp/gateway.go +++ b/core/corehttp/gateway.go @@ -10,7 +10,6 @@ import ( "time" "github.com/ipfs/boxo/blockservice" - iface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/exchange/offline" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/gateway" @@ -21,6 +20,7 @@ import ( version "github.com/ipfs/kubo" "github.com/ipfs/kubo/config" "github.com/ipfs/kubo/core" + iface "github.com/ipfs/kubo/core/coreiface" "github.com/ipfs/kubo/core/node" "github.com/libp2p/go-libp2p/core/routing" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" diff --git a/core/corehttp/gateway_test.go b/core/corehttp/gateway_test.go index 41a1c582179..c2e0073d921 100644 --- a/core/corehttp/gateway_test.go +++ b/core/corehttp/gateway_test.go @@ -16,11 +16,11 @@ import ( "github.com/ipfs/kubo/repo" "github.com/stretchr/testify/assert" - iface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/path" "github.com/ipfs/go-datastore" syncds "github.com/ipfs/go-datastore/sync" "github.com/ipfs/kubo/config" + iface "github.com/ipfs/kubo/core/coreiface" ci "github.com/libp2p/go-libp2p/core/crypto" ) diff --git a/core/coreiface/block.go b/core/coreiface/block.go index cdd5fcee261..bf518f7fdee 100644 --- a/core/coreiface/block.go +++ b/core/coreiface/block.go @@ -4,8 +4,8 @@ import ( "context" "io" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" + "github.com/ipfs/kubo/core/coreiface/options" ) // BlockStat contains information about a block diff --git a/core/coreiface/coreapi.go b/core/coreiface/coreapi.go index 25e54a37b72..4fd6851af33 100644 --- a/core/coreiface/coreapi.go +++ b/core/coreiface/coreapi.go @@ -5,8 +5,8 @@ package iface import ( "context" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" + "github.com/ipfs/kubo/core/coreiface/options" ipld "github.com/ipfs/go-ipld-format" ) diff --git a/core/coreiface/dht.go b/core/coreiface/dht.go index d9418ebfc9b..a916dbf3d37 100644 --- a/core/coreiface/dht.go +++ b/core/coreiface/dht.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/boxo/path" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/peer" ) diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 4a1cbae80cf..9d61cc95b33 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/boxo/path" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/peer" ) diff --git a/core/coreiface/name.go b/core/coreiface/name.go index f832033ef63..f7c8f634c42 100644 --- a/core/coreiface/name.go +++ b/core/coreiface/name.go @@ -4,9 +4,9 @@ import ( "context" "errors" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/ipns" "github.com/ipfs/boxo/path" + "github.com/ipfs/kubo/core/coreiface/options" ) var ErrResolveFailed = errors.New("could not resolve name") diff --git a/core/coreiface/object.go b/core/coreiface/object.go index 4a73f22ea5d..fa378ac6c46 100644 --- a/core/coreiface/object.go +++ b/core/coreiface/object.go @@ -4,8 +4,8 @@ import ( "context" "io" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" diff --git a/core/coreiface/pin.go b/core/coreiface/pin.go index 057516d08e4..25a775965fb 100644 --- a/core/coreiface/pin.go +++ b/core/coreiface/pin.go @@ -5,7 +5,7 @@ import ( "github.com/ipfs/boxo/path" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" ) // Pin holds information about pinned resource diff --git a/core/coreiface/pubsub.go b/core/coreiface/pubsub.go index bbd1da4ec17..5cf8de54d2c 100644 --- a/core/coreiface/pubsub.go +++ b/core/coreiface/pubsub.go @@ -4,7 +4,7 @@ import ( "context" "io" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/peer" ) diff --git a/core/coreiface/routing.go b/core/coreiface/routing.go index 5099c3de079..c64e7baef9c 100644 --- a/core/coreiface/routing.go +++ b/core/coreiface/routing.go @@ -3,7 +3,7 @@ package iface import ( "context" - "github.com/ipfs/boxo/coreiface/options" + "github.com/ipfs/kubo/core/coreiface/options" ) // RoutingAPI specifies the interface to the routing layer. diff --git a/core/coreiface/tests/api.go b/core/coreiface/tests/api.go index a66e2abeb29..c1fcb672df1 100644 --- a/core/coreiface/tests/api.go +++ b/core/coreiface/tests/api.go @@ -6,7 +6,7 @@ import ( "testing" "time" - coreiface "github.com/ipfs/boxo/coreiface" + coreiface "github.com/ipfs/kubo/core/coreiface" ) var errAPINotImplemented = errors.New("api not implemented") diff --git a/core/coreiface/tests/block.go b/core/coreiface/tests/block.go index 6e254063e18..3b4ca0bc05d 100644 --- a/core/coreiface/tests/block.go +++ b/core/coreiface/tests/block.go @@ -7,10 +7,10 @@ import ( "strings" "testing" - coreiface "github.com/ipfs/boxo/coreiface" - opt "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" ipld "github.com/ipfs/go-ipld-format" + coreiface "github.com/ipfs/kubo/core/coreiface" + opt "github.com/ipfs/kubo/core/coreiface/options" mh "github.com/multiformats/go-multihash" ) diff --git a/core/coreiface/tests/dag.go b/core/coreiface/tests/dag.go index a106788d6a2..3a388c55681 100644 --- a/core/coreiface/tests/dag.go +++ b/core/coreiface/tests/dag.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - coreiface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/path" + coreiface "github.com/ipfs/kubo/core/coreiface" ipldcbor "github.com/ipfs/go-ipld-cbor" ipld "github.com/ipfs/go-ipld-format" diff --git a/core/coreiface/tests/dht.go b/core/coreiface/tests/dht.go index 3b3ac1d61e3..6a908c5d331 100644 --- a/core/coreiface/tests/dht.go +++ b/core/coreiface/tests/dht.go @@ -6,8 +6,8 @@ import ( "testing" "time" - iface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" + iface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" ) func (tp *TestSuite) TestDht(t *testing.T) { diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index 0b755380e2d..c4c86b74859 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -5,9 +5,9 @@ import ( "strings" "testing" - iface "github.com/ipfs/boxo/coreiface" - opt "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/go-cid" + iface "github.com/ipfs/kubo/core/coreiface" + opt "github.com/ipfs/kubo/core/coreiface/options" mbase "github.com/multiformats/go-multibase" ) diff --git a/core/coreiface/tests/name.go b/core/coreiface/tests/name.go index 2b6b7ec49ab..1e739fdd056 100644 --- a/core/coreiface/tests/name.go +++ b/core/coreiface/tests/name.go @@ -7,11 +7,11 @@ import ( "testing" "time" - coreiface "github.com/ipfs/boxo/coreiface" - opt "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/ipns" "github.com/ipfs/boxo/path" + coreiface "github.com/ipfs/kubo/core/coreiface" + opt "github.com/ipfs/kubo/core/coreiface/options" "github.com/stretchr/testify/require" ) diff --git a/core/coreiface/tests/object.go b/core/coreiface/tests/object.go index 5c6ba828c49..9e0463ab690 100644 --- a/core/coreiface/tests/object.go +++ b/core/coreiface/tests/object.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - iface "github.com/ipfs/boxo/coreiface" - opt "github.com/ipfs/boxo/coreiface/options" + iface "github.com/ipfs/kubo/core/coreiface" + opt "github.com/ipfs/kubo/core/coreiface/options" ) func (tp *TestSuite) TestObject(t *testing.T) { diff --git a/core/coreiface/tests/path.go b/core/coreiface/tests/path.go index 116aed2e73d..87dce2c91c0 100644 --- a/core/coreiface/tests/path.go +++ b/core/coreiface/tests/path.go @@ -7,10 +7,10 @@ import ( "strings" "testing" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" ipldcbor "github.com/ipfs/go-ipld-cbor" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/stretchr/testify/require" ) diff --git a/core/coreiface/tests/pin.go b/core/coreiface/tests/pin.go index 49499b36acc..fdd7c15ccbf 100644 --- a/core/coreiface/tests/pin.go +++ b/core/coreiface/tests/pin.go @@ -6,12 +6,12 @@ import ( "strings" "testing" - iface "github.com/ipfs/boxo/coreiface" - opt "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" ipldcbor "github.com/ipfs/go-ipld-cbor" ipld "github.com/ipfs/go-ipld-format" + iface "github.com/ipfs/kubo/core/coreiface" + opt "github.com/ipfs/kubo/core/coreiface/options" ) func (tp *TestSuite) TestPin(t *testing.T) { diff --git a/core/coreiface/tests/pubsub.go b/core/coreiface/tests/pubsub.go index 8cbc6a3ebf4..6ae95f27b0c 100644 --- a/core/coreiface/tests/pubsub.go +++ b/core/coreiface/tests/pubsub.go @@ -5,8 +5,8 @@ import ( "testing" "time" - iface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" + iface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" ) func (tp *TestSuite) TestPubSub(t *testing.T) { diff --git a/core/coreiface/tests/routing.go b/core/coreiface/tests/routing.go index c56e9165984..3f1f95d75c7 100644 --- a/core/coreiface/tests/routing.go +++ b/core/coreiface/tests/routing.go @@ -5,10 +5,10 @@ import ( "testing" "time" - iface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/ipns" "github.com/ipfs/boxo/path" + iface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/stretchr/testify/require" ) diff --git a/core/coreiface/tests/unixfs.go b/core/coreiface/tests/unixfs.go index 31ac1b5c9f4..538f4d8ed7c 100644 --- a/core/coreiface/tests/unixfs.go +++ b/core/coreiface/tests/unixfs.go @@ -14,9 +14,9 @@ import ( "sync" "testing" - coreiface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/path" + coreiface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/ipfs/boxo/files" mdag "github.com/ipfs/boxo/ipld/merkledag" diff --git a/core/coreiface/unixfs.go b/core/coreiface/unixfs.go index 35e108c028a..d0dc4d8ce09 100644 --- a/core/coreiface/unixfs.go +++ b/core/coreiface/unixfs.go @@ -3,10 +3,10 @@ package iface import ( "context" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/path" "github.com/ipfs/go-cid" + "github.com/ipfs/kubo/core/coreiface/options" ) type AddEvent struct { diff --git a/core/coreunix/add.go b/core/coreunix/add.go index 123c9fe652b..83bec6d03b7 100644 --- a/core/coreunix/add.go +++ b/core/coreunix/add.go @@ -10,7 +10,6 @@ import ( bstore "github.com/ipfs/boxo/blockstore" chunker "github.com/ipfs/boxo/chunker" - coreiface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/files" posinfo "github.com/ipfs/boxo/filestore/posinfo" dag "github.com/ipfs/boxo/ipld/merkledag" @@ -24,6 +23,7 @@ import ( "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" logging "github.com/ipfs/go-log" + coreiface "github.com/ipfs/kubo/core/coreiface" "github.com/ipfs/kubo/tracing" ) diff --git a/core/coreunix/add_test.go b/core/coreunix/add_test.go index a09fd5d2bc9..1eb050ee914 100644 --- a/core/coreunix/add_test.go +++ b/core/coreunix/add_test.go @@ -16,7 +16,6 @@ import ( "github.com/ipfs/boxo/blockservice" blockstore "github.com/ipfs/boxo/blockstore" - coreiface "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/files" pi "github.com/ipfs/boxo/filestore/posinfo" dag "github.com/ipfs/boxo/ipld/merkledag" @@ -25,6 +24,7 @@ import ( "github.com/ipfs/go-datastore" syncds "github.com/ipfs/go-datastore/sync" config "github.com/ipfs/kubo/config" + coreiface "github.com/ipfs/kubo/core/coreiface" ) const testPeerID = "QmTFauExutTsy4XP6JbMFcw2Wa9645HJt2bTqL6qYDCKfe" diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index 7b2e4e1bdd8..9a39a46a157 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.20 replace github.com/ipfs/kubo => ./../../.. require ( - github.com/ipfs/boxo v0.15.0 + github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 github.com/ipfs/kubo v0.0.0-00010101000000-000000000000 github.com/libp2p/go-libp2p v0.32.1 github.com/multiformats/go-multiaddr v0.12.0 diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index a15178ee24e..1bcbaf5df70 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -303,8 +303,8 @@ github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c h1:7Uy github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c/go.mod h1:6EekK/jo+TynwSE/ZOiOJd4eEvRXoavEC3vquKtv4yI= 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.15.0 h1:BriLydj2nlK1nKeJQHxcKSuG5ZXcoutzhBklOtxC5pk= -github.com/ipfs/boxo v0.15.0/go.mod h1:X5ulcbR5Nh7sm3Db8+08AApUo6FsGC5mb23QDKAoB/M= +github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 h1:9a7ug9Llglmdbzgj/gdKbPoZrd3EoaartzepObr/jlc= +github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= 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/docs/examples/kubo-as-a-library/main.go b/docs/examples/kubo-as-a-library/main.go index b7764a20651..765e83c6dca 100644 --- a/docs/examples/kubo-as-a-library/main.go +++ b/docs/examples/kubo-as-a-library/main.go @@ -11,9 +11,9 @@ import ( "strings" "sync" - icore "github.com/ipfs/boxo/coreiface" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/path" + icore "github.com/ipfs/kubo/core/coreiface" ma "github.com/multiformats/go-multiaddr" "github.com/ipfs/kubo/config" diff --git a/fuse/ipns/ipns_unix.go b/fuse/ipns/ipns_unix.go index 77cb8b18f78..23704cabd52 100644 --- a/fuse/ipns/ipns_unix.go +++ b/fuse/ipns/ipns_unix.go @@ -20,11 +20,11 @@ import ( fuse "bazil.org/fuse" fs "bazil.org/fuse/fs" - iface "github.com/ipfs/boxo/coreiface" - options "github.com/ipfs/boxo/coreiface/options" mfs "github.com/ipfs/boxo/mfs" cid "github.com/ipfs/go-cid" logging "github.com/ipfs/go-log" + iface "github.com/ipfs/kubo/core/coreiface" + options "github.com/ipfs/kubo/core/coreiface/options" ) func init() { diff --git a/go.mod b/go.mod index 6832b4091fe..d1514137b76 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/ipfs-shipyard/nopfs v0.0.12-0.20231027223058-cde3b5ba964c github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c - github.com/ipfs/boxo v0.15.0 + github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 github.com/ipfs/go-block-format v0.2.0 github.com/ipfs/go-cid v0.4.1 github.com/ipfs/go-cidutil v0.1.0 @@ -29,6 +29,7 @@ require ( github.com/ipfs/go-ds-measure v0.2.0 github.com/ipfs/go-fs-lock v0.0.7 github.com/ipfs/go-ipfs-cmds v0.10.0 + github.com/ipfs/go-ipld-cbor v0.0.6 github.com/ipfs/go-ipld-format v0.6.0 github.com/ipfs/go-ipld-git v0.1.1 github.com/ipfs/go-ipld-legacy v0.2.1 @@ -141,7 +142,6 @@ require ( github.com/ipfs/go-ipfs-pq v0.0.3 // indirect github.com/ipfs/go-ipfs-redirects-file v0.1.1 // indirect github.com/ipfs/go-ipfs-util v0.0.3 // indirect - github.com/ipfs/go-ipld-cbor v0.0.6 // indirect github.com/ipfs/go-merkledag v0.11.0 // indirect github.com/ipfs/go-peertaskqueue v0.8.1 // indirect github.com/ipfs/go-verifcid v0.0.2 // indirect diff --git a/go.sum b/go.sum index fbf947edc47..bb4d9dda710 100644 --- a/go.sum +++ b/go.sum @@ -337,8 +337,8 @@ github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c h1:7Uy github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c/go.mod h1:6EekK/jo+TynwSE/ZOiOJd4eEvRXoavEC3vquKtv4yI= 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.15.0 h1:BriLydj2nlK1nKeJQHxcKSuG5ZXcoutzhBklOtxC5pk= -github.com/ipfs/boxo v0.15.0/go.mod h1:X5ulcbR5Nh7sm3Db8+08AApUo6FsGC5mb23QDKAoB/M= +github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 h1:9a7ug9Llglmdbzgj/gdKbPoZrd3EoaartzepObr/jlc= +github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= 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-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ= diff --git a/plugin/daemon.go b/plugin/daemon.go index 6ea58a9212c..9f75099d6b5 100644 --- a/plugin/daemon.go +++ b/plugin/daemon.go @@ -1,7 +1,7 @@ package plugin import ( - coreiface "github.com/ipfs/boxo/coreiface" + coreiface "github.com/ipfs/kubo/core/coreiface" ) // PluginDaemon is an interface for daemon plugins. These plugins will be run on diff --git a/repo/fsrepo/migrations/ipfsfetcher/ipfsfetcher.go b/repo/fsrepo/migrations/ipfsfetcher/ipfsfetcher.go index cd6a5182ee1..ea020dfcc65 100644 --- a/repo/fsrepo/migrations/ipfsfetcher/ipfsfetcher.go +++ b/repo/fsrepo/migrations/ipfsfetcher/ipfsfetcher.go @@ -11,13 +11,13 @@ import ( "strings" "sync" - iface "github.com/ipfs/boxo/coreiface" - "github.com/ipfs/boxo/coreiface/options" "github.com/ipfs/boxo/files" "github.com/ipfs/boxo/path" "github.com/ipfs/kubo/config" "github.com/ipfs/kubo/core" "github.com/ipfs/kubo/core/coreapi" + iface "github.com/ipfs/kubo/core/coreiface" + "github.com/ipfs/kubo/core/coreiface/options" "github.com/ipfs/kubo/core/node/libp2p" "github.com/ipfs/kubo/repo/fsrepo" "github.com/ipfs/kubo/repo/fsrepo/migrations" diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index 5bfe4383fcc..c27e946f48c 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -104,7 +104,7 @@ require ( github.com/hexops/gotextdiff v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/bbloom v0.0.4 // indirect - github.com/ipfs/boxo v0.15.0 // indirect + github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 // indirect github.com/ipfs/go-block-format v0.2.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect @@ -191,6 +191,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect + github.com/samber/lo v1.36.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index b1f18cd5fe9..918fda6f513 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -344,8 +344,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 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.15.0 h1:BriLydj2nlK1nKeJQHxcKSuG5ZXcoutzhBklOtxC5pk= -github.com/ipfs/boxo v0.15.0/go.mod h1:X5ulcbR5Nh7sm3Db8+08AApUo6FsGC5mb23QDKAoB/M= +github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 h1:9a7ug9Llglmdbzgj/gdKbPoZrd3EoaartzepObr/jlc= +github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs= github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= @@ -640,6 +640,8 @@ github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJ github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= github.com/ryanrolds/sqlclosecheck v0.4.0 h1:i8SX60Rppc1wRuyQjMciLqIzV3xnoHB7/tXbr6RGYNI= github.com/ryanrolds/sqlclosecheck v0.4.0/go.mod h1:TBRRjzL31JONc9i4XMinicuo+s+E8yKZ5FN8X3G6CKQ= +github.com/samber/lo v1.36.0 h1:4LaOxH1mHnbDGhTVE0i1z8v/lWaQW8AIfOD3HU4mSaw= +github.com/samber/lo v1.36.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8= github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= @@ -721,6 +723,7 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpR github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= +github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= From d882642168ed22711c554cdb84012f145b099926 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Sun, 3 Dec 2023 13:48:28 -0800 Subject: [PATCH 277/286] feat: webui v4.2.0 (#10241) https://github.com/ipfs/ipfs-webui/releases/tag/v4.2.0 Co-authored-by: Marcin Rataj --- core/corehttp/webui.go | 3 ++- docs/changelogs/v0.25.md | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/corehttp/webui.go b/core/corehttp/webui.go index 4c8e04723bf..5ec6edf1580 100644 --- a/core/corehttp/webui.go +++ b/core/corehttp/webui.go @@ -1,11 +1,12 @@ package corehttp // TODO: move to IPNS -const WebUIPath = "/ipfs/bafybeiamycmd52xvg6k3nzr6z3n33de6a2teyhquhj4kspdtnvetnkrfim" // v4.1.1 +const WebUIPath = "/ipfs/bafybeidf7cpkwsjkq6xs3r6fbbxghbugilx3jtezbza7gua3k5wjixpmba" // v4.2.0 // WebUIPaths is a list of all past webUI paths. var WebUIPaths = []string{ WebUIPath, + "/ipfs/bafybeiamycmd52xvg6k3nzr6z3n33de6a2teyhquhj4kspdtnvetnkrfim", "/ipfs/bafybeieqdeoqkf7xf4aozd524qncgiloh33qgr25lyzrkusbcre4c3fxay", "/ipfs/bafybeicyp7ssbnj3hdzehcibmapmpuc3atrsc4ch3q6acldfh4ojjdbcxe", "/ipfs/bafybeigs6d53gpgu34553mbi5bbkb26e4ikruoaaar75jpfdywpup2r3my", diff --git a/docs/changelogs/v0.25.md b/docs/changelogs/v0.25.md index 1e1f05f7151..ed8275f2f60 100644 --- a/docs/changelogs/v0.25.md +++ b/docs/changelogs/v0.25.md @@ -6,8 +6,9 @@ - [Overview](#overview) - [🔦 Highlights](#-highlights) + - [WebUI: Updated Peers View](#webui-updated-peers-view) - [RPC `API.Authorizations`](#rpc-apiauthorizations) - - [MPLEX removal](#mplex-removal) + - [MPLEX Removal](#mplex-removal) - [Graphsync Experiment Removal](#graphsync-experiment-removal) - [📝 Changelog](#-changelog) - [👨‍👩‍👧‍👦 Contributors](#-contributors) @@ -16,6 +17,12 @@ ### 🔦 Highlights +#### WebUI: Updated Peers View + +WebUI [v4.2.0](https://github.com/ipfs/ipfs-webui/releases/tag/v4.2.0) shipped +with updated [ipfs-geoip](https://www.npmjs.com/package/ipfs-geoip) dataset +and [ability to filter the peers table](https://github.com/ipfs/ipfs-webui/pull/2181). + #### RPC `API.Authorizations` Kubo RPC API now supports optional HTTP Authorization. From 7b05b5dd33eebd18d0325202d8f2dc312e74dc5a Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Fri, 1 Dec 2023 01:21:36 +0100 Subject: [PATCH 278/286] docs(cli): fix spelling this fixes lint errors in RPC docs that were raised by vole in https://github.com/ipfs/ipfs-docs/pull/1772 so we don't get them in kubo 0.25 --- core/commands/name/ipns.go | 2 +- core/commands/resolve.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/commands/name/ipns.go b/core/commands/name/ipns.go index f556baf7c12..92cbb59a30c 100644 --- a/core/commands/name/ipns.go +++ b/core/commands/name/ipns.go @@ -74,7 +74,7 @@ Resolve the value of a dnslink: cmds.BoolOption(recursiveOptionName, "r", "Resolve until the result is not an IPNS name.").WithDefault(true), cmds.BoolOption(nocacheOptionName, "n", "Do not use cached entries."), cmds.UintOption(dhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution.").WithDefault(uint(namesys.DefaultResolverDhtRecordCount)), - cmds.StringOption(dhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout.").WithDefault(namesys.DefaultResolverDhtTimeout.String()), + cmds.StringOption(dhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution e.g. \"30s\". Pass 0 for no timeout.").WithDefault(namesys.DefaultResolverDhtTimeout.String()), cmds.BoolOption(streamOptionName, "s", "Stream entries as they are found."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { diff --git a/core/commands/resolve.go b/core/commands/resolve.go index d60eb0633bd..b786ed23d25 100644 --- a/core/commands/resolve.go +++ b/core/commands/resolve.go @@ -70,7 +70,7 @@ Resolve the value of an IPFS DAG path: Options: []cmds.Option{ cmds.BoolOption(resolveRecursiveOptionName, "r", "Resolve until the result is an IPFS name.").WithDefault(true), cmds.IntOption(resolveDhtRecordCountOptionName, "dhtrc", "Number of records to request for DHT resolution."), - cmds.StringOption(resolveDhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution eg \"30s\". Pass 0 for no timeout."), + cmds.StringOption(resolveDhtTimeoutOptionName, "dhtt", "Max time to collect values during DHT resolution e.g. \"30s\". Pass 0 for no timeout."), }, Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { api, err := cmdenv.GetApi(env, req) From 8ab2de5ff05e1427a22be868b31efbcd58a6ee13 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 4 Dec 2023 09:51:26 +0100 Subject: [PATCH 279/286] feat: ipfs key sign|verify (#10235) --- client/rpc/key.go | 52 ++++ core/commands/commands_test.go | 2 + core/commands/keystore.go | 136 +++++++++ core/coreapi/key.go | 80 +++++ core/coreiface/key.go | 8 + core/coreiface/tests/key.go | 533 +++++++++++++-------------------- docs/changelogs/v0.25.md | 9 + 7 files changed, 498 insertions(+), 322 deletions(-) diff --git a/client/rpc/key.go b/client/rpc/key.go index daddffb2399..710d9fb06d2 100644 --- a/client/rpc/key.go +++ b/client/rpc/key.go @@ -1,6 +1,7 @@ package rpc import ( + "bytes" "context" "errors" @@ -9,6 +10,7 @@ import ( iface "github.com/ipfs/kubo/core/coreiface" caopts "github.com/ipfs/kubo/core/coreiface/options" "github.com/libp2p/go-libp2p/core/peer" + "github.com/multiformats/go-multibase" ) type KeyAPI HttpApi @@ -141,3 +143,53 @@ func (api *KeyAPI) Remove(ctx context.Context, name string) (iface.Key, error) { func (api *KeyAPI) core() *HttpApi { return (*HttpApi)(api) } + +func (api *KeyAPI) Sign(ctx context.Context, name string, data []byte) (iface.Key, []byte, error) { + var out struct { + Key keyOutput + Signature string + } + + err := api.core().Request("key/sign"). + Option("key", name). + FileBody(bytes.NewReader(data)). + Exec(ctx, &out) + if err != nil { + return nil, nil, err + } + + key, err := newKey(out.Key.Name, out.Key.Id) + if err != nil { + return nil, nil, err + } + + _, signature, err := multibase.Decode(out.Signature) + if err != nil { + return nil, nil, err + } + + return key, signature, nil +} + +func (api *KeyAPI) Verify(ctx context.Context, keyOrName string, signature, data []byte) (iface.Key, bool, error) { + var out struct { + Key keyOutput + SignatureValid bool + } + + err := api.core().Request("key/verify"). + Option("key", keyOrName). + Option("signature", toMultibase(signature)). + FileBody(bytes.NewReader(data)). + Exec(ctx, &out) + if err != nil { + return nil, false, err + } + + key, err := newKey(out.Key.Name, out.Key.Id) + if err != nil { + return nil, false, err + } + + return key, out.SignatureValid, nil +} diff --git a/core/commands/commands_test.go b/core/commands/commands_test.go index a73a0338e50..a34aab4488f 100644 --- a/core/commands/commands_test.go +++ b/core/commands/commands_test.go @@ -164,6 +164,8 @@ func TestCommands(t *testing.T) { "/key/rename", "/key/rm", "/key/rotate", + "/key/sign", + "/key/verify", "/log", "/log/level", "/log/ls", diff --git a/core/commands/keystore.go b/core/commands/keystore.go index 2ad2f7dbd03..a86fb281af3 100644 --- a/core/commands/keystore.go +++ b/core/commands/keystore.go @@ -24,6 +24,7 @@ import ( migrations "github.com/ipfs/kubo/repo/fsrepo/migrations" "github.com/libp2p/go-libp2p/core/crypto" peer "github.com/libp2p/go-libp2p/core/peer" + mbase "github.com/multiformats/go-multibase" ) var KeyCmd = &cmds.Command{ @@ -51,6 +52,8 @@ publish'. "rename": keyRenameCmd, "rm": keyRmCmd, "rotate": keyRotateCmd, + "sign": keySignCmd, + "verify": keyVerifyCmd, }, } @@ -688,6 +691,139 @@ func keyOutputListEncoders() cmds.EncoderFunc { }) } +type KeySignOutput struct { + Key KeyOutput + Signature string +} + +var keySignCmd = &cmds.Command{ + Status: cmds.Experimental, + Helptext: cmds.HelpText{ + Tagline: "Generates a signature for the given data with a specified key. Useful for proving the key ownership.", + LongDescription: ` +Sign arbitrary bytes, such as to prove ownership of a Peer ID or an IPNS Name. +To avoid signature reuse, the signed payload is always prefixed with +"libp2p-key signed message:". +`, + }, + Options: []cmds.Option{ + cmds.StringOption("key", "k", "The name of the key to use for signing."), + ke.OptionIPNSBase, + }, + Arguments: []cmds.Argument{ + cmds.FileArg("data", true, false, "The data to sign.").EnableStdin(), + }, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + api, err := cmdenv.GetApi(env, req) + if err != nil { + return err + } + keyEnc, err := ke.KeyEncoderFromString(req.Options[ke.OptionIPNSBase.Name()].(string)) + if err != nil { + return err + } + + name, _ := req.Options["key"].(string) + + file, err := cmdenv.GetFileArg(req.Files.Entries()) + if err != nil { + return err + } + defer file.Close() + + data, err := io.ReadAll(file) + if err != nil { + return err + } + + key, signature, err := api.Key().Sign(req.Context, name, data) + if err != nil { + return err + } + + encodedSignature, err := mbase.Encode(mbase.Base64url, signature) + if err != nil { + return err + } + + return res.Emit(&KeySignOutput{ + Key: KeyOutput{ + Name: key.Name(), + Id: keyEnc.FormatID(key.ID()), + }, + Signature: encodedSignature, + }) + }, + Type: KeySignOutput{}, +} + +type KeyVerifyOutput struct { + Key KeyOutput + SignatureValid bool +} + +var keyVerifyCmd = &cmds.Command{ + Status: cmds.Experimental, + Helptext: cmds.HelpText{ + Tagline: "Verify that the given data and signature match.", + LongDescription: ` +Verify if the given data and signatures match. To avoid the signature reuse, +the signed payload is always prefixed with "libp2p-key signed message:". +`, + }, + Options: []cmds.Option{ + cmds.StringOption("key", "k", "The name of the key to use for signing."), + cmds.StringOption("signature", "s", "Multibase-encoded signature to verify."), + ke.OptionIPNSBase, + }, + Arguments: []cmds.Argument{ + cmds.FileArg("data", true, false, "The data to verify against the given signature.").EnableStdin(), + }, + Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { + api, err := cmdenv.GetApi(env, req) + if err != nil { + return err + } + keyEnc, err := ke.KeyEncoderFromString(req.Options[ke.OptionIPNSBase.Name()].(string)) + if err != nil { + return err + } + + name, _ := req.Options["key"].(string) + encodedSignature, _ := req.Options["signature"].(string) + + _, signature, err := mbase.Decode(encodedSignature) + if err != nil { + return err + } + + file, err := cmdenv.GetFileArg(req.Files.Entries()) + if err != nil { + return err + } + defer file.Close() + + data, err := io.ReadAll(file) + if err != nil { + return err + } + + key, valid, err := api.Key().Verify(req.Context, name, signature, data) + if err != nil { + return err + } + + return res.Emit(&KeyVerifyOutput{ + Key: KeyOutput{ + Name: key.Name(), + Id: keyEnc.FormatID(key.ID()), + }, + SignatureValid: valid, + }) + }, + Type: KeyVerifyOutput{}, +} + // DaemonNotRunning checks to see if the ipfs repo is locked, indicating that // the daemon is running, and returns and error if the daemon is running. func DaemonNotRunning(req *cmds.Request, env cmds.Environment) error { diff --git a/core/coreapi/key.go b/core/coreapi/key.go index e78868067c7..a6101dae826 100644 --- a/core/coreapi/key.go +++ b/core/coreapi/key.go @@ -262,3 +262,83 @@ func (api *KeyAPI) Self(ctx context.Context) (coreiface.Key, error) { return newKey("self", api.identity) } + +const signedMessagePrefix = "libp2p-key signed message:" + +func (api *KeyAPI) Sign(ctx context.Context, name string, data []byte) (coreiface.Key, []byte, error) { + var ( + sk crypto.PrivKey + err error + ) + if name == "" || name == "self" { + name = "self" + sk = api.privateKey + } else { + sk, err = api.repo.Keystore().Get(name) + } + if err != nil { + return nil, nil, err + } + + pid, err := peer.IDFromPrivateKey(sk) + if err != nil { + return nil, nil, err + } + + key, err := newKey(name, pid) + if err != nil { + return nil, nil, err + } + + data = append([]byte(signedMessagePrefix), data...) + + sig, err := sk.Sign(data) + if err != nil { + return nil, nil, err + } + + return key, sig, nil +} + +func (api *KeyAPI) Verify(ctx context.Context, keyOrName string, signature, data []byte) (coreiface.Key, bool, error) { + var ( + name string + pk crypto.PubKey + err error + ) + if keyOrName == "" || keyOrName == "self" { + name = "self" + pk = api.privateKey.GetPublic() + } else if sk, err := api.repo.Keystore().Get(keyOrName); err == nil { + name = keyOrName + pk = sk.GetPublic() + } else if ipnsName, err := ipns.NameFromString(keyOrName); err == nil { + // This works for both IPNS names and Peer IDs. + name = "" + pk, err = ipnsName.Peer().ExtractPublicKey() + if err != nil { + return nil, false, err + } + } else { + return nil, false, fmt.Errorf("'%q' is not a known key, an IPNS Name, or a valid PeerID", keyOrName) + } + + pid, err := peer.IDFromPublicKey(pk) + if err != nil { + return nil, false, err + } + + key, err := newKey(name, pid) + if err != nil { + return nil, false, err + } + + data = append([]byte(signedMessagePrefix), data...) + + valid, err := pk.Verify(data, signature) + if err != nil { + return nil, false, err + } + + return key, valid, nil +} diff --git a/core/coreiface/key.go b/core/coreiface/key.go index 9d61cc95b33..6125e593b84 100644 --- a/core/coreiface/key.go +++ b/core/coreiface/key.go @@ -40,4 +40,12 @@ type KeyAPI interface { // Remove removes keys from keystore. Returns ipns path of the removed key Remove(ctx context.Context, name string) (Key, error) + + // Sign signs the given data with the key named name. Returns the key used + // for signing, the signature, and an error. + Sign(ctx context.Context, name string, data []byte) (Key, []byte, error) + + // Verify verifies if the given data and signatures match. Returns the key used + // for verification, whether signature and data match, and an error. + Verify(ctx context.Context, keyOrName string, signature, data []byte) (Key, bool, error) } diff --git a/core/coreiface/tests/key.go b/core/coreiface/tests/key.go index c4c86b74859..90936b0e2a4 100644 --- a/core/coreiface/tests/key.go +++ b/core/coreiface/tests/key.go @@ -5,10 +5,14 @@ import ( "strings" "testing" + "github.com/ipfs/boxo/ipns" "github.com/ipfs/go-cid" iface "github.com/ipfs/kubo/core/coreiface" opt "github.com/ipfs/kubo/core/coreiface/options" + "github.com/libp2p/go-libp2p/core/peer" mbase "github.com/multiformats/go-multibase" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func (tp *TestSuite) TestKey(t *testing.T) { @@ -34,151 +38,90 @@ func (tp *TestSuite) TestKey(t *testing.T) { t.Run("TestRenameOverwrite", tp.TestRenameOverwrite) t.Run("TestRenameSameNameNoForce", tp.TestRenameSameNameNoForce) t.Run("TestRenameSameName", tp.TestRenameSameName) - t.Run("TestRemove", tp.TestRemove) + t.Run("TestSign", tp.TestSign) + t.Run("TestVerify", tp.TestVerify) } func (tp *TestSuite) TestListSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) self, err := api.Key().Self(ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) keys, err := api.Key().List(ctx) - if err != nil { - t.Fatalf("failed to list keys: %s", err) - return - } - - if len(keys) != 1 { - t.Fatalf("there should be 1 key (self), got %d", len(keys)) - return - } - - if keys[0].Name() != "self" { - t.Errorf("expected the key to be called 'self', got '%s'", keys[0].Name()) - } - - if keys[0].Path().String() != "/ipns/"+iface.FormatKeyID(self.ID()) { - t.Errorf("expected the key to have path '/ipns/%s', got '%s'", iface.FormatKeyID(self.ID()), keys[0].Path().String()) - } + require.NoError(t, err) + require.Len(t, keys, 1) + assert.Equal(t, "self", keys[0].Name()) + assert.Equal(t, "/ipns/"+iface.FormatKeyID(self.ID()), keys[0].Path().String()) } func (tp *TestSuite) TestRenameSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) _, _, err = api.Key().Rename(ctx, "self", "foo") - if err == nil { - t.Error("expected error to not be nil") - } else { - if !strings.Contains(err.Error(), "cannot rename key with name 'self'") { - t.Fatalf("expected error 'cannot rename key with name 'self'', got '%s'", err.Error()) - } - } + require.ErrorContains(t, err, "cannot rename key with name 'self'") _, _, err = api.Key().Rename(ctx, "self", "foo", opt.Key.Force(true)) - if err == nil { - t.Error("expected error to not be nil") - } else { - if !strings.Contains(err.Error(), "cannot rename key with name 'self'") { - t.Fatalf("expected error 'cannot rename key with name 'self'', got '%s'", err.Error()) - } - } + require.ErrorContains(t, err, "cannot rename key with name 'self'") } func (tp *TestSuite) TestRemoveSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) _, err = api.Key().Remove(ctx, "self") - if err == nil { - t.Error("expected error to not be nil") - } else { - if !strings.Contains(err.Error(), "cannot remove key with name 'self'") { - t.Fatalf("expected error 'cannot remove key with name 'self'', got '%s'", err.Error()) - } - } + require.ErrorContains(t, err, "cannot remove key with name 'self'") } func (tp *TestSuite) TestGenerate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) k, err := api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } - - if k.Name() != "foo" { - t.Errorf("expected the key to be called 'foo', got '%s'", k.Name()) - } + require.NoError(t, err) + require.Equal(t, "foo", k.Name()) verifyIPNSPath(t, k.Path().String()) } -func verifyIPNSPath(t *testing.T, p string) bool { +func verifyIPNSPath(t *testing.T, p string) { t.Helper() - if !strings.HasPrefix(p, "/ipns/") { - t.Errorf("path %q does not look like an IPNS path", p) - return false - } + + require.True(t, strings.HasPrefix(p, "/ipns/")) + k := p[len("/ipns/"):] c, err := cid.Decode(k) - if err != nil { - t.Errorf("failed to decode IPNS key %q (%v)", k, err) - return false - } + require.NoError(t, err) + b36, err := c.StringOfBase(mbase.Base36) - if err != nil { - t.Fatalf("cid cannot format itself in b36") - return false - } - if b36 != k { - t.Errorf("IPNS key is not base36") - } - return true + require.NoError(t, err) + require.Equal(t, k, b36) } func (tp *TestSuite) TestGenerateSize(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) k, err := api.Key().Generate(ctx, "foo", opt.Key.Size(2048)) - if err != nil { - t.Fatal(err) - return - } - - if k.Name() != "foo" { - t.Errorf("expected the key to be called 'foo', got '%s'", k.Name()) - } + require.NoError(t, err) + require.Equal(t, "foo", k.Name()) verifyIPNSPath(t, k.Path().String()) } @@ -190,93 +133,47 @@ func (tp *TestSuite) TestGenerateType(t *testing.T) { defer cancel() api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) k, err := api.Key().Generate(ctx, "bar", opt.Key.Type(opt.Ed25519Key)) - if err != nil { - t.Fatal(err) - return - } - - if k.Name() != "bar" { - t.Errorf("expected the key to be called 'foo', got '%s'", k.Name()) - } - + require.NoError(t, err) + require.Equal(t, "bar", k.Name()) // Expected to be an inlined identity hash. - if !strings.HasPrefix(k.Path().String(), "/ipns/12") { - t.Errorf("expected the key to be prefixed with '/ipns/12', got '%s'", k.Path().String()) - } + require.True(t, strings.HasPrefix(k.Path().String(), "/ipns/12")) } func (tp *TestSuite) TestGenerateExisting(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err == nil { - t.Error("expected error to not be nil") - } else { - if !strings.Contains(err.Error(), "key with name 'foo' already exists") { - t.Fatalf("expected error 'key with name 'foo' already exists', got '%s'", err.Error()) - } - } + require.ErrorContains(t, err, "key with name 'foo' already exists") _, err = api.Key().Generate(ctx, "self") - if err == nil { - t.Error("expected error to not be nil") - } else { - if !strings.Contains(err.Error(), "cannot create key with name 'self'") { - t.Fatalf("expected error 'cannot create key with name 'self'', got '%s'", err.Error()) - } - } + require.ErrorContains(t, err, "cannot create key with name 'self'") } func (tp *TestSuite) TestList(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) l, err := api.Key().List(ctx) - if err != nil { - t.Fatal(err) - return - } - - if len(l) != 2 { - t.Fatalf("expected to get 2 keys, got %d", len(l)) - return - } - - if l[0].Name() != "self" { - t.Fatalf("expected key 0 to be called 'self', got '%s'", l[0].Name()) - return - } - - if l[1].Name() != "foo" { - t.Fatalf("expected key 1 to be called 'foo', got '%s'", l[1].Name()) - return - } + require.NoError(t, err) + require.Len(t, l, 2) + require.Equal(t, "self", l[0].Name()) + require.Equal(t, "foo", l[1].Name()) verifyIPNSPath(t, l[0].Path().String()) verifyIPNSPath(t, l[1].Path().String()) @@ -285,254 +182,246 @@ func (tp *TestSuite) TestList(t *testing.T) { func (tp *TestSuite) TestRename(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) k, overwrote, err := api.Key().Rename(ctx, "foo", "bar") - if err != nil { - t.Fatal(err) - return - } - - if overwrote { - t.Error("overwrote should be false") - } - - if k.Name() != "bar" { - t.Errorf("returned key should be called 'bar', got '%s'", k.Name()) - } + require.NoError(t, err) + assert.False(t, overwrote) + assert.Equal(t, "bar", k.Name()) } func (tp *TestSuite) TestRenameToSelf(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) _, _, err = api.Key().Rename(ctx, "foo", "self") - if err == nil { - t.Error("expected error to not be nil") - } else { - if !strings.Contains(err.Error(), "cannot overwrite key with name 'self'") { - t.Fatalf("expected error 'cannot overwrite key with name 'self'', got '%s'", err.Error()) - } - } + require.ErrorContains(t, err, "cannot overwrite key with name 'self'") } func (tp *TestSuite) TestRenameToSelfForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) _, _, err = api.Key().Rename(ctx, "foo", "self", opt.Key.Force(true)) - if err == nil { - t.Error("expected error to not be nil") - } else { - if !strings.Contains(err.Error(), "cannot overwrite key with name 'self'") { - t.Fatalf("expected error 'cannot overwrite key with name 'self'', got '%s'", err.Error()) - } - } + require.ErrorContains(t, err, "cannot overwrite key with name 'self'") } func (tp *TestSuite) TestRenameOverwriteNoForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "bar") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) _, _, err = api.Key().Rename(ctx, "foo", "bar") - if err == nil { - t.Error("expected error to not be nil") - } else { - if !strings.Contains(err.Error(), "key by that name already exists, refusing to overwrite") { - t.Fatalf("expected error 'key by that name already exists, refusing to overwrite', got '%s'", err.Error()) - } - } + require.ErrorContains(t, err, "key by that name already exists, refusing to overwrite") } func (tp *TestSuite) TestRenameOverwrite(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) kfoo, err := api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "bar") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) k, overwrote, err := api.Key().Rename(ctx, "foo", "bar", opt.Key.Force(true)) - if err != nil { - t.Fatal(err) - return - } - - if !overwrote { - t.Error("overwrote should be true") - } - - if k.Name() != "bar" { - t.Errorf("returned key should be called 'bar', got '%s'", k.Name()) - } - - if k.Path().String() != kfoo.Path().String() { - t.Errorf("k and kfoo should have equal paths, '%s'!='%s'", k.Path().String(), kfoo.Path().String()) - } + require.NoError(t, err) + require.True(t, overwrote) + assert.Equal(t, "bar", k.Name()) + assert.Equal(t, kfoo.Path().String(), k.Path().String()) } func (tp *TestSuite) TestRenameSameNameNoForce(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) k, overwrote, err := api.Key().Rename(ctx, "foo", "foo") - if err != nil { - t.Fatal(err) - return - } - - if overwrote { - t.Error("overwrote should be false") - } - - if k.Name() != "foo" { - t.Errorf("returned key should be called 'foo', got '%s'", k.Name()) - } + require.NoError(t, err) + assert.False(t, overwrote) + assert.Equal(t, "foo", k.Name()) } func (tp *TestSuite) TestRenameSameName(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) _, err = api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) k, overwrote, err := api.Key().Rename(ctx, "foo", "foo", opt.Key.Force(true)) - if err != nil { - t.Fatal(err) - return - } - - if overwrote { - t.Error("overwrote should be false") - } - - if k.Name() != "foo" { - t.Errorf("returned key should be called 'foo', got '%s'", k.Name()) - } + require.NoError(t, err) + assert.False(t, overwrote) + assert.Equal(t, "foo", k.Name()) } func (tp *TestSuite) TestRemove(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() + api, err := tp.makeAPI(t, ctx) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) k, err := api.Key().Generate(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } + require.NoError(t, err) l, err := api.Key().List(ctx) - if err != nil { - t.Fatal(err) - return - } - - if len(l) != 2 { - t.Fatalf("expected to get 2 keys, got %d", len(l)) - return - } + require.NoError(t, err) + require.Len(t, l, 2) p, err := api.Key().Remove(ctx, "foo") - if err != nil { - t.Fatal(err) - return - } - - if k.Path().String() != p.Path().String() { - t.Errorf("k and p should have equal paths, '%s'!='%s'", k.Path().String(), p.Path().String()) - } + require.NoError(t, err) + assert.Equal(t, p.Path().String(), k.Path().String()) l, err = api.Key().List(ctx) - if err != nil { - t.Fatal(err) - return - } - - if len(l) != 1 { - t.Fatalf("expected to get 1 key, got %d", len(l)) - return - } - - if l[0].Name() != "self" { - t.Errorf("expected the key to be called 'self', got '%s'", l[0].Name()) - } + require.NoError(t, err) + require.Len(t, l, 1) + assert.Equal(t, "self", l[0].Name()) +} + +func (tp *TestSuite) TestSign(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + api, err := tp.makeAPI(t, ctx) + require.NoError(t, err) + + key1, err := api.Key().Generate(ctx, "foo", opt.Key.Type(opt.Ed25519Key)) + require.NoError(t, err) + + data := []byte("hello world") + + key2, signature, err := api.Key().Sign(ctx, "foo", data) + require.NoError(t, err) + + require.Equal(t, key1.Name(), key2.Name()) + require.Equal(t, key1.ID(), key2.ID()) + + pk, err := key1.ID().ExtractPublicKey() + require.NoError(t, err) + + valid, err := pk.Verify(append([]byte("libp2p-key signed message:"), data...), signature) + require.NoError(t, err) + require.True(t, valid) +} + +func (tp *TestSuite) TestVerify(t *testing.T) { + t.Parallel() + + t.Run("Verify Own Key", func(t *testing.T) { + t.Parallel() + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + api, err := tp.makeAPI(t, ctx) + require.NoError(t, err) + + _, err = api.Key().Generate(ctx, "foo", opt.Key.Type(opt.Ed25519Key)) + require.NoError(t, err) + + data := []byte("hello world") + + _, signature, err := api.Key().Sign(ctx, "foo", data) + require.NoError(t, err) + + _, valid, err := api.Key().Verify(ctx, "foo", signature, data) + require.NoError(t, err) + require.True(t, valid) + }) + + t.Run("Verify Self", func(t *testing.T) { + t.Parallel() + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + api, err := tp.makeAPIWithIdentityAndOffline(t, ctx) + require.NoError(t, err) + + data := []byte("hello world") + + _, signature, err := api.Key().Sign(ctx, "", data) + require.NoError(t, err) + + _, valid, err := api.Key().Verify(ctx, "", signature, data) + require.NoError(t, err) + require.True(t, valid) + }) + + t.Run("Verify With Key In Different Formats", func(t *testing.T) { + t.Parallel() + + // Spin some node and get signature out. + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + api, err := tp.makeAPI(t, ctx) + require.NoError(t, err) + + key, err := api.Key().Generate(ctx, "foo", opt.Key.Type(opt.Ed25519Key)) + require.NoError(t, err) + + data := []byte("hello world") + + _, signature, err := api.Key().Sign(ctx, "foo", data) + require.NoError(t, err) + + for _, testCase := range [][]string{ + {"Base58 Encoded Peer ID", key.ID().String()}, + {"CIDv1 Encoded Peer ID", peer.ToCid(key.ID()).String()}, + {"CIDv1 Encoded IPNS Name", ipns.NameFromPeer(key.ID()).String()}, + {"Prefixed IPNS Path", ipns.NameFromPeer(key.ID()).AsPath().String()}, + } { + t.Run(testCase[0], func(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + // Spin new node. + api, err := tp.makeAPI(t, ctx) + require.NoError(t, err) + + _, valid, err := api.Key().Verify(ctx, testCase[1], signature, data) + require.NoError(t, err) + require.True(t, valid) + }) + } + }) } diff --git a/docs/changelogs/v0.25.md b/docs/changelogs/v0.25.md index ed8275f2f60..059e437b230 100644 --- a/docs/changelogs/v0.25.md +++ b/docs/changelogs/v0.25.md @@ -10,6 +10,7 @@ - [RPC `API.Authorizations`](#rpc-apiauthorizations) - [MPLEX Removal](#mplex-removal) - [Graphsync Experiment Removal](#graphsync-experiment-removal) + - [Commands `ipfs key sign` and `ipfs key verify`](#commands-ipfs-key-sign-and-ipfs-key-verify) - [📝 Changelog](#-changelog) - [👨‍👩‍👧‍👦 Contributors](#-contributors) @@ -55,6 +56,14 @@ to update Kubo because some dependency changed and it fails to build anymore. For more information see https://github.com/ipfs/kubo/pull/9747. +##### Commands `ipfs key sign` and `ipfs key verify` + +This allows the Kubo node to sign arbitrary bytes to prove ownership of a PeerID or an IPNS Name. To avoid signature reuse, the signed payload is always prefixed with `libp2p-key signed message:`. + +These commands are also both available through the RPC client and implemented in `client/rpc`. + +For more information see https://github.com/ipfs/kubo/issues/10230. + ### 📝 Changelog ### 👨‍👩‍👧‍👦 Contributors From d6d79ce45fa8362b4cb882d2690ebee58d43dbb1 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 6 Dec 2023 10:48:14 +0100 Subject: [PATCH 280/286] chore: bump to boxo 0.16.0 --- 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 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index 9a39a46a157..eb12048d238 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.20 replace github.com/ipfs/kubo => ./../../.. require ( - github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 + github.com/ipfs/boxo v0.16.0 github.com/ipfs/kubo v0.0.0-00010101000000-000000000000 github.com/libp2p/go-libp2p v0.32.1 github.com/multiformats/go-multiaddr v0.12.0 diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index 1bcbaf5df70..9ec412293a7 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -303,8 +303,8 @@ github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c h1:7Uy github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c/go.mod h1:6EekK/jo+TynwSE/ZOiOJd4eEvRXoavEC3vquKtv4yI= 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.15.1-0.20231129112844-08959f281f86 h1:9a7ug9Llglmdbzgj/gdKbPoZrd3EoaartzepObr/jlc= -github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= +github.com/ipfs/boxo v0.16.0 h1:A9dUmef5a+mEFki6kbyG7el5gl65CiUBzrDeZxzTWKY= +github.com/ipfs/boxo v0.16.0/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= 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 d1514137b76..cafc38a3d95 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/ipfs-shipyard/nopfs v0.0.12-0.20231027223058-cde3b5ba964c github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c - github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 + github.com/ipfs/boxo v0.16.0 github.com/ipfs/go-block-format v0.2.0 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 bb4d9dda710..12e1e76345b 100644 --- a/go.sum +++ b/go.sum @@ -337,8 +337,8 @@ github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c h1:7Uy github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c/go.mod h1:6EekK/jo+TynwSE/ZOiOJd4eEvRXoavEC3vquKtv4yI= 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.15.1-0.20231129112844-08959f281f86 h1:9a7ug9Llglmdbzgj/gdKbPoZrd3EoaartzepObr/jlc= -github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= +github.com/ipfs/boxo v0.16.0 h1:A9dUmef5a+mEFki6kbyG7el5gl65CiUBzrDeZxzTWKY= +github.com/ipfs/boxo v0.16.0/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= 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-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ= diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index c27e946f48c..2ec1bb7586f 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -104,7 +104,7 @@ require ( github.com/hexops/gotextdiff v1.0.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/bbloom v0.0.4 // indirect - github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86 // indirect + github.com/ipfs/boxo v0.16.0 // indirect github.com/ipfs/go-block-format v0.2.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index 918fda6f513..ec2426722b4 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -344,8 +344,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 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.15.1-0.20231129112844-08959f281f86 h1:9a7ug9Llglmdbzgj/gdKbPoZrd3EoaartzepObr/jlc= -github.com/ipfs/boxo v0.15.1-0.20231129112844-08959f281f86/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= +github.com/ipfs/boxo v0.16.0 h1:A9dUmef5a+mEFki6kbyG7el5gl65CiUBzrDeZxzTWKY= +github.com/ipfs/boxo v0.16.0/go.mod h1:jAgpNQn7T7BnibUeReXcKU9Ha1xmYNyOlwVEl193ow0= github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs= github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= From 48e379a748e65ed383b86b8606d1f9f966cdb4f5 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Wed, 6 Dec 2023 11:16:49 +0100 Subject: [PATCH 281/286] chore: update dependencies --- docs/examples/kubo-as-a-library/go.mod | 34 ++++++------ docs/examples/kubo-as-a-library/go.sum | 69 ++++++++++++----------- go.mod | 38 ++++++------- go.sum | 77 +++++++++++++------------- test/dependencies/go.mod | 37 ++++++------- test/dependencies/go.sum | 75 ++++++++++++------------- 6 files changed, 162 insertions(+), 168 deletions(-) diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index eb12048d238..3d46b2ef726 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -43,7 +43,7 @@ require ( github.com/francoispqt/gojay v1.2.13 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gabriel-vasile/mimetype v1.4.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect @@ -52,12 +52,12 @@ require ( github.com/golang/snappy v0.0.4 // indirect github.com/google/gopacket v1.1.19 // indirect github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect - github.com/google/uuid v1.3.1 // indirect + github.com/google/uuid v1.4.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/ipfs-shipyard/nopfs v0.0.12-0.20231027223058-cde3b5ba964c // indirect @@ -94,7 +94,7 @@ require ( github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect github.com/jbenet/goprocess v0.1.4 // indirect github.com/klauspost/compress v1.17.2 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/koron/go-ssdp v0.0.4 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect @@ -116,8 +116,8 @@ require ( github.com/libp2p/zeroconf/v2 v2.2.0 // indirect github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/miekg/dns v1.1.56 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect + github.com/miekg/dns v1.1.57 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -159,14 +159,14 @@ require ( github.com/polydawn/refmt v0.89.0 // indirect github.com/prometheus/client_golang v1.17.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.3.4 // indirect github.com/quic-go/quic-go v0.39.3 // indirect github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect - github.com/samber/lo v1.36.0 // indirect + github.com/samber/lo v1.39.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect @@ -196,16 +196,16 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect - golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.14.0 // indirect + golang.org/x/crypto v0.16.0 // indirect + golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - gonum.org/v1/gonum v0.13.0 // indirect + gonum.org/v1/gonum v0.14.0 // indirect google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect google.golang.org/grpc v1.55.0 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index 9ec412293a7..0216b26815a 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -174,8 +174,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= @@ -262,8 +262,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -287,8 +287,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -426,8 +426,8 @@ github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk= @@ -506,14 +506,14 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= -github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= -github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= +github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM= +github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= @@ -667,8 +667,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= @@ -689,8 +689,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= -github.com/samber/lo v1.36.0 h1:4LaOxH1mHnbDGhTVE0i1z8v/lWaQW8AIfOD3HU4mSaw= -github.com/samber/lo v1.36.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8= +github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= +github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= @@ -761,7 +761,6 @@ github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpP github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c h1:u6SKchux2yDvFQnDHS3lPnIRmfVJ5Sxy3ao2SIdysLQ= github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM= @@ -883,8 +882,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -895,8 +894,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= +golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -921,8 +920,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -972,8 +971,8 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -995,8 +994,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1062,8 +1061,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1086,8 +1085,8 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1146,16 +1145,16 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= -gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= +gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= +gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= diff --git a/go.mod b/go.mod index cafc38a3d95..eb50dde802e 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/elgris/jsondiff v0.0.0-20160530203242-765b5c24c302 github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 github.com/fsnotify/fsnotify v1.6.0 - github.com/google/uuid v1.3.1 + github.com/google/uuid v1.4.0 github.com/hashicorp/go-multierror v1.1.1 github.com/ipfs-shipyard/nopfs v0.0.12-0.20231027223058-cde3b5ba964c github.com/ipfs-shipyard/nopfs/ipfs v0.13.2-0.20231027223058-cde3b5ba964c @@ -83,11 +83,11 @@ require ( go.uber.org/fx v1.20.1 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.26.0 - golang.org/x/crypto v0.14.0 - golang.org/x/exp v0.0.0-20231006140011-7918f672742d - golang.org/x/mod v0.13.0 - golang.org/x/sync v0.4.0 - golang.org/x/sys v0.13.0 + golang.org/x/crypto v0.16.0 + golang.org/x/exp v0.0.0-20231127185646-65229373498e + golang.org/x/mod v0.14.0 + golang.org/x/sync v0.5.0 + golang.org/x/sys v0.15.0 google.golang.org/protobuf v1.31.0 ) @@ -115,7 +115,7 @@ require ( github.com/gabriel-vasile/mimetype v1.4.1 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect @@ -129,7 +129,7 @@ require ( github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/ipfs/bbloom v0.0.4 // indirect @@ -147,7 +147,7 @@ require ( github.com/ipfs/go-verifcid v0.0.2 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/klauspost/compress v1.17.2 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/koron/go-ssdp v0.0.4 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect @@ -165,9 +165,9 @@ require ( github.com/mattn/go-colorable v0.1.6 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.4 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect - github.com/miekg/dns v1.1.56 // indirect + github.com/miekg/dns v1.1.57 // indirect github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect github.com/minio/sha256-simd v1.0.1 // indirect @@ -200,7 +200,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polydawn/refmt v0.89.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/prometheus/statsd_exporter v0.22.7 // indirect github.com/quic-go/qpack v0.4.0 // indirect @@ -209,7 +209,7 @@ require ( github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rs/cors v1.7.0 // indirect - github.com/samber/lo v1.36.0 // indirect + github.com/samber/lo v1.39.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e // indirect github.com/tidwall/match v1.1.1 // indirect @@ -236,13 +236,13 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/mock v0.3.0 // indirect go4.org v0.0.0-20230225012048-214862532bf5 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.14.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/oauth2 v0.12.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - gonum.org/v1/gonum v0.13.0 // indirect + gonum.org/v1/gonum v0.14.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect google.golang.org/grpc v1.55.0 // indirect diff --git a/go.sum b/go.sum index 12e1e76345b..66d5d38d97b 100644 --- a/go.sum +++ b/go.sum @@ -203,8 +203,8 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -295,8 +295,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -321,8 +321,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -482,8 +482,8 @@ github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= @@ -579,15 +579,15 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= -github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= -github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= +github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM= +github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c h1:bzE/A84HN25pxAuk9Eej1Kz9OUelF97nAc82bDquQI8= github.com/mikioh/tcp v0.0.0-20190314235350-803a9b46060c/go.mod h1:0SQS9kMwD2VsyFEB++InYyBJroV/FRmBgcydeSUcJms= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= @@ -765,8 +765,8 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9 github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.35.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -798,8 +798,8 @@ github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= -github.com/samber/lo v1.36.0 h1:4LaOxH1mHnbDGhTVE0i1z8v/lWaQW8AIfOD3HU4mSaw= -github.com/samber/lo v1.36.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8= +github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= +github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= @@ -875,7 +875,6 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45 github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e h1:T5PdfK/M1xyrHwynxMIVMWLS7f/qHwfslZphxtGnw7s= github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g= -github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= @@ -1022,8 +1021,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1034,8 +1033,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= +golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1060,8 +1059,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1117,8 +1116,8 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1129,8 +1128,8 @@ golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1146,8 +1145,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1223,8 +1222,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1234,8 +1233,8 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1249,8 +1248,8 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1309,16 +1308,16 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= -gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= +gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= +gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index 2ec1bb7586f..e7ec1b90f3a 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -63,7 +63,7 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/go-critic/go-critic v0.9.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect @@ -76,7 +76,6 @@ require ( github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect @@ -88,7 +87,7 @@ require ( github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gopacket v1.1.19 // indirect - github.com/google/uuid v1.3.1 // indirect + github.com/google/uuid v1.4.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect @@ -98,7 +97,7 @@ require ( github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect @@ -125,7 +124,7 @@ require ( github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.8 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect @@ -150,10 +149,10 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.2 // indirect - github.com/miekg/dns v1.1.56 // indirect + github.com/miekg/dns v1.1.57 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -182,7 +181,7 @@ require ( github.com/polyfloyd/go-errorlint v1.4.3 // indirect github.com/prometheus/client_golang v1.17.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/quasilyte/go-ruleguard v0.4.0 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect @@ -191,7 +190,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect - github.com/samber/lo v1.36.0 // indirect + github.com/samber/lo v1.39.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect @@ -240,17 +239,17 @@ require ( go.tmz.dev/musttag v0.7.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect + golang.org/x/crypto v0.16.0 // indirect + golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect - golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/tools v0.14.0 // indirect - gonum.org/v1/gonum v0.13.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect + gonum.org/v1/gonum v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index ec2426722b4..9e5c96d46b4 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -175,8 +175,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -237,8 +237,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= @@ -295,8 +293,8 @@ github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= @@ -328,8 +326,8 @@ github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mO github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= @@ -422,8 +420,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0= @@ -495,15 +493,15 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/revive v1.3.2 h1:Wb8NQKBaALBJ3xrrj4zpwJwqwNA6nDpyJSEQWcCka6U= github.com/mgechev/revive v1.3.2/go.mod h1:UCLtc7o5vg5aXCwdUTU1kEBQ1v+YXPAkYDIDXbrs5I0= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= -github.com/miekg/dns v1.1.56 h1:5imZaSeoRNvpM9SzWNhEcP9QliKiz20/dA2QabIGVnE= -github.com/miekg/dns v1.1.56/go.mod h1:cRm6Oo2C8TY9ZS/TqsSrseAcncm74lfK5G+ikN2SWWY= +github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM= +github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk= github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= @@ -609,8 +607,8 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= @@ -640,8 +638,8 @@ github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJ github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= github.com/ryanrolds/sqlclosecheck v0.4.0 h1:i8SX60Rppc1wRuyQjMciLqIzV3xnoHB7/tXbr6RGYNI= github.com/ryanrolds/sqlclosecheck v0.4.0/go.mod h1:TBRRjzL31JONc9i4XMinicuo+s+E8yKZ5FN8X3G6CKQ= -github.com/samber/lo v1.36.0 h1:4LaOxH1mHnbDGhTVE0i1z8v/lWaQW8AIfOD3HU4mSaw= -github.com/samber/lo v1.36.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8= +github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= +github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= @@ -723,7 +721,6 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpR github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -github.com/thoas/go-funk v0.9.1 h1:O549iLZqPpTUQ10ykd26sZhzD+rmR5pWhuElrhbC20M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= @@ -809,8 +806,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -821,8 +818,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/exp v0.0.0-20231127185646-65229373498e h1:Gvh4YaCaXNs6dKTlfgismwWZKyjVZXwOPfIyUaqU3No= +golang.org/x/exp v0.0.0-20231127185646-65229373498e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= @@ -857,8 +854,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -902,8 +899,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -927,8 +924,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -991,16 +988,16 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1012,8 +1009,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1091,14 +1088,14 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.13.0 h1:a0T3bh+7fhRyqeNbiC3qVHYmkiQgit3wnNan/2c0HMM= -gonum.org/v1/gonum v0.13.0/go.mod h1:/WPYRckkfWrhWefxyYTfrTtQR0KH4iyHNuzxqXAKyAU= +gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0= +gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= From 0c6f08c2f700596d485c00665409a8de061f2980 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 6 Dec 2023 10:38:37 +0000 Subject: [PATCH 282/286] chore: update version --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 2799f0e85bd..30c8f12ef84 100644 --- a/version.go +++ b/version.go @@ -11,7 +11,7 @@ import ( var CurrentCommit string // CurrentVersionNumber is the current application's version literal. -const CurrentVersionNumber = "0.25.0-dev" +const CurrentVersionNumber = "0.25.0-rc1" const ApiVersion = "/kubo/" + CurrentVersionNumber + "/" //nolint From f93a3869849ca1e5e07ae5ae05fb615ae477a1bd Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 11 Dec 2023 11:45:08 +0100 Subject: [PATCH 283/286] fix: allow daemon to start correctly if the API is null (#10062) (cherry picked from commit 8c4bdd8556e0c8b1a4ea3a6d703402bd6cfe1229) --- cmd/ipfs/daemon.go | 7 +++++-- test/cli/daemon_test.go | 25 +++++++++++++++++++++++++ test/cli/harness/ipfs.go | 17 ++++++++++++++--- 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 test/cli/daemon_test.go diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index f46dbdd8cb2..4ad9b629ce0 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -727,8 +727,11 @@ func serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, error return nil, fmt.Errorf("serveHTTPApi: ConstructNode() failed: %s", err) } - if err := node.Repo.SetAPIAddr(rewriteMaddrToUseLocalhostIfItsAny(listeners[0].Multiaddr())); err != nil { - return nil, fmt.Errorf("serveHTTPApi: SetAPIAddr() failed: %w", err) + if len(listeners) > 0 { + // Only add an api file if the API is running. + if err := node.Repo.SetAPIAddr(rewriteMaddrToUseLocalhostIfItsAny(listeners[0].Multiaddr())); err != nil { + return nil, fmt.Errorf("serveHTTPApi: SetAPIAddr() failed: %w", err) + } } errc := make(chan error) diff --git a/test/cli/daemon_test.go b/test/cli/daemon_test.go new file mode 100644 index 00000000000..7a8c583a261 --- /dev/null +++ b/test/cli/daemon_test.go @@ -0,0 +1,25 @@ +package cli + +import ( + "os/exec" + "testing" + + "github.com/ipfs/kubo/test/cli/harness" +) + +func TestDaemon(t *testing.T) { + t.Parallel() + + t.Run("daemon starts if api is set to null", func(t *testing.T) { + t.Parallel() + node := harness.NewT(t).NewNode().Init() + node.SetIPFSConfig("Addresses.API", nil) + node.Runner.MustRun(harness.RunRequest{ + Path: node.IPFSBin, + Args: []string{"daemon"}, + RunFunc: (*exec.Cmd).Start, // Start without waiting for completion. + }) + + node.StopDaemon() + }) +} diff --git a/test/cli/harness/ipfs.go b/test/cli/harness/ipfs.go index dde7e3495fc..8537e2aa25d 100644 --- a/test/cli/harness/ipfs.go +++ b/test/cli/harness/ipfs.go @@ -38,9 +38,20 @@ func (n *Node) SetIPFSConfig(key string, val interface{}, flags ...string) { n.IPFS(args...) // validate the config was set correctly - var newVal string - n.GetIPFSConfig(key, &newVal) - if val != newVal { + + // Create a new value which is a pointer to the same type as the source. + var newVal any + if val != nil { + // If it is not nil grab the type with reflect. + newVal = reflect.New(reflect.TypeOf(val)).Interface() + } else { + // else just set a pointer to an any. + var anything any + newVal = &anything + } + n.GetIPFSConfig(key, newVal) + // dereference newVal using reflect to load the resulting value + if !reflect.DeepEqual(val, reflect.ValueOf(newVal).Elem().Interface()) { log.Panicf("key '%s' did not retain value '%s' after it was set, got '%s'", key, val, newVal) } } From b46b5ea38a97d85cce4f4f986b8540ef1bee1157 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 13 Dec 2023 08:59:17 +0100 Subject: [PATCH 284/286] chore: bump to go-libp2p 0.32.2 Update go-libp2p (and quic-go) with Honeybadger fix. (cherry picked from commit 3932fdfe51c0a58dc0b67835c588d818d746d5a1) --- docs/examples/kubo-as-a-library/go.mod | 4 ++-- docs/examples/kubo-as-a-library/go.sum | 8 ++++---- go.mod | 4 ++-- go.sum | 8 ++++---- test/dependencies/go.mod | 2 +- test/dependencies/go.sum | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/examples/kubo-as-a-library/go.mod b/docs/examples/kubo-as-a-library/go.mod index 3d46b2ef726..2ad0ae26973 100644 --- a/docs/examples/kubo-as-a-library/go.mod +++ b/docs/examples/kubo-as-a-library/go.mod @@ -9,7 +9,7 @@ replace github.com/ipfs/kubo => ./../../.. require ( github.com/ipfs/boxo v0.16.0 github.com/ipfs/kubo v0.0.0-00010101000000-000000000000 - github.com/libp2p/go-libp2p v0.32.1 + github.com/libp2p/go-libp2p v0.32.2 github.com/multiformats/go-multiaddr v0.12.0 ) @@ -163,7 +163,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.3.4 // indirect - github.com/quic-go/quic-go v0.39.3 // indirect + github.com/quic-go/quic-go v0.39.4 // indirect github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/samber/lo v1.39.0 // indirect diff --git a/docs/examples/kubo-as-a-library/go.sum b/docs/examples/kubo-as-a-library/go.sum index 0216b26815a..d82db17e0d2 100644 --- a/docs/examples/kubo-as-a-library/go.sum +++ b/docs/examples/kubo-as-a-library/go.sum @@ -453,8 +453,8 @@ github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZ github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.32.1 h1:wy1J4kZIZxOaej6NveTWCZmHiJ/kY7GoAqXgqNCnPps= -github.com/libp2p/go-libp2p v0.32.1/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= +github.com/libp2p/go-libp2p v0.32.2 h1:s8GYN4YJzgUoyeYNPdW7JZeZ5Ee31iNaIBfGYMAY4FQ= +github.com/libp2p/go-libp2p v0.32.2/go.mod h1:E0LKe+diV/ZVJVnOJby8VC5xzHF0660osg71skcxJvk= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= @@ -676,8 +676,8 @@ github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.39.3 h1:o3YB6t2SR+HU/pgwF29kJ6g4jJIJEwEZ8CKia1h1TKg= -github.com/quic-go/quic-go v0.39.3/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= +github.com/quic-go/quic-go v0.39.4 h1:PelfiuG7wXEffUT2yceiqz5V6Pc0TA5ruOd1LcmFc1s= +github.com/quic-go/quic-go v0.39.4/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= diff --git a/go.mod b/go.mod index eb50dde802e..1c1f5e5d478 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/jbenet/goprocess v0.1.4 github.com/julienschmidt/httprouter v1.3.0 github.com/libp2p/go-doh-resolver v0.4.0 - github.com/libp2p/go-libp2p v0.32.1 + github.com/libp2p/go-libp2p v0.32.2 github.com/libp2p/go-libp2p-http v0.5.0 github.com/libp2p/go-libp2p-kad-dht v0.24.4 github.com/libp2p/go-libp2p-kbucket v0.6.3 @@ -205,7 +205,7 @@ require ( github.com/prometheus/statsd_exporter v0.22.7 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.3.4 // indirect - github.com/quic-go/quic-go v0.39.3 // indirect + github.com/quic-go/quic-go v0.39.4 // indirect github.com/quic-go/webtransport-go v0.6.0 // indirect github.com/raulk/go-watchdog v1.3.0 // indirect github.com/rs/cors v1.7.0 // indirect diff --git a/go.sum b/go.sum index 66d5d38d97b..09b15e67f9b 100644 --- a/go.sum +++ b/go.sum @@ -511,8 +511,8 @@ github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZ github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= github.com/libp2p/go-flow-metrics v0.1.0/go.mod h1:4Xi8MX8wj5aWNDAZttg6UPmc0ZrnFNsMtpsYUClFtro= -github.com/libp2p/go-libp2p v0.32.1 h1:wy1J4kZIZxOaej6NveTWCZmHiJ/kY7GoAqXgqNCnPps= -github.com/libp2p/go-libp2p v0.32.1/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= +github.com/libp2p/go-libp2p v0.32.2 h1:s8GYN4YJzgUoyeYNPdW7JZeZ5Ee31iNaIBfGYMAY4FQ= +github.com/libp2p/go-libp2p v0.32.2/go.mod h1:E0LKe+diV/ZVJVnOJby8VC5xzHF0660osg71skcxJvk= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g= @@ -783,8 +783,8 @@ github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.39.3 h1:o3YB6t2SR+HU/pgwF29kJ6g4jJIJEwEZ8CKia1h1TKg= -github.com/quic-go/quic-go v0.39.3/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= +github.com/quic-go/quic-go v0.39.4 h1:PelfiuG7wXEffUT2yceiqz5V6Pc0TA5ruOd1LcmFc1s= +github.com/quic-go/quic-go v0.39.4/go.mod h1:T09QsDQWjLiQ74ZmacDfqZmhY/NLnw5BC40MANNNZ1Q= github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= github.com/quic-go/webtransport-go v0.6.0/go.mod h1:9KjU4AEBqEQidGHNDkZrb8CAa1abRaosM2yGOyiikEc= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index e7ec1b90f3a..b726fb5b00b 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -133,7 +133,7 @@ require ( github.com/leonklingele/grouper v1.1.1 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-cidranger v1.1.0 // indirect - github.com/libp2p/go-libp2p v0.32.1 // indirect + github.com/libp2p/go-libp2p v0.32.2 // indirect github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect github.com/libp2p/go-libp2p-kad-dht v0.24.4 // indirect github.com/libp2p/go-libp2p-kbucket v0.6.3 // indirect diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index 9e5c96d46b4..047bf5f5ae7 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -449,8 +449,8 @@ github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QT github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c= github.com/libp2p/go-cidranger v1.1.0/go.mod h1:KWZTfSr+r9qEo9OkI9/SIEeAtw+NNoU0dXIXt15Okic= github.com/libp2p/go-flow-metrics v0.1.0 h1:0iPhMI8PskQwzh57jB9WxIuIOQ0r+15PChFGkx3Q3WM= -github.com/libp2p/go-libp2p v0.32.1 h1:wy1J4kZIZxOaej6NveTWCZmHiJ/kY7GoAqXgqNCnPps= -github.com/libp2p/go-libp2p v0.32.1/go.mod h1:hXXC3kXPlBZ1eu8Q2hptGrMB4mZ3048JUoS4EKaHW5c= +github.com/libp2p/go-libp2p v0.32.2 h1:s8GYN4YJzgUoyeYNPdW7JZeZ5Ee31iNaIBfGYMAY4FQ= +github.com/libp2p/go-libp2p v0.32.2/go.mod h1:E0LKe+diV/ZVJVnOJby8VC5xzHF0660osg71skcxJvk= github.com/libp2p/go-libp2p-asn-util v0.3.0 h1:gMDcMyYiZKkocGXDQ5nsUQyquC9+H+iLEQHwOCZ7s8s= github.com/libp2p/go-libp2p-asn-util v0.3.0/go.mod h1:B1mcOrKUE35Xq/ASTmQ4tN3LNzVVaMNmq2NACuqyB9w= github.com/libp2p/go-libp2p-kad-dht v0.24.4 h1:ktNiJe7ffsJ1wX3ULpMCwXts99mPqGFSE/Qn1i8pErQ= @@ -626,7 +626,7 @@ github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4l github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qtls-go1-20 v0.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= -github.com/quic-go/quic-go v0.39.3 h1:o3YB6t2SR+HU/pgwF29kJ6g4jJIJEwEZ8CKia1h1TKg= +github.com/quic-go/quic-go v0.39.4 h1:PelfiuG7wXEffUT2yceiqz5V6Pc0TA5ruOd1LcmFc1s= github.com/quic-go/webtransport-go v0.6.0 h1:CvNsKqc4W2HljHJnoT+rMmbRJybShZ0YPFDD3NxaZLY= github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= From 0ab1f1c0ea976ebac6d63be71f018e441f86889b Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 14 Dec 2023 14:09:24 +0000 Subject: [PATCH 285/286] chore: update version --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 30c8f12ef84..ac23d43e804 100644 --- a/version.go +++ b/version.go @@ -11,7 +11,7 @@ import ( var CurrentCommit string // CurrentVersionNumber is the current application's version literal. -const CurrentVersionNumber = "0.25.0-rc1" +const CurrentVersionNumber = "0.25.0" const ApiVersion = "/kubo/" + CurrentVersionNumber + "/" //nolint From 87069b53554c2b2dbbcc720dced1e32164402f03 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 14 Dec 2023 14:11:25 +0000 Subject: [PATCH 286/286] chore: update changelog for v0.25 --- docs/changelogs/v0.25.md | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/docs/changelogs/v0.25.md b/docs/changelogs/v0.25.md index 059e437b230..db610044a75 100644 --- a/docs/changelogs/v0.25.md +++ b/docs/changelogs/v0.25.md @@ -66,4 +66,72 @@ For more information see https://github.com/ipfs/kubo/issues/10230. ### 📝 Changelog +
Full Changelog + +- github.com/ipfs/kubo: + - chore: update version + - fix: allow daemon to start correctly if the API is null (#10062) ([ipfs/kubo#10062](https://github.com/ipfs/kubo/pull/10062)) + - chore: update version + - feat: ipfs key sign|verify (#10235) ([ipfs/kubo#10235](https://github.com/ipfs/kubo/pull/10235)) + - docs(cli): fix spelling + - feat: webui v4.2.0 (#10241) ([ipfs/kubo#10241](https://github.com/ipfs/kubo/pull/10241)) + - Migrate coreiface ([ipfs/kubo#10237](https://github.com/ipfs/kubo/pull/10237)) + - docs: clarify WebRTCDirect cannot reuse the same port as QUIC + - libp2p: remove mplex + - graphsync: remove support for the server + - docs: move kubo-specific docs (#10226) ([ipfs/kubo#10226](https://github.com/ipfs/kubo/pull/10226)) + - feat(rpc): Opt-in HTTP RPC API Authorization (#10218) ([ipfs/kubo#10218](https://github.com/ipfs/kubo/pull/10218)) + - docs: clarify ipfs id agent version + - fix: regression in 'ipfs dns' + - docs(changelog): clarify webrtc in v0.24 + - chore: create next changelog + - Merge Release: v0.24.0 ([ipfs/kubo#10209](https://github.com/ipfs/kubo/pull/10209)) + - fix: allow event emitting to happen in parallel with getting the query channel + - fixes to routing put command (#10205) ([ipfs/kubo#10205](https://github.com/ipfs/kubo/pull/10205)) + - docs: fix accelerated-dht-client + - docs/config: remove extra commas in PublicGateways example entries + - docs: make it clear Web RTC Direct is experimental + - feat: add WebRTC Direct support + - docs: update EARLY_TESTERS.md (#10194) ([ipfs/kubo#10194](https://github.com/ipfs/kubo/pull/10194)) + - Update Version: v0.24 ([ipfs/kubo#10191](https://github.com/ipfs/kubo/pull/10191)) +- github.com/ipfs/boxo (v0.15.0 -> v0.16.0): + - Release 0.16.0 ([ipfs/boxo#518](https://github.com/ipfs/boxo/pull/518)) +- github.com/libp2p/go-libp2p (v0.32.1 -> v0.32.2): + - release v0.32.2 + +
+ ### 👨‍👩‍👧‍👦 Contributors + +| Contributor | Commits | Lines ± | Files Changed | +|-------------|---------|---------|---------------| +| Łukasz Magiera | 149 | +7833/-2505 | 375 | +| Henrique Dias | 26 | +2498/-7535 | 210 | +| Steven Allen | 48 | +497/-373 | 129 | +| Jorropo | 9 | +247/-604 | 49 | +| Michael Muré | 6 | +306/-79 | 14 | +| Adin Schmahmann | 3 | +275/-8 | 5 | +| Lucas Molas | 1 | +181/-56 | 2 | +| Laurent Senta | 1 | +109/-24 | 7 | +| Lars Gierth | 6 | +82/-18 | 8 | +| Petar Maymounkov | 1 | +66/-32 | 3 | +| web3-bot | 1 | +47/-42 | 17 | +| Marcin Rataj | 6 | +57/-23 | 8 | +| Kevin Atkinson | 5 | +31/-31 | 17 | +| Marten Seemann | 3 | +27/-28 | 16 | +| Hector Sanjuan | 3 | +28/-14 | 10 | +| Overbool | 2 | +36/-3 | 3 | +| Raúl Kripalani | 1 | +11/-12 | 4 | +| hannahhoward | 2 | +11/-7 | 6 | +| Jeromy Johnson | 5 | +9/-9 | 5 | +| ForrestWeston | 1 | +14/-1 | 1 | +| Russell Dempsey | 1 | +10/-2 | 2 | +| Will Scott | 1 | +8/-1 | 1 | +| Jeromy | 2 | +4/-4 | 2 | +| sukun | 1 | +2/-2 | 1 | +| Steve Loeppky | 1 | +2/-2 | 1 | +| Jonas Keunecke | 1 | +2/-2 | 1 | +| Edgar Lee | 1 | +3/-1 | 1 | +| Dreamacro | 1 | +2/-2 | 2 | +| godcong | 1 | +1/-1 | 1 | +| Cole Brown | 1 | +1/-1 | 1 |