Skip to content

Commit f28b8fc

Browse files
committed
feat: tls by default
Switches to TLS as the default security transports.
1 parent c6d0232 commit f28b8fc

File tree

6 files changed

+11
-29
lines changed

6 files changed

+11
-29
lines changed

core/node/groups.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option {
102102
fx.Invoke(libp2p.StartListening(cfg.Addresses.Swarm)),
103103
fx.Invoke(libp2p.SetupDiscovery(cfg.Discovery.MDNS.Enabled, cfg.Discovery.MDNS.Interval)),
104104

105-
fx.Provide(libp2p.Security(!bcfg.DisableEncryptedConnections, cfg.Experimental.PreferTLS)),
105+
fx.Provide(libp2p.Security(!bcfg.DisableEncryptedConnections)),
106106

107107
fx.Provide(libp2p.Routing),
108108
fx.Provide(libp2p.BaseRouting),

core/node/libp2p/transport.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
var DefaultTransports = simpleOpt(libp2p.DefaultTransports)
1212
var QUIC = simpleOpt(libp2p.Transport(libp2pquic.NewTransport))
1313

14-
func Security(enabled, preferTLS bool) interface{} {
14+
func Security(enabled bool) interface{} {
1515
if !enabled {
1616
return func() (opts Libp2pOpts) {
1717
// TODO: shouldn't this be Errorf to guarantee visibility?
@@ -22,11 +22,7 @@ func Security(enabled, preferTLS bool) interface{} {
2222
}
2323
}
2424
return func() (opts Libp2pOpts) {
25-
if preferTLS {
26-
opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2p.Security(tls.ID, tls.New), libp2p.Security(secio.ID, secio.New)))
27-
} else {
28-
opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2p.Security(secio.ID, secio.New), libp2p.Security(tls.ID, tls.New)))
29-
}
25+
opts.Opts = append(opts.Opts, libp2p.ChainOptions(libp2p.Security(tls.ID, tls.New), libp2p.Security(secio.ID, secio.New)))
3026
return opts
3127
}
3228
}

docs/examples/library-experimental-features/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ func createTempRepo(ctx context.Context) (string, error) {
5858
cfg.Experimental.P2pHttpProxy = true
5959
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#quic
6060
cfg.Experimental.QUIC = true
61-
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#tls-13-as-default-handshake-protocol
62-
cfg.Experimental.PreferTLS = true
6361
// https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#strategic-providing
6462
cfg.Experimental.StrategicProviding = true
6563

docs/experimental-features.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ For listening on a QUIC address, add it the swarm addresses, e.g. `/ip4/0.0.0.0/
632632

633633
### In Version
634634

635-
0.4.19-dev
635+
0.4.19
636636

637637
### State
638638

@@ -660,26 +660,14 @@ ipfs config --json Swarm.EnableAutoNATService true
660660

661661
## TLS 1.3 as default handshake protocol
662662

663-
### State
664-
665-
Every go-ipfs node (>=0.4.21) accepts secio and TLS 1.3 connections but prefers
666-
secio over TLS when dialing. To prefer TLS when dialing, you'll have to enable
667-
this feature.
668-
669-
### How to enable
663+
### In Version
670664

671-
Modify your ipfs config:
665+
0.5.0
672666

673-
```
674-
ipfs config --json Experimental.PreferTLS true
675-
```
676-
677-
### Road to being a real feature
667+
### State
678668

679-
- [ ] needs testing
680-
- [ ] needs adoption
669+
Stable
681670

682-
---
683671

684672
## Strategic Providing
685673

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require (
3131
github.com/ipfs/go-ipfs-blockstore v0.1.4
3232
github.com/ipfs/go-ipfs-chunker v0.0.5
3333
github.com/ipfs/go-ipfs-cmds v0.1.4
34-
github.com/ipfs/go-ipfs-config v0.3.0
34+
github.com/ipfs/go-ipfs-config v0.4.0
3535
github.com/ipfs/go-ipfs-ds-help v0.1.1
3636
github.com/ipfs/go-ipfs-exchange-interface v0.0.1
3737
github.com/ipfs/go-ipfs-exchange-offline v0.0.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7Na
246246
github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
247247
github.com/ipfs/go-ipfs-cmds v0.1.4 h1:l5QAc1iaoMZeBd2vpanrHWs26haEBL4PVqgoHJNG2GE=
248248
github.com/ipfs/go-ipfs-cmds v0.1.4/go.mod h1:wm+C6M8FYDcWPU/EdWqMuHvdyWborFh+GuDl6Ov6sM0=
249-
github.com/ipfs/go-ipfs-config v0.3.0 h1:fGs3JBqB9ia/Joi8up47uiKn150EOEqqVFwv8HZqXao=
250-
github.com/ipfs/go-ipfs-config v0.3.0/go.mod h1:nSLCFtlaL+2rbl3F+9D4gQZQbT1LjRKx7TJg/IHz6oM=
249+
github.com/ipfs/go-ipfs-config v0.4.0 h1:MOXdj8EYQG55v1y+5e1QcctDKPEGobdwnXaDVa0/cc0=
250+
github.com/ipfs/go-ipfs-config v0.4.0/go.mod h1:nSLCFtlaL+2rbl3F+9D4gQZQbT1LjRKx7TJg/IHz6oM=
251251
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
252252
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
253253
github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=

0 commit comments

Comments
 (0)