From 7ad6447453856f8a92bdd01fb02dbc9e8038e98c Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Tue, 3 May 2022 10:10:13 -0400 Subject: [PATCH] feat: enable hole-punching by default --- .circleci/main.yml | 2 +- core/node/libp2p/relay.go | 5 +++-- docs/config.md | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.circleci/main.yml b/.circleci/main.yml index ab7bc622b..8e3265dec 100644 --- a/.circleci/main.yml +++ b/.circleci/main.yml @@ -245,7 +245,7 @@ jobs: command: | npm init -y npm install ipfs@^0.61.0 - npm install ipfs-interop@^8.0.0 + npm install ipfs-interop@^8.0.10 npm install mocha-circleci-reporter@0.0.3 working_directory: ~/ipfs/go-ipfs/interop - run: diff --git a/core/node/libp2p/relay.go b/core/node/libp2p/relay.go index 5e218dcfe..06bf3d791 100644 --- a/core/node/libp2p/relay.go +++ b/core/node/libp2p/relay.go @@ -69,9 +69,10 @@ func AutoRelay(staticRelays []string, peerChan <-chan peer.AddrInfo) func() (opt func HolePunching(flag config.Flag, hasRelayClient bool) func() (opts Libp2pOpts, err error) { return func() (opts Libp2pOpts, err error) { - if flag.WithDefault(false) { + if flag.WithDefault(true) { if !hasRelayClient { - log.Fatal("To enable `Swarm.EnableHolePunching` requires `Swarm.RelayClient.Enabled` to be enabled.") + log.Fatal("Failed to enable `Swarm.EnableHolePunching`, it requires `Swarm.RelayClient.Enabled` to be true.") + return } opts.Opts = append(opts.Opts, libp2p.EnableHolePunching()) } diff --git a/docs/config.md b/docs/config.md index d80c7831a..0aa9e002d 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1383,7 +1383,7 @@ to [upgrade to a direct connection](https://github.com/libp2p/specs/blob/master/ through a NAT/firewall whenever possible. This feature requires `Swarm.RelayClient.Enabled` to be set to `true`. -Default: `false` +Default: `true` Type: `flag`