1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-12-19 01:30:17 +08:00
Commit Graph

131 Commits

Author SHA1 Message Date
Andrew Gillis
20d9660a64 chore: use go-log/v2 (#10801)
* chore: update to go-log/v2

go-log v2 has been out for quite a while now and it is time to deprecate v1.

Replace all use of go-log with go-log/v2
Makes /api/v0/log/tail useful over HTTP
Updates dependencies that have moved to go-lov/v2
Removes support for ContextWithLoggable as this is not needed for tracing-like functionality
- Replaces: PR #8765
- Closes issue #8753
- Closes issue #9245
- Closes issue #10809

Other fixes:
* update go-ipfs-cmds
* update http logs test
* fix test
* Read/send one line of log data at a time
* Update -log-level docs
2025-05-19 13:04:05 -07:00
Andrew Gillis
472674fd62 feat(pebble): support pinning FormatMajorVersion (#10789)
* Upgrade to pebble v2.0.3

- Configure latest pebble database format at init
- Do not automatically ratchet database format if set in config
- Daemon messge about new available pebble format
- Document pebble config with formatMajorVersion
- Add warning to users running badger, nudging them to switch to flatfs or pebble
- docs: explain Pebble's `FormatMajorVersion`
- Use pebbleds instead of badgerds in t0060-daemon.sh
- Print badgerds warning message to stderr
2025-04-30 12:13:56 -07:00
Andrew Gillis
e41dc120f7 Update pebble db to latest format by default (#10720)
* Update pebble db to latest format by default

If the pebble database format is not explicitly set in the config, then set it to the latest format version by default. This will ensure that the database format is sufficiently up-to-date to be compatible with a major version upgrade of pebble.
2025-02-17 15:32:53 -08:00
Russell Dempsey
40a7a388a4 fix: switch away from IPFS_LOG_LEVEL (#10694) 2025-02-14 18:25:31 +00:00
Andrew Gillis
4009ad3e5a chore: stop using go-homedir (#10568)
* chore: stop using go-homedir

The `github.com/mitchellh/go-homedir` repo is archived, no longer needed, and no longer maintained.

- `homedir.Dir` is replaced by the stdlib `os.UserHomeDir`
- `homedir.Expand` is replaced by fsutil.ExpandHome` in the `github.com/ipfs/kubo/misc/fsutil` package.

Additional functionality, such as `DirWritable` and `FileExists` was moved into or included in the `github.com/ipfs/kubo/misc/fsutil` package.
2024-11-05 07:45:11 -08:00
Andrew Gillis
52b00624cd feat: pebbleds profile and plugin (#10530)
* include pebble as built-in plugin

Pebble provides a high-performance alternative to leveldb as the datastore, and will serve as a replacement for badger1.

There are a number of tuning parameters available for tuning pebble's performance to your specific needs. Default values are used for any that are not configured or are set to the parameter's zero-value.

Requires https://github.com/ipfs/go-ds-pebble/pull/39

Closes #10347

* docs: remove mention of ipfs-ds-convert. Rationale: https://github.com/ipfs/ipfs-ds-convert/issues/50
* docs: pebbleds profile
* test: meaningful t0025-datastores.sh
* Update config/init.go
* Update docs/config.md
* Do not hard-code zero values into pebble config
2024-10-03 13:58:14 -07:00
fengzie
a17830754c Fix issue in ResourceManager and nopfsPlugin about repo path (#10492) 2024-09-28 20:58:24 -07:00
Marcin Rataj
2260e35df2 chore: upgrade to go 1.23 (#10486)
* chore: upgrade to go 1.23

https://tip.golang.org/doc/go1.23

* refactor: golangci-lint v1.60.2
2024-08-28 18:56:45 +02:00
Henrique Dias
58c29399cf chore: clean migration 2023-11-29 12:29:59 +01:00
Hector Sanjuan
a0f34b16dd feat: built-in content blocking based on IPIP-383 (#10161)
Fixes #8492

This introduces "nopfs" as a preloaded plugin into Kubo
with support for denylists from https://github.com/ipfs/specs/pull/383

It automatically makes Kubo watch *.deny files found in:

- /etc/ipfs/denylists
- $XDG_CONFIG_HOME/ipfs/denylists
- $IPFS_PATH/denylists

* test: Gateway.NoFetch and GatewayOverLibp2p

adds missing tests for "no fetch" gateways one can expose,
in both cases the offline mode is done by passing custom
blockservice/exchange into path resolver, which means
global path resolver that has nopfs intercept is not used,
and the content blocking does not happen on these gateways.

* fix: use offline path resolvers where appropriate

this fixes the problem described in
https://github.com/ipfs/kubo/pull/10161#issuecomment-1782175955
by adding explicit offline path resolvers that are backed
by offline exchange, and using them in NoFetch gateways
instead of the default online ones

---------

Co-authored-by: Henrique Dias <hacdias@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2023-10-28 05:34:14 +02:00
Icarus9913
9fdb085605 refactor: stop using go-libp2p deprecated peer.ID.Pretty
Signed-off-by: Icarus9913 <icaruswu66@qq.com>
2023-09-18 15:58:15 +02:00
Kay
f12b372af9 style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
Jorropo
f2a6c4f764 fix: correctly handle migration of configs
readPluginsConfig was copied from ReadMigrationConfig and switched
erroring fields to a bool so it can be omitemptied.
2023-06-27 16:32:06 +02:00
Michael Muré
99fdaa1b4d plugin: fix non-deterministic loading order
fix #9909
2023-05-31 18:28:38 +02:00
Jorropo
3ab1086f71 chore: migrate go-libipfs to boxo
Resolves #9677, #9676, #9675, #9736
2023-03-28 22:05:25 -04:00
Jorropo
196887cbe5 chore: bump go-libp2p v0.22.0 & go1.18&go1.19
Fixes: #9225
2022-09-09 17:09:38 +02:00
Jorropo
82fbb84384 fmt: applies go1.19 fmt 2022-09-08 18:34:06 +02:00
Gus Eggert
310dca55dd feat: add fx options plugin
This adds a plugin interface that lets the plugin modify the fx
options that are passed to fx when the app is initialized. This means
plugins can inject their own implementations of IPFS interfaces. This
enables granular customization of go-ipfs behavior by plugins, such
as:

- Bitswap with custom filters (e.g. for CID blocking) Custom interface

- implementations such as Pinner or DAGService

- Dynamic configuration of libp2p ...

One downside of this is that we're exposing the entire dependency
graph, init hooks, initialization, etc. to users, so this comes with a
caveat that we reserve the right to make breaking changes to the graph
structure and initialization logic (although this historically happens
rarely). If these things are changed, we should mention them in
release notes and changelogs though, since they could impact users of
this plugin interface.

I'm not particularly fond of DI frameworks (and neither are some of
the folks work on/near go-ipfs), but it seems unlikely that somebody
will rewrite the dependency wiring and lifecycle hooks of go-ipfs, and
add dynamic extension points, so this seems like a palatable
compromise.

There are also problems that we should clean up in how model the
go-ipfs app in fx, such as:

- We make extensive use of nested fx.Options, which fx itself
discourages because it "limits the user's ability to customize their
application". It should be easy to flatten these out into a single
[]fx.Option slice.

- We pass around a list of opaque libp2p opts, which makes it hard to
customize after-the-fact...we should consider naming each of these
opts and providing them to fx as proper dependencies, so that they can
be explicitly overridden.

- We call fx.Invoke() in some places with anonymous functions. We
should instead only pass exported functions to fx.Invoke(), so that
they have exported names, which would make it easier to remove/augment
the invocations that happen when the app is initialized.

These aren't blocking issues, they just make it harder and more
brittle to customize go-ipfs with this plugin.
2022-08-12 17:04:29 -04:00
Marcin Rataj
82467bc936 refactor: rename to kubo 2022-07-06 18:40:37 +02:00
Adin Schmahmann
1f37a1481b go fmt 2022-05-03 14:09:38 -04:00
Adin Schmahmann
d59730f51e Update Go version to 1.17 (#8815)
* remove building the pre-bundled plugins as shared objects in makefile

* chore: update go version to minimum of 1.17
2022-04-15 14:32:00 -04:00
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
Laurent Senta
8d549f03f3 fix: rewrite dependencies over the go-ipfs-config package 2022-03-04 09:45:16 +01: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
Dimitris Apostolou
0c2f9d5950 Fix typos (#8548) 2021-11-17 21:16:06 +01:00
Steven Allen
852684914a fix: allow the levelds compression level to be unspecified
Otherwise, the user will get a confusing panic. And given that we
support "", we might as well support nil.
2021-10-15 11:44:54 -04:00
guseggert
ae09459e39 chore: add comments to peerlog plugin about being unsupported
and also about the ugly config semantics
2021-08-25 19:02:51 +00:00
guseggert
c3ac1b4282 test: add unit tests for peerlog config parsing 2021-08-25 19:02:51 +00: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
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
Gus Eggert
db2684f388 Merge branch 'master' into update-go-on-ci-guseggert 2021-08-02 14:42:32 -04:00
godcong
8c337160ac fix document error 2021-07-17 17:20:58 +08:00
Marten Seemann
a9dfe38c4b stop using deprecated Go flag -i 2021-05-15 17:27:52 -07:00
lanzafame
3d9821260a register quic opencensus metrics 2020-12-08 20:22:38 -05:00
Tomasz Zdybał
6b83bcd60e Add missing plugin support on FreeBSD
Go plugins are supported on FreeBSD, but build tags in
`plugin/loader/load_*.go` enable IPFS plugins only on Linux and Darwin.
2020-10-12 00:54:23 +02:00
Steven Allen
c07b6fb1d1 feat: nice errors when failing to load plugins
partially fixes #7305
2020-08-08 22:53:18 -04:00
Steven Allen
0cc3d7a1f4 doc(plugin): document plugin config
fixes #7308
2020-05-12 21:56:02 -07:00
Steven Allen
a10a14fc06 feat(peerlog): add a bit of backoff logic 2020-04-27 20:26:39 -07:00
Steven Allen
bdbb79d30f fix: non-blocking peerlog logging
Avoid ever blocking new connections in the peer logger. Instead:

1. Send all new peers to a highly buffered channel.
2. Emit "dropped event" errors whenever we detect that we're dropping events and falling behind.
3. Don't log protocols, they're too large.
4. Don't log disconnects, we don't need them.
2020-04-27 19:15:25 -07:00
Dimitris Apostolou
1e437c7e97 Fix typos and cleanup 2020-04-20 22:00:01 +03:00
Steven Allen
255fefb2aa feat(peerlog): log protocols/versions 2020-03-10 09:33:11 -07:00
Oli Evans
aa3ca14197 feat: pass IPFS_PLUGINS to docker build
- allow IPFS_PLUGINS build-arg to be passed to docker build command
- remove annoying logging from peerlog plugin that appears multiple times in docker logs

usage:

  docker build --build-arg IPFS_PLUGINS="foo bar baz"

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
2020-02-13 14:39:58 +00:00
Steven Allen
15085fd1a3 fix(plugin): check log error 2020-02-10 13:09:00 -08:00
Steven Allen
58e52f351d feat: make it possible to enable plugins with a build env variable 2020-02-10 13:05:32 -08:00
Steven Allen
0ab1fa18da fix: disable preloading the logger plugin by default 2020-02-10 12:54:55 -08:00
Oli Evans
edfe9c5efd feat: add peerlog plugin
adds a plugin to log just peerIDs for nodes we connect to, to allow us to see how many unique peers a node connects to over time.

It's set up a preloaded plugin, so it would be enabled by default. We may want to extract it to a seperate repo so we can make it an optional add on.

**Usage**

```console
$ GOLOG_FILE=~/peer.log IPFS_LOGGING_FMT=json ipfs daemon
```

**output**

```json
{"level":"info","ts":"2020-02-10T13:54:26.639Z","logger":"plugin/peerlog","caller":"peerlog/peerlog.go:51","msg":"connected","peer":"QmS2H72gdrekXJggGdE9SunXPntBqdkJdkXQJjuxcH8Cbt"}
{"level":"info","ts":"2020-02-10T13:54:59.095Z","logger":"plugin/peerlog","caller":"peerlog/peerlog.go:56","msg":"disconnected","peer":"QmS2H72gdrekXJggGdE9SunXPntBqdkJdkXQJjuxcH8Cbt"}
```

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
2020-02-10 14:05:16 +00:00
Oli Evans
d83e07ea90 wip: minimal plugin works
License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
2020-02-10 11:29:51 +00:00
Steven Allen
a53d48059b fix: migrate from deprecated warning function 2020-01-28 21:20:21 -08:00
Steven Allen
4e4d5aa742 fix(badgerds): turn off sync writes by default
We already do this in the datastore _profile_, but we should do this in the
plugin as well. I'm pretty sure this makes absolutely no difference.
2020-01-09 09:55:39 +01:00
Michael Muré
2a9e5005da plugins: introduce PluginDaemonInternal to directly interact with IpfsNode 2019-11-22 13:18:44 +01:00