1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-17 23:16:11 +08:00

758 Commits

Author SHA1 Message Date
9210c08fa6 Remove gobindata
Since go1.16, there are built in tools that allow for embeding
filesystem inside the binary. We now make use of the `embed` package to
have all files put into the binary, removing the need to generate the
files and removes dependencies

Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
2022-04-12 02:36:19 +02:00
9bd346e250 fix: fix context plumbing in gateway handlers (#8871)
This ensures that child contexts are passed around between
the handlers so that traces show the call hierarchy correctly.
2022-04-11 23:09:00 +02:00
52bf133946 fix(gw): missing return if dir fails to finalize (#8806) 2022-04-08 23:09:23 +02:00
fbf76663f4 fix(gw): update metrics only when payload data sent (#8827)
* fix: report gateway http metrics only when response is successful
* fix(gw): 304 Not Modified as no-op

This fix ensures we don't do any additional work when Etag match
what user already has in their own cache.

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-08 22:07:44 +02:00
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
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
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
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
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
0487f03eae feat: add endpoint for enabling block profiling (#8469) 2022-03-11 14:32:59 -05:00
8d549f03f3 fix: rewrite dependencies over the go-ipfs-config package 2022-03-04 09:45:16 +01:00
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
caba3b2643 feat: X-Ipfs-Roots for smarter HTTP caches (#8720) 2022-03-01 09:04:31 -08:00
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
9d197ca732 fix(corehttp): adjust peer counting metrics (#8577) 2021-12-02 17:03:00 -08:00
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
11404a9a03 fix: multiple subdomain gateways on same domain (#8556) 2021-11-23 18:11:37 +01:00
0c2f9d5950 Fix typos (#8548) 2021-11-17 21:16:06 +01:00
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
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
6a10c1df81 feat: ipfs-webui v2.13.0 (#8430)
Release Notes: https://github.com/ipfs/ipfs-webui/releases/tag/v2.13.0
2021-09-21 20:36:27 +02:00
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
c95d6ca08c update go-libp2p to v0.15.0-rc.1 2021-08-19 18:05:04 +02:00
7c76118b0b Merge pull request #8318 from ipfs/fix/path-panic
fix: avoid out of bounds error when rendering short hashes
2021-08-13 14:54:25 -07:00
02823935aa feat: register first block metric by default 2021-08-07 15:48:22 -04:00
66a76d27f3 fix: abort when we fail to resolve CIDs
I believe we figured that these were for "informational purposes", but
really, we _should_ always be able to resolve names to CIDs. If we
can't, there's probably something wrong with the directory.
2021-07-30 11:36:23 -07:00
0858dc62aa fix: avoid panic on short hash
(caught higher up but should still be fixed)
2021-07-30 11:33:53 -07:00
c7444fb61a feat: webui v2.12.4 2021-07-15 08:21:50 -07:00
2c431eb825 fix: webui-2.12.3
This bumps webui to bugfix release based on feedback from 0.9.0-rc1:
https://github.com/ipfs/ipfs-webui/releases/tag/v2.12.3
2021-05-24 08:25:40 -07:00
28d4d9b327 refactor: add isDomainNameAndNotPeerID
This ensures we exclude valid PeerIDs from code paths that require
DNSLink names.

Ref.
https://github.com/ipfs/go-ipfs/pull/8071#pullrequestreview-639409245
2021-05-13 10:54:40 -04:00
24dd662d38 feat support non-ICANN DNS 2021-05-13 10:54:38 -04:00
473d7d5851 update quic-go to v0.21.0-rc.1 2021-05-12 19:17:52 -04:00
a9868105f0 feat: ipfs-webui v2.12.2
https://github.com/ipfs/ipfs-webui/releases/tag/v2.12.2
2021-04-30 16:12:21 +02:00
a006ded010 chore: update webui to 2.12.1 2021-04-28 11:00:45 -07:00
9f8964e6f9 fix(gw): remove hardcoded hostnames
This closes #7317 by removing hardcoded PL hostnames from default
config, making the localhost the only implicit gateway hostname.
2021-04-12 18:03:44 +02:00
4cdb67f37d Merge pull request #7890 from ipfs/fix/remove-clear-site-data
fix(gw): remove use of Clear-Site-Data in subdomain router
2021-03-31 16:24:24 -07:00
0a3f88823c Merge pull request #7994 from ipfs/chore/deprecate-pathprefixes
chore: deprecate Gateway.PathPrefixes
2021-03-30 15:52:02 -07:00
2f105f79b9 chore: deprecate Gateway.PathPrefixes
Context:
https://github.com/ipfs/go-ipfs/issues/7702#issuecomment-803136077
2021-03-30 21:17:41 +02:00
d30f1e5d44 Merge pull request #7930 from ipfs/fix/redundant-ns-on-gateway
feat(gw): /ipfs/ipfs/{cid} → /ipfs/{cid}
2021-03-24 13:12:16 -07:00
763a120ed2 fix: no fixup if X-Ipfs-Gateway-Prefix is present
https://github.com/ipfs/go-ipfs/pull/7930#discussion_r597976690
2021-03-20 00:00:58 +01:00
a35ffee136 refactor: safer query handling
https://github.com/ipfs/go-ipfs/pull/7930#discussion_r597246135
2021-03-18 23:48:53 +01:00
450baef0e9 refactor: explicit prefix check
https://github.com/ipfs/go-ipfs/pull/7930#discussion_r584001161
2021-03-18 21:48:04 +01:00
b81b7549d3 refactor: addressing review
- moved to separate utility function
- return Bad Request error
- improved escaping of values passed via URL path
2021-03-18 21:22:07 +01:00
4ba03fa8df revert registration of metrics against unexposed prom registry 2021-03-17 10:15:42 +10:00
3db9551f79 Extract the namesys and the keystore submodules
Namesys is a very useful submodule. Given a ValueStore and a Datastore it can
resolve and publish /ipns/ paths.

This functionality does not need to be sequestered inside go-ipfs as it can
and should be used without IPFS, for example, for implementing lightweight
IPNS publishing services or for resolving /ipns/ paths.

"keystore" extraction was necessary, as there is a dependency to it in
namesys. Keystore is also a useful module by itself within the stack.

Fixes #6537
2021-03-12 14:09:36 -05:00
dae7387584 refactor: show error, delay redirect
This implements error page that does not hide the problem,
but still redirects to a valid path after short delay:
https://github.com/ipfs/go-ipfs/pull/7930#issuecomment-786882748
2021-02-27 00:57:05 +01:00
15e3732afd feat(gw): /ipfs/ipfs/{cid} → /ipfs/{cid}
This will try to recover from invalid paths like  /ipfs/ipfs/{cid}
and redirect to proper one, when possible.
2021-02-20 00:09:17 +01:00
d61ae2bcb4 fix: remove use of Clear-Site-Data
We used Clear-Site-Data to cushion transition period for local gateway
exposed at http://localhost while we were still figuring out
security-related details.

In the final implementation subdomain gateways are not tied to a
hostname explicitly, which removes the risk of cookies leaking,
removing the need for the header.

Turns out it causes issues for Firefox users, so let's just remove it.

Closes https://github.com/ipfs-shipyard/ipfs-companion/issues/977
2021-01-29 22:08:16 +01:00
a0f90d3a14 test: cover 2 remaining lines 2021-01-14 20:53:20 +01:00
abb25a1cfc refactor: remove redundant urlescape
URL.Query() will already decode the query parameters
2021-01-14 20:52:04 +01:00