Skip to content

Commit b84e296

Browse files
authored
Merge branch 'master' into docs-release-v0.17.0
2 parents 9281058 + 5283c6f commit b84e296

27 files changed

+832
-616
lines changed

.circleci/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ jobs:
224224
docker:
225225
- image: cimg/go:1.19.1-node
226226
parallelism: 4
227-
resource_class: large
227+
resource_class: 2xlarge+
228228
steps:
229229
- *make_out_dirs
230230
- attach_workspace:
@@ -324,6 +324,7 @@ jobs:
324324
- ~/.cache/go-build/
325325
ipfs-webui:
326326
executor: node-browsers
327+
resource_class: 2xlarge+
327328
steps:
328329
- *make_out_dirs
329330
- attach_workspace:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Kubo Changelogs
22

3+
- [v0.17](docs/changelogs/v0.17.md)
34
- [v0.16](docs/changelogs/v0.16.md)
45
- [v0.15](docs/changelogs/v0.15.md)
56
- [v0.14](docs/changelogs/v0.14.md)

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Note: when updating the go minor version here, also update the go-channel in snap/snapcraft.yml
21
FROM golang:1.19.1-buster
32
LABEL maintainer="Steven Allen <[email protected]>"
43

README.md

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## What is Kubo?
99

10-
Kubo was the first IPFS implementation and is the most widely used one today. Implementing the *Interplanetary Filesystem* - the Web3 standard and contender to replace https. Thus powered by IPLD's data models and the libp2p for network communication. Kubo is written in Go.
10+
Kubo was the first IPFS implementation and is the most widely used one today. Implementing the *Interplanetary Filesystem* - the Web3 standard for content-addressing, interoperable with HTTP. Thus powered by IPLD's data models and the libp2p for network communication. Kubo is written in Go.
1111

1212
Featureset
1313
- Runs an IPFS-Node as a network service
@@ -216,22 +216,7 @@ $ guix package -i go-ipfs
216216

217217
#### Snap
218218

219-
> ⚠️ **SNAP USE IS DISCOURAGED**
220-
>
221-
> If you want something more sophisticated to escape the Snap confinement, we recommend using a different method to install Kubo so that it is not subject to snap confinement.
222-
223-
224-
With snap, in any of the [supported Linux distributions](https://snapcraft.io/docs/core/install):
225-
226-
```
227-
$ sudo snap install ipfs
228-
```
229-
230-
The snap sets `IPFS_PATH` to `SNAP_USER_COMMON`, which is usually `~/snap/ipfs/common`. If you want to use `~/.ipfs` instead, you can bind-mount it to `~/snap/ipfs/common` like this:
231-
232-
```
233-
$ sudo mount --bind ~/.ipfs ~/snap/ipfs/common
234-
```
219+
No longer supported, see rationale in [kubo#8688](https://github.com/ipfs/kubo/issues/8688).
235220

236221
#### MacPorts
237222

@@ -266,11 +251,7 @@ $ brew install --formula ipfs
266251

267252
#### Chocolatey
268253

269-
[![Chocolatey Version](https://img.shields.io/chocolatey/v/go-ipfs?color=00a4ef&label=go-ipfs&logo=windows&style=flat-square&cacheSeconds=3600)](https://chocolatey.org/packages/go-ipfs)
270-
271-
```Powershell
272-
PS> choco install go-ipfs
273-
```
254+
No longer supported, see rationale in [kubo#9341](https://github.com/ipfs/kubo/issues/9341).
274255

275256
#### Scoop
276257

@@ -378,6 +359,10 @@ Basic proof of 'ipfs working' locally:
378359
# QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
379360
ipfs cat <that hash>
380361

362+
### HTTP/RPC clients
363+
364+
For programmatic interaction with Kubo, see our [list of HTTP/RPC clients](docs/http-rpc-clients.md).
365+
381366
### Troubleshooting
382367

383368
If you have previously installed IPFS before and you are running into problems getting a newer version to work, try deleting (or backing up somewhere else) your IPFS config directory (~/.ipfs by default) and rerunning `ipfs init`. This will reinitialize the config file to its defaults and clear out the local datastore of any bad entries.

config/init.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@ func InitWithIdentity(identity Identity) (*Config, error) {
7979
Interval: "12h",
8080
Strategy: "all",
8181
},
82-
Swarm: SwarmConfig{
83-
ConnMgr: ConnMgr{
84-
LowWater: DefaultConnMgrLowWater,
85-
HighWater: DefaultConnMgrHighWater,
86-
GracePeriod: DefaultConnMgrGracePeriod.String(),
87-
Type: "basic",
88-
},
89-
},
9082
Pinning: Pinning{
9183
RemoteServices: map[string]RemotePinningService{},
9284
},
@@ -114,6 +106,10 @@ const DefaultConnMgrLowWater = 600
114106
// grace period
115107
const DefaultConnMgrGracePeriod = time.Second * 20
116108

109+
// DefaultConnMgrType is the default value for the connection managers
110+
// type.
111+
const DefaultConnMgrType = "basic"
112+
117113
func addressesConfig() Addresses {
118114
return Addresses{
119115
Swarm: []string{

config/profile.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,13 @@ fetching may be degraded.
178178
c.AutoNAT.ServiceMode = AutoNATServiceDisabled
179179
c.Reprovider.Interval = "0"
180180

181-
c.Swarm.ConnMgr.LowWater = 20
182-
c.Swarm.ConnMgr.HighWater = 40
183-
c.Swarm.ConnMgr.GracePeriod = time.Minute.String()
181+
lowWater := int64(20)
182+
highWater := int64(40)
183+
gracePeriod := time.Minute
184+
c.Swarm.ConnMgr.Type = NewOptionalString("basic")
185+
c.Swarm.ConnMgr.LowWater = &OptionalInteger{value: &lowWater}
186+
c.Swarm.ConnMgr.HighWater = &OptionalInteger{value: &highWater}
187+
c.Swarm.ConnMgr.GracePeriod = &OptionalDuration{&gracePeriod}
184188
return nil
185189
},
186190
},

config/pubsub.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ type PubsubConfig struct {
1111

1212
// Enable pubsub (--enable-pubsub-experiment)
1313
Enabled Flag `json:",omitempty"`
14+
15+
// SeenMessagesTTL configures the duration after which a previously seen
16+
// message ID can be forgotten about.
17+
SeenMessagesTTL *OptionalDuration `json:",omitempty"`
1418
}

config/swarm.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ type Transports struct {
131131

132132
// ConnMgr defines configuration options for the libp2p connection manager
133133
type ConnMgr struct {
134-
Type string
135-
LowWater int
136-
HighWater int
137-
GracePeriod string
134+
Type *OptionalString `json:",omitempty"`
135+
LowWater *OptionalInteger `json:",omitempty"`
136+
HighWater *OptionalInteger `json:",omitempty"`
137+
GracePeriod *OptionalDuration `json:",omitempty"`
138138
}
139139

140140
// ResourceMgr defines configuration options for the libp2p Network Resource Manager
@@ -144,8 +144,8 @@ type ResourceMgr struct {
144144
Enabled Flag `json:",omitempty"`
145145
Limits *rcmgr.LimitConfig `json:",omitempty"`
146146

147-
MaxMemory OptionalString `json:",omitempty"`
148-
MaxFileDescriptors OptionalInteger `json:",omitempty"`
147+
MaxMemory *OptionalString `json:",omitempty"`
148+
MaxFileDescriptors *OptionalInteger `json:",omitempty"`
149149

150150
// A list of multiaddrs that can bypass normal system limits (but are still
151151
// limited by the allowlist scope). Convenience config around

core/node/groups.go

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,33 +38,20 @@ var BaseLibP2P = fx.Options(
3838
)
3939

4040
func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option {
41-
// parse ConnMgr config
42-
43-
grace := config.DefaultConnMgrGracePeriod
44-
low := config.DefaultConnMgrLowWater
45-
high := config.DefaultConnMgrHighWater
46-
47-
connmgr := fx.Options()
48-
49-
if cfg.Swarm.ConnMgr.Type != "none" {
50-
switch cfg.Swarm.ConnMgr.Type {
51-
case "":
52-
// 'default' value is the basic connection manager
53-
break
54-
case "basic":
55-
var err error
56-
grace, err = time.ParseDuration(cfg.Swarm.ConnMgr.GracePeriod)
57-
if err != nil {
58-
return fx.Error(fmt.Errorf("parsing Swarm.ConnMgr.GracePeriod: %s", err))
59-
}
60-
61-
low = cfg.Swarm.ConnMgr.LowWater
62-
high = cfg.Swarm.ConnMgr.HighWater
63-
default:
64-
return fx.Error(fmt.Errorf("unrecognized ConnMgr.Type: %q", cfg.Swarm.ConnMgr.Type))
65-
}
66-
41+
var connmgr fx.Option
42+
43+
// set connmgr based on Swarm.ConnMgr.Type
44+
connMgrType := cfg.Swarm.ConnMgr.Type.WithDefault(config.DefaultConnMgrType)
45+
switch connMgrType {
46+
case "none":
47+
connmgr = fx.Options() // noop
48+
case "", "basic":
49+
grace := cfg.Swarm.ConnMgr.GracePeriod.WithDefault(config.DefaultConnMgrGracePeriod)
50+
low := int(cfg.Swarm.ConnMgr.LowWater.WithDefault(config.DefaultConnMgrLowWater))
51+
high := int(cfg.Swarm.ConnMgr.HighWater.WithDefault(config.DefaultConnMgrHighWater))
6752
connmgr = fx.Provide(libp2p.ConnectionManager(low, high, grace))
53+
default:
54+
return fx.Error(fmt.Errorf("unrecognized Swarm.ConnMgr.Type: %q", connMgrType))
6855
}
6956

7057
// parse PubSub config
@@ -77,6 +64,7 @@ func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option {
7764
pubsubOptions = append(
7865
pubsubOptions,
7966
pubsub.WithMessageSigning(!cfg.Pubsub.DisableSigning),
67+
pubsub.WithSeenMessagesTTL(cfg.Pubsub.SeenMessagesTTL.WithDefault(pubsub.TimeCacheDuration)),
8068
)
8169

8270
switch cfg.Pubsub.Router {

core/node/libp2p/rcmgr.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,22 @@ func ResourceManager(cfg config.SwarmConfig) interface{} {
5252
return nil, opts, fmt.Errorf("opening IPFS_PATH: %w", err)
5353
}
5454

55-
limits, err := createDefaultLimitConfig(cfg)
55+
limitConfig, err := createDefaultLimitConfig(cfg)
5656
if err != nil {
5757
return nil, opts, err
5858
}
5959

60+
// The logic for defaults and overriding with specified SwarmConfig.ResourceMgr.Limits
61+
// is documented in docs/config.md.
62+
// Any changes here should be reflected there.
6063
if cfg.ResourceMgr.Limits != nil {
6164
l := *cfg.ResourceMgr.Limits
62-
l.Apply(limits)
63-
limits = l
65+
// This effectively overrides the computed default LimitConfig with any vlues from cfg.ResourceMgr.Limits
66+
l.Apply(limitConfig)
67+
limitConfig = l
6468
}
6569

66-
limiter := rcmgr.NewFixedLimiter(limits)
70+
limiter := rcmgr.NewFixedLimiter(limitConfig)
6771

6872
str, err := rcmgrObs.NewStatsTraceReporter()
6973
if err != nil {

core/node/libp2p/rcmgr_defaults.go

Lines changed: 27 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -44,51 +44,8 @@ var noLimitIncrease = rcmgr.BaseLimitIncrease{
4444
// This file defines implicit limit defaults used when Swarm.ResourceMgr.Enabled
4545

4646
// createDefaultLimitConfig creates LimitConfig to pass to libp2p's resource manager.
47-
// libp2p's resource manager provides tremendous flexibility but also adds a lot of complexity.
48-
// The intent of the default config here is to provide good defaults,
49-
// and where the defaults aren't good enough,
50-
// to expose a good set of higher-level "knobs" to users to satisfy most use cases
51-
// without requiring users to wade into all the intricacies of libp2p's resource manager.
52-
//
53-
// The inputs one can specify in SwarmConfig are:
54-
// - cfg.ResourceMgr.MaxMemory: This is the max amount of memory in bytes to allow libp2p to use.
55-
// libp2p's resource manager will prevent additional resource creation while this limit is hit.
56-
// If this value isn't specified, 1/8th of the total system memory is used.
57-
// - cfg.ResourceMgr.MaxFileDescriptors: This is the maximum number of file descriptors to allow libp2p to use.
58-
// libp2p's resource manager will prevent additional file descriptor consumption while this limit is hit.
59-
// If this value isn't specified, the maximum between 1/2 of system FD limit and 4096 is used.
60-
// - Swarm.ConnMgr.HighWater: If a connection manager is specified, libp2p's resource manager
61-
// will allow 2x more connections than the HighWater mark
62-
// so the connection manager has "space and time" to close "least useful" connections.
63-
//
64-
// With these inputs defined, limits are created at the system, transient, and peer scopes.
65-
// Other scopes are ignored (by being set to infinity).
66-
// The reason these scopes are chosen is because:
67-
// - system - This gives us the coarse-grained control we want so we can reason about the system as a whole.
68-
// It is the backstop, and allows us to reason about resource consumption more easily
69-
// since don't have think about the interaction of many other scopes.
70-
// - transient - Limiting connections that are in process of being established provides backpressure so not too much work queues up.
71-
// - peer - The peer scope doesn't protect us against intentional DoS attacks.
72-
// It's just as easy for an attacker to send 100 requests/second with 1 peerId vs. 10 requests/second with 10 peers.
73-
// We are reliant on the system scope for protection here in the malicious case.
74-
// The reason for having a peer scope is to protect against unintentional DoS attacks
75-
// (e.g., bug in a peer which is causing it to "misbehave").
76-
// In the unintional case, we want to make sure a "misbehaving" node doesn't consume more resources than necessary.
77-
//
78-
// Within these scopes, limits are just set on memory, FD, and inbound connections/streams.
79-
// Limits are set based on the inputs above.
80-
// We trust this node to behave properly and thus ignore outbound connection/stream limits.
81-
// We apply any limits that libp2p has for its protocols/services
82-
// since we assume libp2p knows best here.
83-
//
84-
// This leaves 3 levels of resource management protection:
85-
// 1. The user who does nothing and uses defaults - In this case they get some sane defaults
86-
// based on the amount of memory and file descriptors their system has.
87-
// This should protect the node from many attacks.
88-
// 2. Slightly more advanced user - They can tweak the above by passing in config on
89-
// maxMemory, maxFD, or maxConns with Swarm.HighWater.ConnMgr.
90-
// 3. Power user - They specify all the limits they want set via Swarm.ResourceMgr.Limits
91-
// and we don't do any defaults/overrides. We pass that config blindly into libp2p resource manager.
47+
// The defaults follow the documentation in docs/config.md.
48+
// Any changes in the logic here should be reflected there.
9249
func createDefaultLimitConfig(cfg config.SwarmConfig) (rcmgr.LimitConfig, error) {
9350
maxMemoryDefaultString := humanize.Bytes(uint64(memory.TotalMemory()) / 8)
9451
maxMemoryString := cfg.ResourceMgr.MaxMemory.WithDefault(maxMemoryDefaultString)
@@ -105,7 +62,6 @@ func createDefaultLimitConfig(cfg config.SwarmConfig) (rcmgr.LimitConfig, error)
10562
FD: int(numFD),
10663

10764
// By default, we just limit connections on the inbound side.
108-
// Note that the limit gets adjusted below if "cfg.ConnMgr.HighWater" is set.
10965
Conns: bigEnough,
11066
ConnsInbound: rcmgr.DefaultLimits.SystemBaseLimit.ConnsInbound, // same as libp2p default
11167
ConnsOutbound: bigEnough,
@@ -132,9 +88,31 @@ func createDefaultLimitConfig(cfg config.SwarmConfig) (rcmgr.LimitConfig, error)
13288
StreamsOutbound: 0,
13389
},
13490

135-
// Just go with what libp2p does
136-
TransientBaseLimit: rcmgr.DefaultLimits.TransientBaseLimit,
137-
TransientLimitIncrease: rcmgr.DefaultLimits.TransientLimitIncrease,
91+
TransientBaseLimit: rcmgr.BaseLimit{
92+
Memory: rcmgr.DefaultLimits.TransientBaseLimit.Memory,
93+
FD: rcmgr.DefaultLimits.TransientBaseLimit.FD,
94+
95+
Conns: bigEnough,
96+
ConnsInbound: rcmgr.DefaultLimits.TransientBaseLimit.ConnsInbound,
97+
ConnsOutbound: bigEnough,
98+
99+
Streams: bigEnough,
100+
StreamsInbound: rcmgr.DefaultLimits.TransientBaseLimit.StreamsInbound,
101+
StreamsOutbound: bigEnough,
102+
},
103+
104+
TransientLimitIncrease: rcmgr.BaseLimitIncrease{
105+
Memory: rcmgr.DefaultLimits.TransientLimitIncrease.Memory,
106+
FDFraction: rcmgr.DefaultLimits.TransientLimitIncrease.FDFraction,
107+
108+
Conns: 0,
109+
ConnsInbound: rcmgr.DefaultLimits.TransientLimitIncrease.ConnsInbound,
110+
ConnsOutbound: 0,
111+
112+
Streams: 0,
113+
StreamsInbound: rcmgr.DefaultLimits.TransientLimitIncrease.StreamsInbound,
114+
StreamsOutbound: 0,
115+
},
138116

139117
// Lets get out of the way of the allow list functionality.
140118
// If someone specified "Swarm.ResourceMgr.Allowlist" we should let it go through.
@@ -197,12 +175,5 @@ func createDefaultLimitConfig(cfg config.SwarmConfig) (rcmgr.LimitConfig, error)
197175

198176
defaultLimitConfig := scalingLimitConfig.Scale(int64(maxMemory), int(numFD))
199177

200-
// If a high water mark is set:
201-
if cfg.ConnMgr.Type == "basic" {
202-
// set the connection limit higher than high water mark so that the ConnMgr has "space and time" to close "least useful" connections.
203-
defaultLimitConfig.System.Conns = 2 * cfg.ConnMgr.HighWater
204-
log.Info("adjusted default resource manager System.Conns limits to match ConnMgr.HighWater value of %s", cfg.ConnMgr.HighWater)
205-
}
206-
207178
return defaultLimitConfig, nil
208179
}

core/node/libp2p/rcmgr_logging.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (n *loggingResourceManager) start(ctx context.Context) {
5050
n.limitExceededErrs = make(map[string]int)
5151

5252
for e, count := range errs {
53-
n.logger.Errorf("Resource limits were exceeded %d times with error %q.", count, e)
53+
n.logger.Errorf("Protected from exceeding resource limits %d times: %q.", count, e)
5454
}
5555

5656
if len(errs) != 0 {

core/node/libp2p/rcmgr_logging_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestLoggingResourceManager(t *testing.T) {
5555
if oLogs.Len() == 0 {
5656
continue
5757
}
58-
require.Equal(t, "Resource limits were exceeded 2 times with error \"system: cannot reserve inbound connection: resource limit exceeded\".", oLogs.All()[0].Message)
58+
require.Equal(t, "Protected from exceeding resource limits 2 times: \"system: cannot reserve inbound connection: resource limit exceeded\".", oLogs.All()[0].Message)
5959
return
6060
}
6161
}

docs/EARLY_TESTERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ We will ask early testers to participate at two points in the process:
3131
- [ ] Siderus (@koalalorenzo)
3232
- [ ] Charity Engine (@rytiss, @tristanolive)
3333
- [ ] Fission (@bmann)
34-
- [ ] OrbitDB (@tabcat)
34+
- [ ] OrbitDB (@aphelionz)
3535

3636
## How to sign up?
3737

docs/PATCH_RELEASE_TEMPLATE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ This process handles patch releases from version `vX.Y.Z` to `vX.Y.Z+1` assuming
2424
- [ ] Release published
2525
- [ ] to [dist.ipfs.tech](https://dist.ipfs.tech)
2626
- [ ] to [npm-go-ipfs](https://www.npmjs.com/package/go-ipfs) (should be done by [ipfs/npm-go-ipfs](https://github.com/ipfs/npm-go-ipfs), but ok to dispatch [this job](https://github.com/ipfs/npm-go-ipfs/actions/workflows/main.yml) manually)
27-
- [ ] to [chocolatey](https://chocolatey.org/packages/go-ipfs) (should be done by [ipfs/choco-go-ipfs](https://github.com/ipfs/choco-go-ipfs/), but ok to dispatch [this job](https://github.com/ipfs/choco-go-ipfs/actions/workflows/main.yml) manually)
28-
- [ ] to [snap](https://snapcraft.io/ipfs) (should happen automatically, see [snap/snapcraft.yaml](https://github.com/ipfs/kubo/blob/master/snap/snapcraft.yaml))
2927
- [ ] to [github](https://github.com/ipfs/kubo/releases)
3028
- [ ] to [arch](https://www.archlinux.org/packages/community/x86_64/go-ipfs/) (flag it out of date)
3129
- [ ] Cut a new ipfs-desktop release

0 commit comments

Comments
 (0)