Commit Graph

1816 Commits

Author SHA1 Message Date
Gus Eggert
f855bfe6ef
feat: add basic gateway tracing (#8595)
* add deprecation warning when tracer plugins are loaded
* add response format attribute to span in gateway handler
* add note about tracing's experimental status in godoc
* add nil check for TTL when adding name span attrs
* add basic sharness test for integration with otel collector
* add nil check in UnixFSAPI.processLink
* test: sharness check all json objs for swarm span
* add env var docs to docs/environment-variables.md
* chore: pin the otel collector version
* add tracing spans per response type (#8841)
* docs: tracing with jaeger-ui

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-04 19:24:05 +02:00
Lucas Molas
282ac7f1f5
fix(cli): ipfs add with multiple files of same name (#8493) 2022-04-03 10:40:38 -04:00
Marcin Rataj
5fa556945e
fix(gw): validate requested CAR version (#8835)
* fix(gw): validate requested CAR version

This adds validation of 'application/vnd.ipld.car;version=n' passed
in the Accept header by HTTP clients to align Gateway behavior with
the spec submitted to IANA.

* test: fix comment in test/sharness/t0118-gateway-car.sh

Co-authored-by: Gus Eggert <gus@gus.dev>

Co-authored-by: Gus Eggert <gus@gus.dev>
2022-04-01 09:12:46 -07:00
Gus Eggert
46c3689b75
feat: re-enable docker sharness tests (#8808)
The Docker sharness tests were disabled years ago when go-ipfs moved
from Travis to CircleCI. This makes the tweaks necessary to re-enable
them.

The Docker image has since moved to be based on BusyBox which doesn't
have the requisite wget version for the existing tests to work, so
this adds some functionality to the pollEndpoint program to support
polling HTTP endpoints as well.
2022-03-30 11:07:26 -04:00
Lucas Molas
c8543904d9
Merge pull request #8793 from ipfs/kylehuntsman/fix/repo/omitempty-error
fix(fsrepo): deep merge when setting config
2022-03-22 11:02:29 -03:00
Lucas Molas
f62bd64fdb allow config to fail as we have no empty default 2022-03-21 19:03:37 -03:00
Hector Sanjuan
943187d001 ErrNotFound changes: bubble tagged libraries.
Additionally fixes tests for new error message which went from

`ipld: <cid> not found`

to

`<cid> not found`
2022-03-19 00:16:45 +01:00
Jorropo
09aed2d63b
Merge pull request #8757 from ipfs/feat/err-not-found
Bubble ErrNotFound improvements.

The is a really nice UX improvement because it know tell you which ipld block is missing instead of a generic "not found".
2022-03-18 00:42:40 +01:00
Marcin Rataj
4cabdfefbf
feat(gateway): Block and CAR response formats (#8758)
* feat: serveRawBlock implements ?format=block
* feat: serveCar implements ?format=car
* feat(gw): ?format= or Accept HTTP header

- extracted file-like content type responses to separate .go files
- Accept HTTP header with support for application/vnd.ipld.* types

* fix: use .bin for raw block content-disposition

.raw may be handled by something, depending on OS, and .bin
seems to be universally "binary file" across all systems:
https://en.wikipedia.org/wiki/List_of_filename_extensions_(A%E2%80%93E)

* refactor: gateway_handler_unixfs.go

- Moved UnixFS response handling to gateway_handler_unixfs*.go files.
- Removed support for X-Ipfs-Gateway-Prefix (Closes #7702)

* refactor: prefix cleanup and readable paths

- removed dead code after X-Ipfs-Gateway-Prefix is gone
  (https://github.com/ipfs/go-ipfs/issues/7702)
- escaped special characters in content paths returned with http.Error
  making them both safer and easier to reason about (e.g. when invisible
  whitespace Unicode is used)
2022-03-17 17:15:24 +01:00
Dave Justice
6774ef9dfd
fix: allow ipfs-companion browser extension to access RPC API (#8690)
* fix: add companion ids to allow origins

- fixes #8689
- Adds the chrome-extension ids for ipfs-companion and
ipfs-companion-beta to the allowed origins list, this
allows us to accesss ipfs api from a manifest v3 extension.
- added tests in t0401-api-browser-security.sh

* fix: companion when custom CORS *-Origin is set

Companion extension should be able to access RPC API even when custom
Access-Control-Allow-Origin is set

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-03-17 00:07:52 +01:00
Lucas Molas
3c09c260bf remove todo 2022-03-16 19:03:03 -03:00
Gus Eggert
5e1b2248c5
feat: add full goroutine stack dump (#8790) 2022-03-16 09:42:22 -04:00
Lucas Molas
04e7e9502e
feat(cmds): extend block size check for dag|block put (#8751)
* feat(cmds): extend block size check for dag|block put
* feat(cmds): block size check for dag import
* style: dag-pb → UnixFS, 1MB → 1MiB

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-03-11 23:23:11 +01:00
Gus Eggert
0487f03eae
feat: add endpoint for enabling block profiling (#8469) 2022-03-11 14:32:59 -05:00
Laurent Senta
8d549f03f3 fix: rewrite dependencies over the go-ipfs-config package 2022-03-04 09:45:16 +01:00
Kyle Huntsman
e1d14441a0 fix(fsrepo): deep merge when setting config 2022-03-03 00:21:37 -07:00
Hector Sanjuan
6c6830c822 Fix sharness 2022-03-02 19:30:38 +01:00
Hector Sanjuan
04048f46a2 Try to fix sharness error 2022-03-02 19:14:35 +01:00
Hector Sanjuan
eb86f3659a Fix sharness for new not found error messages 2022-03-02 18:40:10 +01:00
Marcin Rataj
caba3b2643
feat: X-Ipfs-Roots for smarter HTTP caches (#8720) 2022-03-01 09:04:31 -08:00
Lucas Molas
3ea5631f9a
fix(cmds/keystore): do not allow to import keys we don't generate (#8733) 2022-02-18 23:42:40 +01:00
Will
bfa9d3db99
feat(cmd): add silent option for repo gc (#7147)
* feat(cmd): add silent option repo gc command

closes #7129

* test(cmd): add test case for silent option for command repo gc
* fix: no emit on server with --silent

This removes unnecessary send to the client that does not care

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-02-18 22:29:32 +01:00
Dimitris Apostolou
b2efcf5ce3
Fix typos (#8726) 2022-02-15 18:50:09 -05:00
Feiran Yang
e93d6fbfb1
feat: warn user when 'pin remote add' while offline (#8621)
* feat: add warning message when the local node is offline for remote pinning

* feat: check is node is online

* feat: add test in t0700-remotepin.sh

* feat: use grep and fix the test

* fix: print to stdout only when --enc=text

This ensures we don't break JSON produced by --enc=json

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-02-15 17:19:53 -05:00
Lucas Molas
a494f48a9d
feat(cmds): ipfs id: support --offline option (#8626)
* feat(cmds): ipfs id: add offline option
* docs: clarify why 'ipfs id <peer>' in offline mode

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-02-10 20:42:32 +01:00
Lucas Molas
fe788cae98
feat(cmds): add cleartext PEM/PKCS8 for key import/export (#8616)
* feat(cmds): add PEM/PKCS8 for key import/export

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Gus Eggert <gus@gus.dev>
2022-02-10 10:45:02 -05:00
Steven Allen
cdb76adff7 test: fix CIDs in repo gc sharness tests 2021-12-07 13:00:39 -08:00
Adin Schmahmann
50abfad5cc fix: reenable some gc tests 2021-12-07 15:02:44 -05:00
Hector Sanjuan
953f4b6ef0 Sharness: fix t0084-repo-read-rehash for raw multihashes
Compare multihashes rather than CIDs.
2021-12-02 09:46:23 -05:00
Hector Sanjuan
8cdc18ab2f Fix t0275-cid-security.sh: rename bad block file
This sharness test provides 2 datastore blocks directly.

One of them (corresponding to an "insecure block") is not a CIDv0 therefore it
needs to be migrated and stored with its raw-multihash ID.

The (raw) CID of the block used in the test remains the same.

The other block needs no changes.
2021-12-02 09:46:23 -05:00
Hector Sanjuan
4ac3ed3ebd Raw multihashes: fix some sharness tests
This fixes some tests which expect "refs local" and "repo gc" outputs to match
the CIDs produced when adding data. These operations are now outputting CIDv1-raw
hashes, regardless of the original CIDs used to address those blocks, so some tests
fail.

The fix is usually:

* To use "block stat" to check if a block was correctly gc'ed
* To convert the CIDs to multihash (using cid-fmt) and compare those instead
2021-12-02 09:41:43 -05:00
jwh
029d82c4ea
feat: enabling pubsub and ipns-pubsub via config flags (#8510)
* Allow pubsub and namesys-pubsub to be enabled via config

Signed-off-by: Joe Holden <jwh@zorins.us>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
2021-11-30 11:00:11 -08:00
Mohsin Zaidi
ecd2628a16
Integrate go-dag-jose plugin (#8569)
* feat(dag-jose): integrate `go-dag-jose` plugin
* test(dag-jose): sharness test for dag-jose plugin

Co-authored-by: Eric Myhre <hash@exultant.us>
2021-11-30 10:58:15 -08:00
Jorropo
c2953ab8f1
feat: Addresses.AppendAnnounce (#8177)
* feat: Addresses.AppendAnnounce

Closes #7791

* fix: deduplicate Swarm.Announce and AppendAnnounce

https://github.com/ipfs/go-ipfs/pull/8177#discussion_r759317772
https://github.com/ipfs/go-ipfs/pull/8177#discussion_r759320332

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-11-30 17:58:19 +01:00
Cory Schwartz
a43e506d7f
fix: multibase in pubsub http rpc (#8183)
* multibase encoding on pubsub
* emit multibase for json clients
* refactor(pubsub): base64url for all URL args

This makes it easier to reason about.
Also added better helptext to each command explaining how the binary
data is encoded on the wire, and how to process it in userland.

* refactor: remove ndpayload and lenpayload

Those output formats are undocumented and seem to be only used in tests.
This change removes their implementation and replaces it with error
message to use JSON instead.

I also refactored tests to test the --enc=json response format instead
of imaginary one, making tests more useful as they also act as
regression tests for HTTP RPC.

* test(pubsub): go-ipfs-api

Testing against compatible version from
https://github.com/ipfs/go-ipfs-api/pull/255

* refactor: safeTextListEncoder

Making it clear what it does and why

* refactor(pubsub): unify peerids

This ensures `ipfs pubsub sub` returns the same peerids in the `From`
field as `ipfs pubsub peers`.

libp2p already uses base encoding, no need to double wrap or use custom
multibase.

* test(pubsub): go-ipfs-http-client

* refactor(pubsub): make pub command read from a file

We want to send payload in the body as multipart so users can use
existing tools like curl for publishing arbitrary bytes to a topic.

StringArg was created for "one message per line" use case, and if data
has `\n` or `\r\n` byte sequences, it will cause payload to be split. It
is not possible to undo this, because mentioned sequences are lost, so
we are not able to tell if it was `\n` or `\r\n`

We already avoid this problem in `block put` and `dht put` by reading
payload via FileArg which does not mangle binary data and send it as-is.
It feel like `pubsub pub` should be using it in the first place anyway,
so this commit replaces StringArg with FileArg.

This also closes https://github.com/ipfs/go-ipfs/issues/8454
and makes rpc in go-ipfs easier to code against.

* test(pubsub): publishing with line breaks

Making sure we don't see regressions in the future.
Ref. https://github.com/ipfs/go-ipfs/issues/7939

* chore: disable pubsub interop for now

See
344f692d8c

* test: t0322-pubsub-http-rpc.sh

- Adds HTTP RPC regression test that ensures topic is encoded as URL-safe
  multibase.
- Moves pubsub tests to live in unique range ./t032x

* fix(ci):  js-ipfs with  fixed pubsub wire format

uses js-ipfs from https://github.com/ipfs/js-ipfs/pull/3922 
until js-ipfs release can ship with dependency on go-ipfs 0.11.0-rc1

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
2021-11-29 23:06:54 +01:00
Adin Schmahmann
52c177ced9
feat: go-libp2p 0.16, UnixFS autosharding and go-datastore with contexts (#8563)
* plumb through go-datastore context changes

* update go-libp2p to v0.16.0
* use LIBP2P_TCP_REUSEPORT instead of IPFS_REUSEPORT
* use relay config
* making deprecation notice match the go-ipfs-config key
* docs(config): circuit relay v2
* docs(config): fix links and headers
* feat(config): Internal.Libp2pForceReachability

This switches to config that supports setting and reading
Internal.Libp2pForceReachability OptionalString flag

* use configuration option for static relays

* chore: go-ipfs-config v0.18.0

https://github.com/ipfs/go-ipfs-config/releases/tag/v0.18.0

* feat: circuit v1 migration prompt when Swarm.EnableRelayHop is set (#8559)
* exit when Swarm.EnableRelayHop is set
* docs: Experimental.ShardingEnabled migration

This ensures existing users of global sharding experiment get notified
that the flag no longer works + that autosharding happens automatically.

For people who NEED to keep the old behavior (eg. have no time to
migrate today) there is a note about restoring it with
`UnixFSShardingSizeThreshold`.

* chore: add dag-jose code to the cid command output

* add support for setting automatic unixfs sharding threshold from the config
* test: have tests use low cutoff for sharding to mimic old behavior
* test: change error message to match the current error
* test: Add automatic sharding/unsharding tests (#8547)
* test: refactored naming in the sharding sharness tests to make more sense

* ci: set interop test executor to convenience image for Go1.16 + Node
* ci: use interop master

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Gus Eggert <gus@gus.dev>
Co-authored-by: Lucas Molas <schomatis@gmail.com>
2021-11-29 19:58:05 +01:00
Dimitris Apostolou
0c2f9d5950
Fix typos (#8548) 2021-11-17 21:16:06 +01:00
Andrey Kostakov
f6223605e7 Add support for multiple files to ipfs files rm. 2021-11-12 12:07:58 -05:00
Lucas Molas
3f4e37f9ac fix(sharness): use -Q option instead of pipe to tail cmd 2021-11-11 10:22:20 -05:00
Adin Schmahmann
3e43745592
Merge pull request #8508 from ipfs/fix/link-res-check
fix(unixfs): check for errors before dereferencing the link
2021-10-26 13:03:54 -07:00
Adin Schmahmann
a18b51b9ea test: test ls incomplete sharded directory 2021-10-25 11:54:48 -04:00
guseggert
5a61bedef5 test: add sharness test for reading ADLs with FUSE 2021-10-20 11:17:43 -04:00
Marcin Rataj
0b923b7951 chore: update dir-index-html to v1.2.2
https://github.com/ipfs/dir-index-html/releases/tag/1.2.2
2021-10-07 12:42:17 -04:00
Lucas Molas
485a5c291f
fix(cli): object add-link: do not allow blocks over BS limit (#8414)
* fix(cli): object add-link: do not allow blocks over BS limit
* refactor: allow-big-block

- renamed override flag to --allow-big-block
- separate tests for default and override behavior

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-09-28 15:27:15 +02:00
Adin Schmahmann
d576e53c04 test: add dag get --ouput-codec test 2021-09-27 16:18:27 -04:00
Adin Schmahmann
b83651b220 remove dag put option shortcuts 2021-09-27 14:39:03 -04:00
Adin Schmahmann
2920679056 change names of ipfs dag put flags to make changes clearer 2021-09-27 14:39:03 -04:00
Steve Loeppky
51ca219247
Merge pull request #8432 from ipfs/schomatis/flaky-mfs-test/add-extra-poll-check 2021-09-24 08:15:29 -07:00
Rod Vagg
0057199af4
feat: dag import --stats (#8237)
* feat: report block count on `dag import`
* fix: clean-up dag import message format
* Only print stats when --stats flag is passed

This applies to both text and json output encoding.

- Stats data is now contained within a Stats datastructure
- Stats are printed after root so that first line of output is the same as previously, even when stats are output using --stats

* fix sharness test

* Add PayloadBytesCount to stats

* Attempt to stabilize flaky tests

* Rename PayloadBytesCount to BlockBytesCount

* Correctly calculate size or imported dag

* Use RawSize of original block for import bytes calc

* test: dag import without --stats

basic regression tests for the default output (text and json)

Co-authored-by: gammazero <gammazero@users.noreply.github.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-09-23 16:23:57 +02:00
Lucas Molas
3a84352f18
feat(cli): add daemon option --agent-version-suffix (#8419)
* feat(cli): add daemon option --agent-version-suffix
* fix sharness test when commit is empty (release)
2021-09-21 20:31:08 +02:00