@cryptotaxi247 / kubo / commits / 4714c0cec

feat: enable QUIC by default

But only if private networks are disabled.

Steven Allen committed May 22, 2020 at 13:48 UTC 4714c0ceccd9808b89a4e62783997962a7af9f68
2 files changed +13 -3
core/node/groups.go
+1 -1
@@ -26,7 +26,7 @@ var BaseLibP2P = fx.Options(
26 fx.Provide(libp2p.UserAgent),
27 fx.Provide(libp2p.PNet),
28 fx.Provide(libp2p.ConnectionManager),
29 - fx.Provide(libp2p.DefaultTransports),
29 + fx.Provide(libp2p.Transports),
30
31 fx.Provide(libp2p.Host),
32
core/node/libp2p/transport.go
+12 -2
@@ -6,10 +6,20 @@ import (
6 libp2pquic "github.com/libp2p/go-libp2p-quic-transport"
7 secio "github.com/libp2p/go-libp2p-secio"
8 tls "github.com/libp2p/go-libp2p-tls"
9 +
10 + "go.uber.org/fx"
11 )
12
11 -var DefaultTransports = simpleOpt(libp2p.ChainOptions(libp2p.DefaultTransports, libp2p.Transport(libp2pquic.NewTransport)))
12 -var QUIC = simpleOpt(libp2p.Transport(libp2pquic.NewTransport))
13 +func Transports(pnet struct {
14 + fx.In
15 + Fprint PNetFingerprint `optional:"true"`
16 +}) (opts Libp2pOpts) {
17 + opts.Opts = append(opts.Opts, libp2p.DefaultTransports)
18 + if pnet.Fprint == nil {
19 + opts.Opts = append(opts.Opts, libp2p.Transport(libp2pquic.NewTransport))
20 + }
21 + return opts
22 +}
23
24 func Security(enabled bool) interface{} {
25 if !enabled {