Commit Graph

1798 Commits

Author SHA1 Message Date
Laurent Senta
8d549f03f3 fix: rewrite dependencies over the go-ipfs-config package 2022-03-04 09:45:16 +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
Andey Robins
c89110920e
feat: multibase transcode command (#8403)
* Add a transcoder command to multibase

In order to more easily facilitate the conversion
between multibase formats, include a transcode command
to avoid `multibase decode | multibase encode`

* Example code needed go mod tidy

Co-authored-by: gammazero <gammazero@users.noreply.github.com>
2021-09-21 20:19:40 +02:00
Takashi Matsuda
a651045c50
feature: 'ipfs swarm peering' command (#8147)
* feat: added swarm peering command supporting add, ls and rm

Co-authored-by: Steven Allen <steven@stebalien.com>
2021-09-15 07:46:16 -07:00
Lucas Molas
cfdfbc3ebc fix(sharness): add extra check in flush=false in files write 2021-09-13 09:37:18 -03:00
guseggert
a35dd2ea0d ci: preload peerlog plugin, disable by default
This preloads the peerlog plugin in the ipfs binary, but keeps it
disabled by default. To enabled it, set Enabled=true in its config.

The motivation is to simplify building and deploying gateways, and for
them to use binaries that are more similar to release bins.
2021-08-25 19:02:51 +00:00
Cory Schwartz
7db27bf83a
feat: add 'ipfs multibase' commands (#8180)
* add multibase helper commands (encode, decode, list)

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-08-18 16:48:39 -04:00
Adin Schmahmann
7448340d20
support bitswap configurability (#8268)
* feat: extract Bitswap fx initialization to its own file
* chore: bump go-bitswap dependency
* feat: bump go-ipfs-config dependency and utilize the new Internal.Bitswap configuration options. Add documentation around the new OptionalInteger config type as well as the Internal.Bitswap options.
* docs(docs/config.md): move the table of contents towards the top of the document and update it

Co-authored-by: Petar Maymounkov <petarm@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Gus Eggert <877588+guseggert@users.noreply.github.com>
2021-08-18 14:15:16 -04:00
Hannah Howard
f63a997c35
IPLD Prime In IPFS: Target Merge Branch (#7976)
* feat: switch to using go-ipld-prime for codecs, path resolution, and the `dag put/get` commands
* fix: `dag put/get` not roundtripping due to an extra new line being added (https://github.com/ipfs/go-ipfs/issues/3503)

More detailed information is in the CHANGELOG.md file. Very high level:
* IPLD codecs (and their plugins) must use go-ipld-prime
* Added support for the dag-json codec
* `dag get/put` use IPLD codec names from the multicodec table
* `dag get` defaults to dag-json output instead of json, but may output with other codecs
* Data model pathing can be achieved using the /ipld prefix. For example, you can use `/ipld/QmFoo/Links/0/Hash` to traverse through a DagPB node
* With `dag get/put` the DagPB field names have been changed to match the ones in the protobuf listed in the specification

Co-authored-by: hannahhoward <hannah@hannahhoward.net>
Co-authored-by: Daniel Martí <mvdan@mvdan.cc>
Co-authored-by: acruikshank <acruikshank@example.com>
Co-authored-by: Steven Allen <steven@stebalien.com>
Co-authored-by: Will Scott <will.scott@protocol.ai>
Co-authored-by: Will Scott <will@cypherpunk.email>
Co-authored-by: Rod Vagg <rod@vagg.org>
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
Co-authored-by: Eric Myhre <hash@exultant.us>
2021-08-17 13:32:49 -04:00
Jesse Bouwman
0af19abe6b Verify creation of file created by cp -p 2021-08-14 09:38:33 -07:00
Jesse Bouwman
ff3fff107b Clean up after cp -p test 2021-08-14 09:34:47 -07:00
Jesse Bouwman
0d87b474c1 Add test for ipfs files cp -p 2021-08-13 17:21:30 -07:00
Adin Schmahmann
6de589c0c7
Merge pull request #8254 from ipfs/schomatis/chore/sharness/t0250/change-online-offline-naming
Disambiguate online/offline naming in sharness tests
2021-07-23 08:27:18 -07:00
Steven Allen
1ddb1c5c59
Merge pull request #8283 from ipfs/rvagg/rename-docker-host
Rename DOCKER_HOST to TEST_DOCKER_HOST to avoid conflicts
2021-07-22 07:56:45 -07:00
Steven Allen
0bea7ce6a9 test(sharness): test profile dump 2021-07-21 18:04:11 -07:00
Steven Allen
d52d183020 feat: add an "ipfs diag profile" command
This should replace the "collect-profiles.sh" script and allow users to
easily collect profiles.

At the moment, it just dumps all profiles into a single zip file. It
does this server-side so it's easy fetch them with curl.

In the future, it would be nice to add:

1. Progress indicators (cpu profiles take 30 seconds).
2. An option to specify which profiles to collect.

But we can handle that later.

Unfortunately, this command doesn't produce symbolized svgs as I didn't
want to depend on having a local go compiler.
2021-07-21 14:51:47 -07:00
Rod Vagg
8a7d5e9244
Rename DOCKER_HOST to TEST_DOCKER_HOST to avoid conflicts
DOCKER_HOST is a special environment variable of the Docker CLI
so there's risk of creating conflicts whenever attempting to use `docker`
in the test suite; it also makes it difficult to run the same full suite
locally using the same setup since DOCKER_HOST is a fixed variable in
t0700-remotepin.sh
2021-07-21 14:44:24 +10:00
Masih H. Derkani
1aa9c1a18f
Add test with expected failure for #3503
Write a `sharness` test that expects failure documenting the issue
raised in #3503. The issue may get resolved in the refactoring of
`ipfs dag get` command to support go-ipld-prime (e.g. #8171). For now
add a `sharness` test that expects failure. We will then flip the
expectation in the success in the rewriting PR to check if #3503 gets
resolved.

Relates to:
- https://github.com/ipfs/go-ipfs/issues/3503
2021-07-20 12:16:33 +01:00
Lucas Molas
c6a7d28497 remove blocking (now resolved) fixme 2021-07-12 15:54:56 -03:00
Lucas Molas
9561068548 propagate test_launch_ipfs_daemon_without_network name 2021-07-08 16:53:58 -03:00