add an experiment to prefer TLS 1.3 over secio
License: MIT Signed-off-by: Marten Seemann <martenseemann@gmail.com>
Marten Seemann committed
Apr 18, 2019 at 09:17 UTC
21d46bbe32ffb9ab6d87d9ae83cb44f55126ecc7
4 files changed
+27
-2
core/node/libp2p.go
+5
-1
@@ -362,7 +362,11 @@ func P2PSecurity(enabled bool) interface{} {
362
}
363
}
364
return func(cfg *config.Config) (opts Libp2pOpts) {
365
- opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2p.Security(secio.ID, secio.New), libp2p.Security(tls.ID, tls.New)))
365
+ if cfg.Experimental.PreferTLS {
366
+ opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2p.Security(tls.ID, tls.New), libp2p.Security(secio.ID, secio.New)))
367
+ } else {
368
+ opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2p.Security(secio.ID, secio.New), libp2p.Security(tls.ID, tls.New)))
369
+ }
370
return opts
371
}
372
}
docs/experimental-features.md
+19
@@ -683,3 +683,22 @@ ipfs config --json Swarm.EnableAutoNATService true
683
### Road to being a real feature
684
685
- [ ] needs testing
686
+
687
+
688
+## TLS 1.3 as default handshake protocol
689
+
690
+### State
691
+
692
+Every node accepts secio and TLS 1.3 connections, but prefers secio over TLS when dialing.
693
+
694
+### How to enable
695
+
696
+Modify your ipfs config:
697
+
698
+```
699
+ipfs config --json Experimental.PreferTLS true
700
+```
701
+
702
+### Road to being a real feature
703
+
704
+- [ ] needs testing
go.mod
+1
-1
@@ -34,7 +34,7 @@ require (
34
github.com/ipfs/go-ipfs-chunker v0.0.1
35
github.com/ipfs/go-ipfs-cmdkit v0.0.1
36
github.com/ipfs/go-ipfs-cmds v0.0.5
37
- github.com/ipfs/go-ipfs-config v0.0.1
37
+ github.com/ipfs/go-ipfs-config v0.0.2
38
github.com/ipfs/go-ipfs-ds-help v0.0.1
39
github.com/ipfs/go-ipfs-exchange-interface v0.0.1
40
github.com/ipfs/go-ipfs-exchange-offline v0.0.1
go.sum
+2
@@ -160,6 +160,8 @@ github.com/ipfs/go-ipfs-cmds v0.0.5 h1:+blTEnA0MzkQO86WnpfGnchdojrY5wJLhsbby3/JX
160
github.com/ipfs/go-ipfs-cmds v0.0.5/go.mod h1:1QVgxSgenZvOMGVC/XUTC7tJxRBGPLxYvpgPpCi3DUk=
161
github.com/ipfs/go-ipfs-config v0.0.1 h1:6ED08emzI1imdsAjixFi2pEyZxTVD5ECKtCOxLBx+Uc=
162
github.com/ipfs/go-ipfs-config v0.0.1/go.mod h1:KDbHjNyg4e6LLQSQpkgQMBz6Jf4LXiWAcmnkcwmH0DU=
163
+github.com/ipfs/go-ipfs-config v0.0.2 h1:gmSXTvsuqE6ES1bK9LziWNaEiVkV2Mu/9c50D0haVJY=
164
+github.com/ipfs/go-ipfs-config v0.0.2/go.mod h1:KDbHjNyg4e6LLQSQpkgQMBz6Jf4LXiWAcmnkcwmH0DU=
165
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
166
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
167
github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=