Commit Graph

3668 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
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
Lucas Molas
d92887086f
fix(core/commands): do not cache config (#8824) 2022-03-27 08:11:45 -04:00
Marcin Rataj
a61c53f87f
feat(cmds): document deprecated RPC API commands (#8802)
* feat(cmds): add deprecated and experimental status

Added programmatic state annotation introduced in
https://github.com/ipfs/go-ipfs-cmds/pull/225
for already deprecated / experimental commands.

* chore: go-ipfs-cmds v0.7.0

Co-authored-by: Lucas Molas <schomatis@gmail.com>
2022-03-22 20:46:32 +01:00
Adin Schmahmann
beaa8fc29b
feat: add gateway histogram metrics (#8443)
* feat(gw): response type histogram metrics

- response-type agnostic firstContentBlockGetMetric which counts the
  latency til the first content block.

- car/block/file/gen-dir-index duration histogram metrics that show how
  long each response type takes

* docs: improve metrics descriptions
* feat: more gw histogram buckets

0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 30, 60 secs
as suggested in reviews at https://github.com/ipfs/go-ipfs/pull/8443

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Gus Eggert <gus@gus.dev>
2022-03-21 15:57:08 +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
e14f580ba7
Merge pull request #8638 from ipfs/schomatis/fix/core/node/unwrap-fx-error
fix(core/node): unwrap fx error in node construction
2022-03-16 19:45:51 -03:00
Lucas Molas
519863ecab fix(core/node): unwrap fx error in node construction 2022-03-16 19:32:31 -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
Lucas Molas
199659ab77
fix(cmds): option for progress bar in cat/get (#8686)
* fix(cmds): option for progress bar in cat/get

* defer bar.Finish()
2022-03-11 14:25:46 -05:00
godcong
be3dbc2bd2
fix(discovery): fix daemon not starting due to mdns startup failure (#8704) 2022-03-09 07:08:24 -08:00
Laurent Senta
8d549f03f3 fix: rewrite dependencies over the go-ipfs-config package 2022-03-04 09:45:16 +01:00
Hector Sanjuan
7bb3bfbc33 Bubble ErrNotFound improvements 2022-03-02 18:29:29 +01:00
Marcin Rataj
d5ad847e05
feat: ipfs-webui v2.15 (#8712)
Release Notes:
https://github.com/ipfs/ipfs-webui/releases/tag/v2.15.0
2022-03-01 19:03:06 +01:00
Marcin Rataj
caba3b2643
feat: X-Ipfs-Roots for smarter HTTP caches (#8720) 2022-03-01 09:04:31 -08:00
Marten Seemann
3674b662db add a test case for libp2p option prioritization 2022-02-28 15:26:06 +04:00
Marten Seemann
ec46f1e6e4 fix prioritization of stream muxers 2022-02-25 11:44:47 +04: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
Lucas Molas
898065e09c
chore(cmds): encapsulate ipfs rm logic in another function (#8574) 2022-02-15 17:30:47 -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
Manuel Alonso
edb32ac3d7
chore(gateway): debug logging for the http requests (#8518)
* chore(gateway): better logging for the http requests

* chore(gateway): removed defer and add more data to the final log

* chore(gateway): debug logging refactor

* chore(gateway): use debug w/o context when only msg

* doc: add cmd for log level

* chore: add more logs and address fedback

* chore(gateway): log subdomains and from=requestURI, refactor

* chore(gateway): fix debug redirect
2022-02-15 17:13:09 -05:00
Thibault Meunier
a93907a40f
feat: DNS.MaxCacheTTL for DNS-over-HTTPS resolvers (#8615)
* feat: Add MaxCacheTTL option for DNS-over-HTTPS resolvers
* Update libp2p/go-doh-resolver dependencies to support Options
* feat: Add `DNS.MaxCacheTTL` config documentation
* docs: DNS.MaxCacheTTL
* chore: go-ipfs-config@v0.19.0
Co-authored-by: Gus Eggert <gus@gus.dev>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-02-10 22:26:14 +01: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
siiky
440394682a docs: fix typo 2022-01-14 11:36:03 -05:00
Adin Schmahmann
1a040b016d
Merge pull request #6816 from ipfs/feat/mh-backed-datastore
feat: switch to raw multihashes for blocks
2021-12-13 15:37:16 -05:00
Lucas Molas
9d197ca732
fix(corehttp): adjust peer counting metrics (#8577) 2021-12-02 17:03:00 -08:00
Steven Allen
7f27dbfd15 feat: switch to raw multihashes for blocks
Part of: https://github.com/ipfs/go-ipfs/issues/6815
2021-12-02 09:41:37 -05:00
Marten Seemann
48a6cac00b
feat: Swarm.EnableHolePunching flag (#8562)
* feat: use Swarm.EnableHolePunching flag within libp2p
* docs: Swarm.EnableHolePunching

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
2021-11-30 11:18:51 -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
mathew-cf
11404a9a03
fix: multiple subdomain gateways on same domain (#8556) 2021-11-23 18:11:37 +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
Marcin Rataj
52a747763f
docs: fix ipfs files cp examples (#8533) 2021-10-29 16:45:53 +02: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
Rod Vagg
9e8b6e5b50
chore: replace go-merkledag walk with go-ipld-prime traversal for dag export (#8506)
* chore: replace go-merkledag walk with go-ipld-prime traversal for dag export

This is "safe" now because we can limit duplicate block loads like
go-merkledag does and won't get trapped taking a long time for complex
DAGs. We can do this while we're using an exhaustive selector (like
ExploreAll here) but will need an alternative strategy when we go for
arbitrary selectors.
2021-10-26 14:07:31 -04:00
Steve Loeppky
8836a62438
Merge pull request #8457 from ipfs/docs/raw-leaves-in-cidv1 2021-10-14 08:42:23 -07:00
Steven Allen
9f03f1ff14 fix(unixfs): check for errors before dereferencing the link
If there's an error, the link will be nil, and this will panic.
2021-10-12 12:39:39 -07:00
Marcin Rataj
545571c328
Apply suggestions from code review
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
2021-10-11 20:36:06 +02: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
Petar Maymounkov
f50d43eb0d
add more logging to flaky TestPeersTotal
Cannot reproduce the flakiness at the moment. The report suggests that connections are established on different transports. Adding logging to show what these transports are.
2021-10-04 08:49:39 -07: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
Marten Seemann
2589e1f65e enable the legacy mDNS implementation 2021-09-27 17:50:00 -04:00