@cryptotaxi247 / kubo / commits / e164af1f2

feat: add a transport config section

This way, users can disable transports (especially QUIC), and set muxer/security transport priorities.

Steven Allen committed Jun 16, 2020 at 01:02 UTC e164af1f2ac6daaec78d56340e43333d9147e20d
16 files changed +601 -145
cmd/ipfs/daemon.go
+5 -3
@@ -174,7 +174,7 @@ Headers.
174 cmds.BoolOption(migrateKwd, "If true, assume yes at the migrate prompt. If false, assume no."),
175 cmds.BoolOption(enablePubSubKwd, "Instantiate the ipfs daemon with the experimental pubsub feature enabled."),
176 cmds.BoolOption(enableIPNSPubSubKwd, "Enable IPNS record distribution through pubsub; enables pubsub."),
177 - cmds.BoolOption(enableMultiplexKwd, "Add the experimental 'go-multiplex' stream muxer to libp2p on construction.").WithDefault(true),
177 + cmds.BoolOption(enableMultiplexKwd, "DEPRECATED"),
178
179 // TODO: add way to override addresses. tricky part: updating the config if also --init.
180 // cmds.StringOption(apiAddrKwd, "Address for the daemon rpc API (overrides config)"),
@@ -296,7 +296,10 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
296 offline, _ := req.Options[offlineKwd].(bool)
297 ipnsps, _ := req.Options[enableIPNSPubSubKwd].(bool)
298 pubsub, _ := req.Options[enablePubSubKwd].(bool)
299 - mplex, _ := req.Options[enableMultiplexKwd].(bool)
299 + if _, hasMplex := req.Options[enableMultiplexKwd]; hasMplex {
300 + log.Errorf("The mplex multiplexer has been enabled by default and the experimental %s flag has been removed.")
301 + log.Errorf("To disable this multiplexer, please configure `Swarm.Transports.Multiplexers'.")
302 + }
303
304 // Start assembling node config
305 ncfg := &core.BuildCfg{
@@ -307,7 +310,6 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
310 ExtraOpts: map[string]bool{
311 "pubsub": pubsub,
312 "ipnsps": ipnsps,
310 - "mplex": mplex,
313 },
314 //TODO(Kubuxu): refactor Online vs Offline by adding Permanent vs Ephemeral
315 }
core/node/groups.go
+21 -6
@@ -9,6 +9,7 @@ import (
9 blockstore "github.com/ipfs/go-ipfs-blockstore"
10 config "github.com/ipfs/go-ipfs-config"
11 util "github.com/ipfs/go-ipfs-util"
12 + log "github.com/ipfs/go-log"
13 peer "github.com/libp2p/go-libp2p-core/peer"
14 pubsub "github.com/libp2p/go-libp2p-pubsub"
15
@@ -22,12 +23,12 @@ import (
23 "go.uber.org/fx"
24 )
25
26 +var logger = log.Logger("core:constructor")
27 +
28 var BaseLibP2P = fx.Options(
29 fx.Provide(libp2p.UserAgent),
30 fx.Provide(libp2p.PNet),
31 fx.Provide(libp2p.ConnectionManager),
29 - fx.Provide(libp2p.Transports),
30 -
32 fx.Provide(libp2p.Host),
33
34 fx.Provide(libp2p.DiscoveryHandler),
@@ -108,19 +109,33 @@ func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option {
109 autonat = fx.Provide(libp2p.AutoNATService(cfg.AutoNAT.Throttle))
110 }
111
111 - // Gather all the options
112 + // If `cfg.Swarm.DisableRelay` is set and `Network.Relay` isn't, use the former.
113 + enableRelay := cfg.Swarm.Transports.Network.Relay.WithDefault(!cfg.Swarm.DisableRelay) //nolint
114 +
115 + // Warn about a deprecated option.
116 + //nolint
117 + if cfg.Swarm.DisableRelay {
118 + logger.Error("The `Swarm.DisableRelay' config field is deprecated.")
119 + if enableRelay {
120 + logger.Error("`Swarm.DisableRelay' has been overridden by `Swarm.Transports.Network.Relay'")
121 + } else {
122 + logger.Error("Use the `Swarm.Transports.Network.Relay' config field instead")
123 + }
124 + }
125
126 + // Gather all the options
127 opts := fx.Options(
128 BaseLibP2P,
129
130 fx.Provide(libp2p.AddrFilters(cfg.Swarm.AddrFilters)),
131 fx.Provide(libp2p.AddrsFactory(cfg.Addresses.Announce, cfg.Addresses.NoAnnounce)),
118 - fx.Provide(libp2p.SmuxTransport(bcfg.getOpt("mplex"))),
119 - fx.Provide(libp2p.Relay(cfg.Swarm.DisableRelay, cfg.Swarm.EnableRelayHop)),
132 + fx.Provide(libp2p.SmuxTransport(cfg.Swarm.Transports)),
133 + fx.Provide(libp2p.Relay(enableRelay, cfg.Swarm.EnableRelayHop)),
134 + fx.Provide(libp2p.Transports(cfg.Swarm.Transports)),
135 fx.Invoke(libp2p.StartListening(cfg.Addresses.Swarm)),
136 fx.Invoke(libp2p.SetupDiscovery(cfg.Discovery.MDNS.Enabled, cfg.Discovery.MDNS.Interval)),
137
123 - fx.Provide(libp2p.Security(!bcfg.DisableEncryptedConnections, cfg.Experimental.OverrideSecurityTransports)),
138 + fx.Provide(libp2p.Security(!bcfg.DisableEncryptedConnections, cfg.Swarm.Transports)),
139
140 fx.Provide(libp2p.Routing),
141 fx.Provide(libp2p.BaseRouting),
core/node/libp2p/libp2p.go
+31
@@ -1,9 +1,11 @@
1 package libp2p
2
3 import (
4 + "sort"
5 "time"
6
7 version "github.com/ipfs/go-ipfs"
8 + config "github.com/ipfs/go-ipfs-config"
9
10 logging "github.com/ipfs/go-log"
11 "github.com/libp2p/go-libp2p"
@@ -48,3 +50,32 @@ func simpleOpt(opt libp2p.Option) func() (opts Libp2pOpts, err error) {
50 return
51 }
52 }
53 +
54 +type priorityOption struct {
55 + priority, defaultPriority config.Priority
56 + opt libp2p.Option
57 +}
58 +
59 +func prioritizeOptions(opts []priorityOption) libp2p.Option {
60 + type popt struct {
61 + priority int64
62 + opt libp2p.Option
63 + }
64 + enabledOptions := make([]popt, 0, len(opts))
65 + for _, o := range opts {
66 + if prio, ok := o.priority.WithDefault(o.defaultPriority); ok {
67 + enabledOptions = append(enabledOptions, popt{
68 + priority: prio,
69 + opt: o.opt,
70 + })
71 + }
72 + }
73 + sort.Slice(enabledOptions, func(i, j int) bool {
74 + return enabledOptions[i].priority > enabledOptions[j].priority
75 + })
76 + p2pOpts := make([]libp2p.Option, len(enabledOptions))
77 + for i, opt := range enabledOptions {
78 + p2pOpts[i] = opt.opt
79 + }
80 + return libp2p.ChainOptions(p2pOpts...)
81 +}
core/node/libp2p/relay.go
+4 -5
@@ -5,17 +5,16 @@ import (
5 relay "github.com/libp2p/go-libp2p-circuit"
6 )
7
8 -func Relay(disable, enableHop bool) func() (opts Libp2pOpts, err error) {
8 +func Relay(enableRelay, enableHop bool) func() (opts Libp2pOpts, err error) {
9 return func() (opts Libp2pOpts, err error) {
10 - if disable {
11 - // Enabled by default.
12 - opts.Opts = append(opts.Opts, libp2p.DisableRelay())
13 - } else {
10 + if enableRelay {
11 relayOpts := []relay.RelayOpt{}
12 if enableHop {
13 relayOpts = append(relayOpts, relay.OptHop)
14 }
15 opts.Opts = append(opts.Opts, libp2p.EnableRelay(relayOpts...))
16 + } else {
17 + opts.Opts = append(opts.Opts, libp2p.DisableRelay())
18 }
19 return
20 }
core/node/libp2p/sec.go new
+39
@@ -0,0 +1,39 @@
1 +package libp2p
2 +
3 +import (
4 + config "github.com/ipfs/go-ipfs-config"
5 + "github.com/libp2p/go-libp2p"
6 + noise "github.com/libp2p/go-libp2p-noise"
7 + secio "github.com/libp2p/go-libp2p-secio"
8 + tls "github.com/libp2p/go-libp2p-tls"
9 +)
10 +
11 +func Security(enabled bool, tptConfig config.Transports) interface{} {
12 + if !enabled {
13 + return func() (opts Libp2pOpts) {
14 + // TODO: shouldn't this be Errorf to guarantee visibility?
15 + log.Warnf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
16 + You will not be able to connect to any nodes configured to use encrypted connections`)
17 + opts.Opts = append(opts.Opts, libp2p.NoSecurity)
18 + return opts
19 + }
20 + }
21 +
22 + // Using the new config options.
23 + return func() (opts Libp2pOpts) {
24 + opts.Opts = append(opts.Opts, prioritizeOptions([]priorityOption{{
25 + priority: tptConfig.Security.TLS,
26 + defaultPriority: 100,
27 + opt: libp2p.Security(tls.ID, tls.New),
28 + }, {
29 + priority: tptConfig.Security.SECIO,
30 + defaultPriority: 200,
31 + opt: libp2p.Security(secio.ID, secio.New),
32 + }, {
33 + priority: tptConfig.Security.Noise,
34 + defaultPriority: 300,
35 + opt: libp2p.Security(noise.ID, noise.New),
36 + }}))
37 + return opts
38 + }
39 +}
core/node/libp2p/smux.go
+52 -27
@@ -1,54 +1,79 @@
1 package libp2p
2
3 import (
4 + "fmt"
5 "os"
6 "strings"
7
8 + config "github.com/ipfs/go-ipfs-config"
9 "github.com/libp2p/go-libp2p"
10 smux "github.com/libp2p/go-libp2p-core/mux"
11 mplex "github.com/libp2p/go-libp2p-mplex"
12 yamux "github.com/libp2p/go-libp2p-yamux"
13 )
14
13 -func makeSmuxTransportOption(mplexExp bool) libp2p.Option {
15 +func yamuxTransport() smux.Multiplexer {
16 + tpt := *yamux.DefaultTransport
17 + tpt.AcceptBacklog = 512
18 + if os.Getenv("YAMUX_DEBUG") != "" {
19 + tpt.LogOutput = os.Stderr
20 + }
21 +
22 + return &tpt
23 +}
24 +
25 +func makeSmuxTransportOption(tptConfig config.Transports) (libp2p.Option, error) {
26 const yamuxID = "/yamux/1.0.0"
27 const mplexID = "/mplex/6.7.0"
28
29 ymxtpt := *yamux.DefaultTransport
30 ymxtpt.AcceptBacklog = 512
31
20 - if os.Getenv("YAMUX_DEBUG") != "" {
21 - ymxtpt.LogOutput = os.Stderr
22 - }
23 -
24 - muxers := map[string]smux.Multiplexer{yamuxID: &ymxtpt}
25 - if mplexExp {
26 - muxers[mplexID] = mplex.DefaultTransport
27 - }
28 -
29 - // Allow muxer preference order overriding
30 - order := []string{yamuxID, mplexID}
32 if prefs := os.Getenv("LIBP2P_MUX_PREFS"); prefs != "" {
32 - order = strings.Fields(prefs)
33 - }
33 + // Using legacy LIBP2P_MUX_PREFS variable.
34 + log.Error("LIBP2P_MUX_PREFS is now deprecated.")
35 + log.Error("Use the `Swarm.Transports.Multiplexers' config field.")
36 + muxers := strings.Fields(prefs)
37 + enabled := make(map[string]bool, len(muxers))
38
35 - opts := make([]libp2p.Option, 0, len(order))
36 - for _, id := range order {
37 - tpt, ok := muxers[id]
38 - if !ok {
39 - log.Warn("unknown or duplicate muxer in LIBP2P_MUX_PREFS: %s", id)
40 - continue
39 + var opts []libp2p.Option
40 + for _, tpt := range muxers {
41 + if enabled[tpt] {
42 + return nil, fmt.Errorf(
43 + "duplicate muxer found in LIBP2P_MUX_PREFS: %s",
44 + tpt,
45 + )
46 + }
47 + switch tpt {
48 + case yamuxID:
49 + opts = append(opts, libp2p.Muxer(tpt, yamuxTransport))
50 + case mplexID:
51 + opts = append(opts, libp2p.Muxer(tpt, mplex.DefaultTransport))
52 + default:
53 + return nil, fmt.Errorf("unknown muxer: %s", tpt)
54 + }
55 }
42 - delete(muxers, id)
43 - opts = append(opts, libp2p.Muxer(id, tpt))
56 + return libp2p.ChainOptions(opts...), nil
57 + } else {
58 + return prioritizeOptions([]priorityOption{{
59 + priority: tptConfig.Multiplexers.Yamux,
60 + defaultPriority: 100,
61 + opt: libp2p.Muxer(yamuxID, yamuxTransport),
62 + }, {
63 + priority: tptConfig.Multiplexers.Mplex,
64 + defaultPriority: 200,
65 + opt: libp2p.Muxer(mplexID, mplex.DefaultTransport),
66 + }}), nil
67 }
45 -
46 - return libp2p.ChainOptions(opts...)
68 }
69
49 -func SmuxTransport(mplex bool) func() (opts Libp2pOpts, err error) {
70 +func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error) {
71 return func() (opts Libp2pOpts, err error) {
51 - opts.Opts = append(opts.Opts, makeSmuxTransportOption(mplex))
52 - return
72 + res, err := makeSmuxTransportOption(tptConfig)
73 + if err != nil {
74 + return opts, err
75 + }
76 + opts.Opts = append(opts.Opts, res)
77 + return opts, nil
78 }
79 }
core/node/libp2p/transport.go
+26 -45
@@ -3,63 +3,44 @@ package libp2p
3 import (
4 "fmt"
5
6 - "github.com/libp2p/go-libp2p"
6 + config "github.com/ipfs/go-ipfs-config"
7 + libp2p "github.com/libp2p/go-libp2p"
8 metrics "github.com/libp2p/go-libp2p-core/metrics"
8 - noise "github.com/libp2p/go-libp2p-noise"
9 libp2pquic "github.com/libp2p/go-libp2p-quic-transport"
10 - secio "github.com/libp2p/go-libp2p-secio"
11 - tls "github.com/libp2p/go-libp2p-tls"
10 + tcp "github.com/libp2p/go-tcp-transport"
11 + websocket "github.com/libp2p/go-ws-transport"
12
13 "go.uber.org/fx"
14 )
15
16 -// default security transports for libp2p
17 -var defaultSecurityTransports = []string{"tls", "secio", "noise"}
16 +func Transports(tptConfig config.Transports) interface{} {
17 + return func(pnet struct {
18 + fx.In
19 + Fprint PNetFingerprint `optional:"true"`
20 + }) (opts Libp2pOpts, err error) {
21 + privateNetworkEnabled := pnet.Fprint != nil
22
19 -func Transports(pnet struct {
20 - fx.In
21 - Fprint PNetFingerprint `optional:"true"`
22 -}) (opts Libp2pOpts) {
23 - opts.Opts = append(opts.Opts, libp2p.DefaultTransports)
24 - if pnet.Fprint == nil {
25 - opts.Opts = append(opts.Opts, libp2p.Transport(libp2pquic.NewTransport))
26 - }
27 - return opts
28 -}
29 -
30 -func Security(enabled bool, securityTransportOverride []string) interface{} {
31 - if !enabled {
32 - return func() (opts Libp2pOpts) {
33 - // TODO: shouldn't this be Errorf to guarantee visibility?
34 - log.Warnf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
35 - You will not be able to connect to any nodes configured to use encrypted connections`)
36 - opts.Opts = append(opts.Opts, libp2p.NoSecurity)
37 - return opts
23 + if tptConfig.Network.TCP.WithDefault(true) {
24 + opts.Opts = append(opts.Opts, libp2p.Transport(tcp.NewTCPTransport))
25 }
39 - }
26
41 - securityTransports := defaultSecurityTransports
42 - if len(securityTransportOverride) > 0 {
43 - securityTransports = securityTransportOverride
44 - }
27 + if tptConfig.Network.Websocket.WithDefault(true) {
28 + opts.Opts = append(opts.Opts, libp2p.Transport(websocket.New))
29 + }
30
46 - var libp2pOpts []libp2p.Option
47 - for _, tpt := range securityTransports {
48 - switch tpt {
49 - case "tls":
50 - libp2pOpts = append(libp2pOpts, libp2p.Security(tls.ID, tls.New))
51 - case "secio":
52 - libp2pOpts = append(libp2pOpts, libp2p.Security(secio.ID, secio.New))
53 - case "noise":
54 - libp2pOpts = append(libp2pOpts, libp2p.Security(noise.ID, noise.New))
55 - default:
56 - return fx.Error(fmt.Errorf("invalid security transport specified in config: %s", tpt))
31 + if tptConfig.Network.QUIC.WithDefault(!privateNetworkEnabled) {
32 + if privateNetworkEnabled {
33 + // QUIC was force enabled while the private network was turned on.
34 + // Fail and tell the user.
35 + return opts, fmt.Errorf(
36 + "The QUIC transport does not support private networks. " +
37 + "Please disable Swarm.Transports.Network.QUIC.",
38 + )
39 + }
40 + opts.Opts = append(opts.Opts, libp2p.Transport(libp2pquic.NewTransport))
41 }
58 - }
42
60 - return func() (opts Libp2pOpts) {
61 - opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2pOpts...))
62 - return opts
43 + return opts, nil
44 }
45 }
46
docs/config.md
+368 -25
@@ -5,7 +5,7 @@ is read once at node instantiation, either for an offline command, or when
5 starting the daemon. Commands that execute on a running daemon do not read the
6 config file at runtime.
7
8 -#### Profiles
8 +## Profiles
9
10 Configuration profiles allow to tweak configuration quickly. Profiles can be
11 applied with `--profile` flag to `ipfs init` or with the `ipfs config profile
@@ -89,6 +89,46 @@ documented in `ipfs config profile --help`.
89 functionality - performance of content discovery and data
90 fetching may be degraded.
91
92 +## Types
93 +
94 +This document refers to the standard JSON types (e.g., `null`, `string`,
95 +`number`, etc.), as well as a few custom types, described below.
96 +
97 +### `flag`
98 +
99 +Flags allow enabling and disabling features. However, unlike simple booleans,
100 +they can also be `null` (or omitted) to indicate that the default value should
101 +be chosen. This makes it easier for go-ipfs to change the defaults in the
102 +future unless the user _explicitly_ sets the flag to either `true` (enabled) or
103 +`false` (disabled). Flags have three possible states:
104 +
105 +- `null` or missing (apply the default value).
106 +- `true` (enabled)
107 +- `false` (disabled)
108 +
109 +### `priority`
110 +
111 +Priorities allow specifying the priority of a feature/protocol and disabling the
112 +feature/protocol. Priorities can take one of the following values:
113 +
114 +- `null`/missing (apply the default priority, same as with flags)
115 +- `false` (disabled)
116 +- `1 - 2^63` (priority, lower is preferred)
117 +
118 +### `strings`
119 +
120 +Strings is a special type for conveniently specifying a single string, an array
121 +of strings, or null:
122 +
123 +- `null`
124 +- `"a single string"`
125 +- `["an", "array", "of", "strings"]`
126 +
127 +### `duration`
128 +
129 +Duration is a type for describing lengths of time, using the same format go
130 +does (e.g, `"1d2h4m40.01s"`).
131 +
132 ## Table of Contents
133
134 - [`Addresses`](#addresses)
@@ -176,6 +216,8 @@ Supported Transports:
216
217 Default: `/ip4/127.0.0.1/tcp/5001`
218
219 +Type: `strings`
220 +
221 ### `Addresses.Gateway`
222
223 Multiaddr or array of multiaddrs describing the address to serve the local
@@ -188,6 +230,8 @@ Supported Transports:
230
231 Default: `/ip4/127.0.0.1/tcp/8080`
232
233 +Type: `strings`
234 +
235 ### `Addresses.Swarm`
236
237 Array of multiaddrs describing which addresses to listen on for p2p swarm
@@ -209,6 +253,8 @@ Default:
253 ]
254 ```
255
256 +Type: `array[string]`
257 +
258 ### `Addresses.Announce`
259
260 If non-empty, this array specifies the swarm addresses to announce to the
@@ -216,11 +262,15 @@ network. If empty, the daemon will announce inferred swarm addresses.
262
263 Default: `[]`
264
265 +Type: `array[string]`
266 +
267 ### `Addresses.NoAnnounce`
268 Array of swarm addresses not to announce to the network.
269
270 Default: `[]`
271
272 +Type: `array[string]`
273 +
274 ## `API`
275 Contains information used by the API gateway.
276
@@ -236,6 +286,8 @@ Example:
286
287 Default: `null`
288
289 +Type: `object[string -> array[string]]`
290 +
291 ## `AutoNAT`
292
293 Contains the configuration options for the AutoNAT service. The AutoNAT service
@@ -253,6 +305,8 @@ field can take one of two values:
305
306 Additional modes may be added in the future.
307
308 +Type: `string` (can only be "enabled" and "disabled")
309 +
310 ### `AutoNAT.Throttle`
311
312 When set, this option configure's the AutoNAT services throttling behavior. By
@@ -265,18 +319,24 @@ Configures how many AutoNAT requests to service per `AutoNAT.Throttle.Interval`.
319
320 Default: 30
321
322 +Type: `integer`
323 +
324 ### `AutoNAT.Throttle.PeerLimit`
325
326 Configures how many AutoNAT requests per-peer to service per `AutoNAT.Throttle.Interval`.
327
328 Default: 3
329
330 +Type: `integer`
331 +
332 ### `AutoNAT.Throttle.Interval`
333
334 Configures the interval for the above limits.
335
336 Default: 1 Minute
337
338 +Type: `duration`
339 +
340 ## `Bootstrap`
341
342 Bootstrap is an array of multiaddrs of trusted nodes to connect to in order to
@@ -284,6 +344,8 @@ initiate a connection to the network.
344
345 Default: The ipfs.io bootstrap nodes
346
347 +Type: `array[string]`
348 +
349 ## `Datastore`
350
351 Contains information related to the construction and operation of the on-disk
@@ -294,7 +356,9 @@ storage system.
356 A soft upper limit for the size of the ipfs repository's datastore. With `StorageGCWatermark`,
357 is used to calculate whether to trigger a gc run (only if `--enable-gc` flag is set).
358
297 -Default: `10GB`
359 +Default: `"10GB"`
360 +
361 +Type: `string` (size)
362
363 ### `Datastore.StorageGCWatermark`
364
@@ -304,6 +368,8 @@ option defaults to false currently).
368
369 Default: `90`
370
371 +Type: `integer`
372 +
373 ### `Datastore.GCPeriod`
374
375 A time duration specifying how frequently to run a garbage collection. Only used
@@ -311,6 +377,8 @@ if automatic gc is enabled.
377
378 Default: `1h`
379
380 +Type: `duration` or an empty string for the default value.
381 +
382 ### `Datastore.HashOnRead`
383
384 A boolean value. If set to true, all block reads from disk will be hashed and
@@ -318,6 +386,8 @@ verified. This will cause increased CPU utilization.
386
387 Default: `false`
388
389 +Type: `bool`
390 +
391 ### `Datastore.BloomFilterSize`
392
393 A number representing the size in bytes of the blockstore's [bloom
@@ -334,8 +404,9 @@ we'd want to use 1199120 bytes. As of writing, [7 hash
404 functions](https://github.com/ipfs/go-ipfs-blockstore/blob/547442836ade055cc114b562a3cc193d4e57c884/caching.go#L22)
405 are used, so the constant `k` is 7 in the formula.
406
407 +Default: `0` (disabled)
408
338 -Default: `0`
409 +Type: `integer`
410
411 ### `Datastore.Spec`
412
@@ -381,6 +452,8 @@ Default:
452 }
453 ```
454
455 +Type: `object`
456 +
457 ## `Discovery`
458
459 Contains options for configuring ipfs node discovery mechanisms.
@@ -395,10 +468,14 @@ A boolean value for whether or not mdns should be active.
468
469 Default: `true`
470
471 +Type: `bool`
472 +
473 #### `Discovery.MDNS.Interval`
474
475 A number of seconds to wait between discovery checks.
476
477 +Type: `integer` (_not_ a duration)
478 +
479 ## `Gateway`
480
481 Options for the HTTP gateway.
@@ -410,6 +487,8 @@ and will not fetch files from the network.
487
488 Default: `false`
489
490 +Type: `bool`
491 +
492 ### `Gateway.NoDNSLink`
493
494 A boolean to configure whether DNSLink lookup for value in `Host` HTTP header
@@ -418,6 +497,8 @@ record becomes the `/` and respective payload is returned to the client.
497
498 Default: `false`
499
500 +Type: `bool`
501 +
502 ### `Gateway.HTTPHeaders`
503
504 Headers to set on gateway responses.
@@ -437,18 +518,24 @@ Default:
518 }
519 ```
520
521 +Type: `object[string -> array[string]]`
522 +
523 ### `Gateway.RootRedirect`
524
525 A url to redirect requests for `/` to.
526
527 Default: `""`
528
529 +Type: `string`
530 +
531 ### `Gateway.Writable`
532
533 A boolean to configure whether the gateway is writeable or not.
534
535 Default: `false`
536
537 +Type: `bool`
538 +
539 ### `Gateway.PathPrefixes`
540
541 Array of acceptable url paths that a client can specify in X-Ipfs-Path-Prefix
@@ -479,6 +566,7 @@ location /blog/ {
566
567 Default: `[]`
568
569 +Type: `array[string]`
570
571 ### `Gateway.PublicGateways`
572
@@ -505,6 +593,8 @@ Above enables `http://example.com/ipfs/*` and `http://example.com/ipns/*` but no
593
594 Default: `[]`
595
596 +Type: `array[string]`
597 +
598 #### `Gateway.PublicGateways: UseSubdomains`
599
600 A boolean to configure whether the gateway at the hostname provides [Origin isolation](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy)
@@ -542,6 +632,7 @@ between content roots.
632
633 Default: `false`
634
635 +Type: `bool`
636
637 #### `Gateway.PublicGateways: NoDNSLink`
638
@@ -551,6 +642,8 @@ If `Paths` are defined, they take priority over DNSLink.
642
643 Default: `false` (DNSLink lookup enabled by default for every defined hostname)
644
645 +Type: `bool`
646 +
647 #### Implicit defaults of `Gateway.PublicGateways`
648
649 Default entries for `localhost` hostname and loopback IPs are always present.
@@ -636,23 +729,33 @@ The unique PKI identity label for this configs peer. Set on init and never read,
729 it's merely here for convenience. Ipfs will always generate the peerID from its
730 keypair at runtime.
731
732 +Type: `string`
733 +
734 ### `Identity.PrivKey`
735
736 The base64 encoded protobuf describing (and containing) the nodes private key.
737
738 +Type: `string`
739 +
740 ## `Ipns`
741
742 ### `Ipns.RepublishPeriod`
743
744 A time duration specifying how frequently to republish ipns records to ensure
648 -they stay fresh on the network. If unset, we default to 4 hours.
745 +they stay fresh on the network.
746 +
747 +Default: 4 hours.
748 +
749 +Type: `interval` or an empty string for the default.
750
751 ### `Ipns.RecordLifetime`
752
753 A time duration specifying the value to set on ipns records for their validity
754 lifetime.
755
655 -If unset, we default to 24 hours.
756 +Default: 24 hours.
757 +
758 +Type: `interval` or an empty string for the default.
759
760 ### `Ipns.ResolveCacheSize`
761
@@ -661,6 +764,8 @@ will be kept cached until their lifetime is expired.
764
765 Default: `128`
766
767 +Type: `integer`
768 +
769 ## `Mounts`
770
771 FUSE mount point configuration options.
@@ -669,10 +774,18 @@ FUSE mount point configuration options.
774
775 Mountpoint for `/ipfs/`.
776
777 +Default: `/ipfs`
778 +
779 +Type: `string`
780 +
781 ### `Mounts.IPNS`
782
783 Mountpoint for `/ipns/`.
784
785 +Default: `/ipns`
786 +
787 +Type: `string`
788 +
789 ### `Mounts.FuseAllowOther`
790
791 Sets the FUSE allow other option on the mountpoint.
@@ -693,6 +806,8 @@ Sets the default router used by pubsub to route messages to peers. This can be o
806
807 Default: `"gossipsub"`
808
809 +Type: `string`
810 +
811 [gossipsub]: https://github.com/libp2p/specs/tree/master/pubsub/gossipsub
812
813 ### `Pubsub.DisableSigning`
@@ -706,6 +821,8 @@ intentionally re-using the real message's message ID.
821
822 Default: `false`
823
824 +Type: `bool`
825 +
826 ### `Peering`
827
828 Configures the peering subsystem. The peering subsystem configures go-ipfs to
@@ -756,6 +873,10 @@ The set of peers with which to peer. Each entry is of the form:
873
874 Additional fields may be added in the future.
875
876 +Default: empty.
877 +
878 +Type: `array[peering]`
879 +
880 ## `Reprovider`
881
882 ### `Reprovider.Interval`
@@ -769,12 +890,18 @@ not being able to discover that you have the objects that you have. If you want
890 to have this disabled and keep the network aware of what you have, you must
891 manually announce your content periodically.
892
893 +Type: `array[peering]`
894 +
895 ### `Reprovider.Strategy`
896
897 Tells reprovider what should be announced. Valid strategies are:
775 - - "all" (default) - announce all stored data
898 + - "all" - announce all stored data
899 - "pinned" - only announce pinned data
900 - "roots" - only announce directly pinned keys and root keys of recursive pins
901 +
902 +Default: all
903 +
904 +Type: `string` (or unset for the default)
905
906 ## `Routing`
907
@@ -817,6 +944,9 @@ unless you're sure your node is reachable from the public network.
944 }
945 ```
946
947 +Default: dht
948 +
949 +Type: `string` (or unset for the default)
950
951 ## `Swarm`
952
@@ -836,6 +966,9 @@ preventing dials to all non-routable IP addresses (e.g., `192.168.0.0/16`) but
966 you should always check settings against your own network and/or hosting
967 provider.
968
969 +Default: `[]`
970 +
971 +Type: `array[string]`
972
973 ### `Swarm.DisableBandwidthMetrics`
974
@@ -843,6 +976,10 @@ A boolean value that when set to true, will cause ipfs to not keep track of
976 bandwidth metrics. Disabling bandwidth metrics can lead to a slight performance
977 improvement, as well as a reduction in memory usage.
978
979 +Default: `false`
980 +
981 +Type: `bool`
982 +
983 ### `Swarm.DisableNatPortMap`
984
985 Disable automatic NAT port forwarding.
@@ -852,12 +989,22 @@ up an external port and forward it to the port go-ipfs is running on. When this
989 works (i.e., when your router supports NAT port forwarding), it makes the local
990 go-ipfs node accessible from the public internet.
991
992 +Default: `false`
993 +
994 +Type: `bool`
995 +
996 ### `Swarm.DisableRelay`
997
998 +Deprecated: Set `Swarm.Transports.Network.Relay` to `false`.
999 +
1000 Disables the p2p-circuit relay transport. This will prevent this node from
1001 connecting to nodes behind relays, or accepting connections from nodes behind
1002 relays.
1003
1004 +Default: `false`
1005 +
1006 +Type: `bool`
1007 +
1008 ### `Swarm.EnableRelayHop`
1009
1010 Configures this node to act as a relay "hop". A relay "hop" relays traffic for other peers.
@@ -866,12 +1013,20 @@ WARNING: Do not enable this option unless you know what you're doing. Other
1013 peers will randomly decide to use your node as a relay and consume _all_
1014 available bandwidth. There is _no_ rate-limiting.
1015
1016 +Default: `false`
1017 +
1018 +Type: `bool`
1019 +
1020 ### `Swarm.EnableAutoRelay`
1021
1022 Enables "automatic relay" mode for this node. This option does two _very_
1023 different things based on the `Swarm.EnableRelayHop`. See
1024 [#7228](https://github.com/ipfs/go-ipfs/issues/7228) for context.
1025
1026 +Default: `false`
1027 +
1028 +Type: `bool`
1029 +
1030 #### Mode 1: `EnableRelayHop` is `false`
1031
1032 If `Swarm.EnableAutoRelay` is enabled and `Swarm.EnableRelayHop` is disabled,
@@ -906,30 +1061,24 @@ be configured to keep.
1061 Sets the type of connection manager to use, options are: `"none"` (no connection
1062 management) and `"basic"`.
1063
909 -#### Basic Connection Manager
910 -
911 -##### `Swarm.ConnMgr.LowWater`
912 -
913 -LowWater is the minimum number of connections to maintain.
1064 +Default: `"basic"`
1065
915 -##### `Swarm.ConnMgr.HighWater`
1066 +Type: `string` (one of `"basic"`, `"none"`, or `""` (default, i.e. `"basic"`).
1067
917 -HighWater is the number of connections that, when exceeded, will trigger a
918 -connection GC operation.
919 -
920 -##### `Swarm.ConnMgr.GracePeriod`
1068 +#### Basic Connection Manager
1069
922 -GracePeriod is a time duration that new connections are immune from being closed
923 -by the connection manager.
1070 +The basic connection manager uses a "high water", a "low water", and internal
1071 +scoring to periodically close connections to free up resources. When a node
1072 +using the basic connection manager reaches `HighWater` idle connections, it will
1073 +close the least useful ones until it reaches `LowWater` idle connections.
1074
925 -The "basic" connection manager tries to keep between `LowWater` and `HighWater`
926 -connections. It works by:
1075 +The connection manager considers a connection idle if:
1076
928 -1. Keeping all connections until `HighWater` connections is reached.
929 -2. Once `HighWater` is reached, it closes connections until `LowWater` is
930 - reached.
931 -3. To prevent thrashing, it never closes connections established within the
932 - `GracePeriod`.
1077 +* It has not been explicitly _protected_ by some subsystem. For example, Bitswap
1078 + will protect connections to peers from which it is actively downloading data,
1079 + the DHT will protect some peers for routing, and the peering subsystem will
1080 + protect all "peered" nodes.
1081 +* It has existed for longer than the `GracePeriod`.
1082
1083 **Example:**
1084
@@ -945,3 +1094,197 @@ connections. It works by:
1094 }
1095 }
1096 ```
1097 +
1098 +##### `Swarm.ConnMgr.LowWater`
1099 +
1100 +LowWater is the number of connections that the basic connection manager will
1101 +trim down to.
1102 +
1103 +Default: `600`
1104 +
1105 +Type: `integer`
1106 +
1107 +##### `Swarm.ConnMgr.HighWater`
1108 +
1109 +HighWater is the number of connections that, when exceeded, will trigger a
1110 +connection GC operation. Note: protected/recently formed connections don't count
1111 +towards this limit.
1112 +
1113 +Default: `900`
1114 +
1115 +Type: `integer`
1116 +
1117 +##### `Swarm.ConnMgr.GracePeriod`
1118 +
1119 +GracePeriod is a time duration that new connections are immune from being closed
1120 +by the connection manager.
1121 +
1122 +Default: `"20s"`
1123 +
1124 +Type: `duration`
1125 +
1126 +### `Swarm.Transports`
1127 +
1128 +Configuration section for libp2p transports. An empty configuration will apply
1129 +the defaults.
1130 +
1131 +### `Swarm.Transports.Network`
1132 +
1133 +Configuration section for libp2p _network_ transports. Transports enabled in
1134 +this section will be used for dialing. However, to receive connections on these
1135 +transports, multiaddrs for these transports must be added to `Addresses.Swarm`.
1136 +
1137 +Supported transports are: QUIC, TCP, WS, and Relay.
1138 +
1139 +Each field in this section is a `flag`.
1140 +
1141 +#### `Swarm.Transports.Network.TCP`
1142 +
1143 +[TCP](https://en.wikipedia.org/wiki/Transmission_Control_Protocol) is the most
1144 +widely used transport by go-ipfs nodes. It doesn't directly support encryption
1145 +and/or multiplexing, so libp2p will layer a security & multiplexing transport
1146 +over it.
1147 +
1148 +Default: Enabled
1149 +
1150 +Type: `flag`
1151 +
1152 +Listen Addresses:
1153 +* /ip4/0.0.0.0/tcp/4001 (default)
1154 +* /ip6/::/tcp/4001 (default)
1155 +
1156 +#### `Swarm.Transports.Network.Websocket`
1157 +
1158 +[Websocket](https://en.wikipedia.org/wiki/WebSocket) is a transport usually used
1159 +to connect to non-browser-based IPFS nodes from browser-based js-ipfs nodes.
1160 +
1161 +While it's enabled by default for dialing, go-ipfs doesn't listen on this
1162 +transport by default.
1163 +
1164 +Default: Enabled
1165 +
1166 +Type: `flag`
1167 +
1168 +Listen Addresses:
1169 +* /ip4/0.0.0.0/tcp/4002/ws
1170 +* /ip6/::/tcp/4002/ws
1171 +
1172 +#### `Swarm.Transports.Network.QUIC`
1173 +
1174 +[QUIC](https://en.wikipedia.org/wiki/QUIC) is a UDP-based transport with
1175 +built-in encryption and multiplexing. The primary benefits over TCP are:
1176 +
1177 +1. It doesn't require a file descriptor per connection, easing the load on the OS.
1178 +2. It currently takes 2 round trips to establish a connection (our TCP transport
1179 + currently takes 6).
1180 +
1181 +Default: Enabled
1182 +
1183 +Type: `flag`
1184 +
1185 +Listen Addresses:
1186 +* /ip4/0.0.0.0/udp/4001/quic (default)
1187 +* /ip6/::/udp/4001/quic (default)
1188 +
1189 +#### `Swarm.Transports.Network.Relay`
1190 +
1191 +[Libp2p Relay](https://github.com/libp2p/specs/tree/master/relay) proxy
1192 +transport that forms connections by hopping between multiple libp2p nodes. This
1193 +transport is primarily useful for bypassing firewalls and NATs.
1194 +
1195 +Default: Enabled
1196 +
1197 +Type: `flag`
1198 +
1199 +Listen Addresses: This transport is special. Any node that enables this
1200 +transport can receive inbound connections on this transport, without specifying
1201 +a listen address.
1202 +
1203 +### `Swarm.Transports.Security`
1204 +
1205 +Configuration section for libp2p _security_ transports. Transports enabled in
1206 +this section will be used to secure unencrypted connections.
1207 +
1208 +Security transports are configured with the `priority` type.
1209 +
1210 +When establishing an _outbound_ connection, go-ipfs will try each security
1211 +transport in priority order (lower first), until it finds a protocol that the
1212 +receiver supports. When establishing an _inbound_ connection, go-ipfs will let
1213 +the initiator choose the protocol, but will refuse to use any of the disabled
1214 +transports.
1215 +
1216 +Supported transports are: TLS (priority 100), SECIO (priority 200), Noise
1217 +(priority 300).
1218 +
1219 +No default priority will ever be less than 100.
1220 +
1221 +#### `Swarm.Transports.Security.TLS`
1222 +
1223 +[TLS](https://github.com/libp2p/specs/tree/master/tls) (1.3) is the default
1224 +security transport as of go-ipfs 0.5.0. It's also the most scrutinized and
1225 +trusted security transport.
1226 +
1227 +Default: `100`
1228 +
1229 +Type: `priority`
1230 +
1231 +#### `Swarm.Transports.Security.SECIO`
1232 +
1233 +[SECIO](https://github.com/libp2p/specs/tree/master/secio) is the most widely
1234 +supported IPFS & libp2p security transport. However, it is currently being
1235 +phased out in favor of more popular and better vetted protocols like TLS and
1236 +Noise.
1237 +
1238 +Default: `200`
1239 +
1240 +Type: `priority`
1241 +
1242 +#### `Swarm.Transports.Security.Noise`
1243 +
1244 +[Noise](https://github.com/libp2p/specs/tree/master/noise) is slated to replace
1245 +TLS as the cross-platform, default libp2p protocol due to ease of
1246 +implementation. It is currently enabled by default but with low priority as it's
1247 +not yet widely supported.
1248 +
1249 +Default: `300`
1250 +
1251 +Type: `priority`
1252 +
1253 +### `Swarm.Transports.Multiplexers`
1254 +
1255 +Configuration section for libp2p _multiplexer_ transports. Transports enabled in
1256 +this section will be used to multiplex duplex connections.
1257 +
1258 +Multiplexer transports are secured the same way security transports are, with
1259 +the `priority` type. Like with security transports, the initiator gets their
1260 +first choice.
1261 +
1262 +Supported transports are: Yamux (priority 100) and Mplex (priority 200)
1263 +
1264 +No default priority will ever be less than 100.
1265 +
1266 +### `Swarm.Transports.Multiplexers.Yamux`
1267 +
1268 +Yamux is the default multiplexer used when communicating between go-ipfs nodes.
1269 +
1270 +Default: `100`
1271 +
1272 +Type: `priority`
1273 +
1274 +### `Swarm.Transports.Multiplexers.Mplex`
1275 +
1276 +Mplex is the default multiplexer used when communicating between go-ipfs and all
1277 +other IPFS and libp2p implementations. Unlike Yamux:
1278 +
1279 +* Mplex is a simpler protocol.
1280 +* Mplex is more efficient.
1281 +* Mplex does not have built-in keepalives.
1282 +* Mplex does not support backpressure. Unfortunately, this means that, if a
1283 + single stream to a peer gets backed up for a period of time, the mplex
1284 + transport will kill the stream to allow the others to proceed. On the other
1285 + hand, the lack of backpressure means mplex can be significantly faster on some
1286 + high-latency connections.
1287 +
1288 +Default: `200`
1289 +
1290 +Type: `priority`
docs/environment-variables.md
+2
@@ -98,6 +98,8 @@ $ ipfs resolve -r /ipns/dnslink-test2.example.com
98
99 ## `LIBP2P_MUX_PREFS`
100
101 +Deprecated: Use the `Swarm.Transports.Multiplexers` config field.
102 +
103 Tells go-ipfs which multiplexers to use in which order.
104
105 Default: "/yamux/1.0.0 /mplex/6.7.0"
docs/experimental-features.md
+8 -3
@@ -550,12 +550,17 @@ Experimental, enabled by default
550
551 ### How to enable
552
553 -While the Noise transport is now shipped and enabled by default in go-ipfs, it won't be used by default for most connections because TLS and SECIO are currently preferred. If you'd like to test out the Noise transport, you can use the `Experimental.OverrideSecurityTransports` option to enable, disable, and reorder security transports.
553 +While the Noise transport is now shipped and enabled by default in go-ipfs, it won't be used by default for most connections because TLS and SECIO are currently preferred. If you'd like to test out the Noise transport, you can increase the priority of the noise transport:
554
555 -For example, to prefer noise over TLS and disable SECIO, run:
555 +```
556 +ipfs config --json Swarm.Transports.Security.Noise 1
557 +```
558 +
559 +Or even disable TLS and/or SECIO (not recommended for the moment):
560
561 ```
558 -ipfs config --json Experimental.OverrideSecurityTransports '["noise", "tls"]'
562 +ipfs config --json Swarm.Transports.Security.TLS false
563 +ipfs config --json Swarm.Transports.Security.SECIO false
564 ```
565
566 ### Road to being a real feature
go.mod
+3 -1
@@ -32,7 +32,7 @@ require (
32 github.com/ipfs/go-ipfs-blockstore v0.1.4
33 github.com/ipfs/go-ipfs-chunker v0.0.5
34 github.com/ipfs/go-ipfs-cmds v0.2.9
35 - github.com/ipfs/go-ipfs-config v0.7.1
35 + github.com/ipfs/go-ipfs-config v0.8.0
36 github.com/ipfs/go-ipfs-ds-help v0.1.1
37 github.com/ipfs/go-ipfs-exchange-interface v0.0.1
38 github.com/ipfs/go-ipfs-exchange-offline v0.0.1
@@ -83,6 +83,8 @@ require (
83 github.com/libp2p/go-libp2p-tls v0.1.3
84 github.com/libp2p/go-libp2p-yamux v0.2.8
85 github.com/libp2p/go-socket-activation v0.0.2
86 + github.com/libp2p/go-tcp-transport v0.2.0
87 + github.com/libp2p/go-ws-transport v0.3.1
88 github.com/mattn/go-runewidth v0.0.9 // indirect
89 github.com/miekg/dns v1.1.29 // indirect
90 github.com/mitchellh/go-homedir v1.1.0
go.sum
+2 -2
@@ -342,8 +342,8 @@ github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7Na
342 github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
343 github.com/ipfs/go-ipfs-cmds v0.2.9 h1:zQTENe9UJrtCb2bOtRoDGjtuo3rQjmuPdPnVlqoBV/M=
344 github.com/ipfs/go-ipfs-cmds v0.2.9/go.mod h1:ZgYiWVnCk43ChwoH8hAmI1IRbuVtq3GSTHwtRB/Kqhk=
345 -github.com/ipfs/go-ipfs-config v0.7.1 h1:57ZzoiUIbOIT01x1RconKtCv1MElV/6+kqW8hZY9NJ4=
346 -github.com/ipfs/go-ipfs-config v0.7.1/go.mod h1:GQUxqb0NfkZmEU92PxqqqLVVFTLpoGGUlBaTyDaAqrE=
345 +github.com/ipfs/go-ipfs-config v0.8.0 h1:4Tc7DC3dz4e7VadOjxXxFQGTQ1g7EYZClJ/ih8qOrxE=
346 +github.com/ipfs/go-ipfs-config v0.8.0/go.mod h1:GQUxqb0NfkZmEU92PxqqqLVVFTLpoGGUlBaTyDaAqrE=
347 github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
348 github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
349 github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
test/sharness/t0125-twonode.sh
+21 -12
@@ -89,38 +89,47 @@ test_expect_success "set up tcp testbed" '
89 iptb testbed create -type localipfs -count 2 -force -init
90 '
91
92 +addrs='"[\"/ip4/127.0.0.1/tcp/0\", \"/ip4/127.0.0.1/udp/0/quic\"]"'
93 +test_expect_success "configure addresses" '
94 + ipfsi 0 config --json Addresses.Swarm '"${addrs}"' &&
95 + ipfsi 1 config --json Addresses.Swarm '"${addrs}"'
96 +'
97 +
98 # Test TCP transport
99 echo "Testing TCP"
94 -tcp_addr='"[\"/ip4/127.0.0.1/tcp/0\"]"'
100 test_expect_success "use TCP only" '
96 - ipfsi 0 config --json Addresses.Swarm '${tcp_addr}' &&
97 - ipfsi 1 config --json Addresses.Swarm '${tcp_addr}'
101 + iptb run -- ipfs config --json Swarm.Transports.Network.QUIC false &&
102 + iptb run -- ipfs config --json Swarm.Transports.Network.Relay false &&
103 + iptb run -- ipfs config --json Swarm.Transports.Network.Websocket false
104 '
105 run_advanced_test
106
107 # test multiplex muxer
108 echo "Running advanced tests with mplex"
103 -export LIBP2P_MUX_PREFS="/mplex/6.7.0"
104 -run_advanced_test "--enable-mplex-experiment"
105 -unset LIBP2P_MUX_PREFS
109 +test_expect_success "disable yamux" '
110 + iptb run -- ipfs config --json Swarm.Transports.Multiplexers.Yamux false
111 +'
112 +run_advanced_test
113 +
114 +test_expect_success "re-enable yamux" '
115 + iptb run -- ipfs config --json Swarm.Transports.Multiplexers.Yamux null
116 +'
117
118 # test Noise
119
120 echo "Running advanced tests with NOISE"
110 -noise_transports='"[\"noise\"]"'
121 test_expect_success "use noise only" '
112 - ipfsi 0 config --json Experimental.OverrideSecurityTransports '${noise_transports}' &&
113 - ipfsi 1 config --json Experimental.OverrideSecurityTransports '${noise_transports}'
122 + iptb run -- ipfs config --json Swarm.Transports.Security.TLS false &&
123 + iptb run -- ipfs config --json Swarm.Transports.Security.Secio false
124 '
125
126 run_advanced_test
127
128 # test QUIC
129 echo "Running advanced tests over QUIC"
120 -addr1='"[\"/ip4/127.0.0.1/udp/0/quic\"]"'
130 test_expect_success "use QUIC only" '
122 - ipfsi 0 config --json Addresses.Swarm '${quic_addr}' &&
123 - ipfsi 1 config --json Addresses.Swarm '${quic_addr}'
131 + iptb run -- ipfs config --json Swarm.Transports.Network.QUIC true &&
132 + iptb run -- ipfs config --json Swarm.Transports.Network.TCP false
133 '
134
135 run_advanced_test
test/sharness/t0130-multinode.sh
+11 -8
@@ -88,24 +88,27 @@ test_expect_success "set up /tcp testbed" '
88 iptb testbed create -type localipfs -count 5 -force -init
89 '
90
91 -# test multiplex muxer
92 -export LIBP2P_MUX_PREFS="/mplex/6.7.0"
91 +# test default configuration
92 run_advanced_test
94 -unset LIBP2P_MUX_PREFS
93
96 -# test default configuration
94 +# test multiplex muxer
95 +test_expect_success "disable yamux" '
96 + iptb run -- ipfs config --json Swarm.Transports.Multiplexers.Yamux false
97 +'
98 run_advanced_test
99
100 test_expect_success "set up /ws testbed" '
101 iptb testbed create -type localipfs -count 5 -attr listentype,ws -force -init
102 '
103
104 +# test default configuration
105 +run_advanced_test
106 +
107 # test multiplex muxer
104 -export LIBP2P_MUX_PREFS="/mplex/6.7.0"
105 -run_advanced_test "--enable-mplex-experiment"
106 -unset LIBP2P_MUX_PREFS
108 +test_expect_success "disable yamux" '
109 + iptb run -- ipfs config --json Swarm.Transports.Multiplexers.Yamux false
110 +'
111
108 -# test default configuration
112 run_advanced_test
113
114
test/sharness/t0190-quic-ping.sh
+2 -2
@@ -11,8 +11,8 @@ test_expect_success 'init iptb' '
11 iptb testbed create -type localipfs -count 2 -init
12 '
13
14 -addr1='"[\"/ip4/127.0.0.1/udp/0/quic/\"]"'
15 -addr2='"[\"/ip4/127.0.0.1/udp/0/quic/\"]"'
14 +addr1='"[\"/ip4/127.0.0.1/udp/0/quic\"]"'
15 +addr2='"[\"/ip4/127.0.0.1/udp/0/quic\"]"'
16 test_expect_success "add QUIC swarm addresses" '
17 ipfsi 0 config --json Addresses.Swarm '$addr1' &&
18 ipfsi 1 config --json Addresses.Swarm '$addr2'
test/sharness/t0191-noise.sh
+6 -6
@@ -11,14 +11,14 @@ test_expect_success 'init iptb' '
11 iptb testbed create -type localipfs -count 3 -init
12 '
13
14 -noise_transports='"[\"noise\"]"'
15 -other_transports='"[\"tls\",\"secio\"]"'
14 tcp_addr='"[\"/ip4/127.0.0.1/tcp/0\"]"'
15 test_expect_success "configure security transports" '
18 - ipfsi 0 config --json Experimental.OverrideSecurityTransports '${noise_transports}' &&
19 - ipfsi 1 config --json Experimental.OverrideSecurityTransports '${noise_transports}' &&
20 - ipfsi 2 config --json Experimental.OverrideSecurityTransports '${other_transports}' &&
21 - iptb run -- ipfs config --json Addresses.Swarm '${tcp_addr}'
16 +iptb run <<CMDS
17 + [0,1] -- ipfs config --json Swarm.Transports.Security.TLS false &&
18 + [0,1] -- ipfs config --json Swarm.Transports.Security.SECIO false &&
19 + 2 -- ipfs config --json Swarm.Transports.Security.Noise false &&
20 + -- ipfs config --json Addresses.Swarm '${tcp_addr}'
21 +CMDS
22 '
23
24 startup_cluster 2