1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-23 09:52:08 +08:00

37 Commits

Author SHA1 Message Date
eb6cc02c06 feat(config): connmgr: expose silence period (#10827) 2025-06-17 15:55:57 +02:00
56c68a1657 refactor: update to go-libp2p v0.37.0 (#10554)
https://github.com/libp2p/go-libp2p/releases/tag/v0.37.0

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2024-10-23 01:31:40 +02:00
d1db95c447 config: remove all options that are marked as REMOVED
Most of the removed options are many years old. In addition, they've all been removed in past iterations of Kubo. Some options were marked as removed in the config.md, but we still had a warning in the code to let users know they have been removed.

I think it's been long enough for all of this options, and enough Kubo iterations in order to alert the users. It is good to keep it in the config.md for now so that people can actually check. However, I think it's time to remove them from the code itself.
2024-01-22 15:33:27 +01:00
9f3251c1b0 feat: add WebRTC Direct support 2023-11-03 14:43:42 +01:00
Kay
f12b372af9 style: gofumpt and godot [skip changelog] (#10081) 2023-08-17 14:02:08 +02:00
f805b9fcda feat: allow users to optin again into mplex
This is a partial revert of 7220409394005c85509448217686e79b1779554b.

Closes #9958
2023-08-15 14:53:44 +02:00
7986196414 feat: Reduce RM code footprint
Co-Authored-By: Antonio Navarro Perez <antnavper@gmail.com>
2023-03-06 12:46:58 +01:00
0ff406170d fix: update rcmgr for go-libp2p v0.25 2023-02-14 22:19:46 +01:00
e34c0da2b5 refactor(config): remove Swarm.ConnMgr defaults
This moves defaults to Kubo code, cleaning up config.
If value is in config, we assume it is an explicit choice made by user.
Makes migrations easier.
2022-11-15 20:26:59 +01:00
1d5e46ac97 fix(config): skip nulls in ResourceMgr 2022-11-14 19:25:07 +01:00
254d81a9d5 feat: Improve ResourceManager UX (#9338)
This PR adds several new functionalities to make easier the usage of ResourceManager:

- Now resource manager logs when resources are exceeded are on ERROR instead of warning.
- The resources exceeded error now shows what kind of limit was reached and the scope.
- When there was no limit exceeded, we print a message for the user saying that limits are not exceeded anymore.
- Added `swarm limit all` command to show all set limits with the same format as `swarm stats all`
- Added `min-used-limit-perc` option to `swarm stats all` to only show stats that are above a specific percentage
- Simplify a lot default values.
- **Enable ResourceManager by default.**

Output example:
```
2022-11-09T10:51:40.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:51:50.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 483095 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:51:50.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:00.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 455294 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:00.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:10.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 471384 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:10.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 8 times with error "peer:12D3KooWKqcaBtcmZKLKCCoDPBuA6AXGJMNrLQUPPMsA5Q6D1eG6: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 192 times with error "peer:12D3KooWPjetWPGQUih9LZTGHdyAM9fKaXtUxDyBhA93E3JAWCXj: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 469746 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:30.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 484137 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:30.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 29 times with error "peer:12D3KooWPjetWPGQUih9LZTGHdyAM9fKaXtUxDyBhA93E3JAWCXj: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:30.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:40.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 468843 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:40.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:52:50.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 366638 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:52:50.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:53:00.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 405526 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:53:00.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 107 times with error "peer:12D3KooWQZQCwevTDGhkE9iGYk5sBzWRDUSX68oyrcfM9tXyrs2Q: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:53:00.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:53:10.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 336923 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:53:10.566+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:53:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:55      Resource limits were exceeded 71 times with error "transient: cannot reserve inbound stream: resource limit exceeded".
2022-11-09T10:53:20.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:59      Consider inspecting logs and raising the resource manager limits. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgr
2022-11-09T10:53:30.565+0100    ERROR   resourcemanager libp2p/rcmgr_logging.go:64      Resrouce limits are no longer being exceeded.

```
## Validation tests

- Accelerated DHT client runs with no errors when ResourceManager is active. No problems were observed.
- Running an attack with 200 connections and 1M streams using yamux protocol. Node was usable during the attack. With ResourceManager deactivated, the node was killed by the OS because of the amount of memory consumed.
	- Actions done when the attack was active:
		- Add files 
		- Force a reprovide
		- Use the gateway to resolve an IPNS address.

It closes #9001 
It closes #9351
It closes #9322
2022-11-10 12:25:57 +01:00
8baec10146 feat: add webtransport as an optin transport 2022-09-23 19:50:55 +02:00
196887cbe5 chore: bump go-libp2p v0.22.0 & go1.18&go1.19
Fixes: #9225
2022-09-09 17:09:38 +02:00
2b2efc662b Add allowlist config option 2022-08-15 14:12:21 -07:00
c3589a1728 WIP rcmgr auto limit scaling 2022-08-15 14:12:18 -07:00
3d527753ff feat: enable Resource Manager by default 2022-05-04 14:08:37 -04:00
74aff245d2 feat: persist limits to Swarm.ResourceMgr.Limits (#8901)
* feat: persist limit changes to config

This changes the "ipfs swarm limit" command so that when limit changes
are applied via the command line, they are persisted to the repo
config, so that they remain in effect when the daemon restarts.

Any existing limit.json can be dropped into the IPFS config easily
using something like:

cat ~/.ipfs/config | jq ".Swarm.ResourceMgr.Limits = $(cat limit.json)" | sponge ~/.ipfs/config

This also upgrades to Resource Manager v0.3.0, which exports the config
schema so that we don't have to maintain our own copy of it.

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-28 15:27:16 +02:00
514411bedb feat: opt-in Swarm.ResourceMgr (go-libp2p v0.18) (#8680)
* update go-libp2p to v0.18.0

* initialize the resource manager

* add resource manager stats/limit commands

* load limit file when building resource manager

* log absent limit file

* write rcmgr to file when IPFS_DEBUG_RCMGR is set

* fix: mark swarm limit|stats as experimental

* feat(cfg): opt-in Swarm.ResourceMgr

This ensures we can safely test the resource manager without impacting
default behavior.

- Resource manager is disabled by default
    - Default for Swarm.ResourceMgr.Enabled is false for now
- Swarm.ResourceMgr.Limits allows user to tweak limits per specific
  scope in a way that is persisted across restarts
- 'ipfs swarm limit system' outputs human-readable json
- 'ipfs swarm limit system new-limits.json' sets new runtime limits
  (but does not change Swarm.ResourceMgr.Limits in the config)

Conventions to make libp2p devs life easier:
- 'IPFS_RCMGR=1 ipfs daemon' overrides the config and enables resource manager
- 'limit.json' overrides implicit defaults from libp2p (if present)

* docs(config): small tweaks

* fix: skip libp2p.ResourceManager if disabled

This ensures 'ipfs swarm limit|stats' work only when enabled.

* fix: use NullResourceManager when disabled

This reverts commit b19f7c9eca4cee4187f8cba3389dc2c930258512.
after clarification feedback from
https://github.com/ipfs/go-ipfs/pull/8680#discussion_r841680182

* style: rename IPFS_RCMGR to LIBP2P_RCMGR

preexisting libp2p toggles use LIBP2P_ prefix

* test: Swarm.ResourceMgr

* fix: location of opt-in limit.json and rcmgr.json.gz

Places these files inside of IPFS_PATH

* Update docs/config.md

* feat: expose rcmgr metrics when enabled (#8785)

* add metrics for the resource manager
* export protocol and service name in Prometheus metrics
* fix: expose rcmgr metrics only when enabled

Co-authored-by: Marcin Rataj <lidel@lidel.org>

* refactor: rcmgr_metrics.go

* refactor: rcmgr_defaults.go

This file defines implicit limit defaults used when Swarm.ResourceMgr.Enabled

We keep vendored copy to ensure go-ipfs is not impacted when go-libp2p
decides to change defaults in any of the future releases.

* refactor: adjustedDefaultLimits

Cleans up the way we initialize defaults and adds a fix for case
when connection manager runs with high limits.

It also hides `Swarm.ResourceMgr.Limits` until we have a better
understanding what syntax makes sense.

* chore: cleanup after a review

* fix: restore go-ipld-prime v0.14.2

* fix: restore go-ds-flatfs v0.5.1

Co-authored-by: Lucas Molas <schomatis@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2022-04-07 21:06:35 -04:00
6c6a55056d Fix typos 2022-03-18 00:58:36 +01:00
ded27a5473 go-ipfs-config: feat: omitempty Swarm.EnableRelayHop for circuit v1 migration (#157)
* re-add the Swarm.EnableRelayHop option
* make Swarm.EnableRelayHop omitempty

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-11-23 18:45:11 +01:00
5ca8226610 go-ipfs-config: chore: update comment to match struct 2021-11-18 01:35:49 +01:00
7fe155c287 go-ipfs-config: feat: add a flag to enable the hole punching service (#155)
* add a flag to enable the hole punching service
* chore: omitempty EnableHolePunching

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-11-16 11:55:46 +01:00
aefce5a6cd go-ipfs-config: refactor: AutoRelay → RelayClient
https://github.com/ipfs/go-ipfs-config/pull/154#discussion_r749324695
2021-11-15 15:45:55 +01:00
bf3a2ca8de go-ipfs-config: set Swarm.EnableAutoRelay to omitempty
Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-11-15 17:34:58 +04:00
dcf17eb24a go-ipfs-config: improve AutoRelay configuration, add config option for static relays 2021-11-14 16:58:03 +04:00
d2268793dc go-ipfs-config: feat: Swarm.RelayService (circuit v2) (#146)
* remove the EnableRelayHop option in the SwarmConfig

* add an option to disable the limited relay

* make the relay service resources configurable

* refactor: use custom types

This enables us to swap defaults in go-ipfs without touching the config
file generated during `ipfs init`

https://github.com/ipfs/go-ipfs-config/pull/146#discussion_r734728162
https://github.com/ipfs/go-ipfs-config/pull/146#discussion_r734728019

* use OptionalDuration in RelayService configuration

* fix: *OptionalInteger with omitempty

This removes null values from the config

* fix: Flag does not need to be a pointer

* refactor: flatten RelayService limits

this simplifies consumer code and removes nil footgun

* docs: clarify different relay types

* feat: flag for ForceReachability mode in libp2p (#150)

adds Internal.Libp2pForceReachability
needed for sharness tests in ipfs/go-ipfs#8522

Co-authored-by: Marcin Rataj <lidel@lidel.org>

Co-authored-by: Marcin Rataj <lidel@lidel.org>
2021-11-13 03:07:14 -08:00
f55b515255 go-ipfs-config: doc(swarm): extend autorelay docs 2020-06-15 19:57:41 -07:00
f74d15eacf go-ipfs-config: fix: fix type name typo 2020-06-15 19:56:38 -07:00
0f17ef601f go-ipfs-config: doc(swarm): fix autorelay description
Co-authored-by: Adin Schmahmann <adin.schmahmann@gmail.com>
2020-06-15 19:55:50 -07:00
4f3aeb7428 go-ipfs-config: feat: add a transports section for enabling/disabling/prioritizing transports 2020-06-15 15:24:03 -07:00
4554fc9246 go-ipfs-config: feat: add an autonat config section
And remove the current EnableAutoNATService option from the swarm config. While
a breaking change, this shouldn't cause _too_ much trouble given that we're
going to enable AutoNAT everywhere by default anyways.
2020-04-14 19:05:01 -07:00
bf2923e47b go-ipfs-config: autorelay options 2018-11-26 17:37:50 -08:00
810c8e73a4 go-ipfs-config: Integrate connection manager
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2017-10-16 09:46:46 -07:00
b4973a585d go-ipfs-config: integrate circuit-relay transport
- enabled by default, so that we can dial/receive dials
- /p2p-circuit/QmId address is not announced; filtered at host with AddrsFactory
- use case is manual swarm connect with relay address

License: MIT
Signed-off-by: vyzo <vyzo@hackzen.org>
2017-08-16 09:26:49 +03:00
0d70e835d7 go-ipfs-config: Add DisableNatPortMap option.
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
2017-03-18 18:50:10 -04:00
07559a265a go-ipfs-config: add config option to disable bandwidth metrics
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-11-11 10:31:24 -08:00
3861ff304e go-ipfs-config: config: DialBlocklist -> Swarm.AddrFilters
This commit changes the DialBlocklist key to be under the key
Swarm.AddrFilters instead.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-02 16:11:46 -07:00