Skip to content

Commit 126ebc4

Browse files
authored
Merge pull request #8748 from ipfs/feat/dcutr-hole-punching-on-by-default
feat: EnableHolePunching by default
2 parents 0d74f32 + 185971b commit 126ebc4

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

.circleci/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ jobs:
245245
command: |
246246
npm init -y
247247
npm install ipfs@^0.61.0
248-
npm install ipfs-interop@^8.0.0
248+
npm install ipfs-interop@^8.0.10
249249
npm install [email protected]
250250
working_directory: ~/ipfs/go-ipfs/interop
251251
- run:

core/node/libp2p/relay.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,16 @@ func AutoRelay(staticRelays []string, peerChan <-chan peer.AddrInfo) func() (opt
6969

7070
func HolePunching(flag config.Flag, hasRelayClient bool) func() (opts Libp2pOpts, err error) {
7171
return func() (opts Libp2pOpts, err error) {
72-
if flag.WithDefault(false) {
72+
if flag.WithDefault(true) {
7373
if !hasRelayClient {
74-
log.Fatal("To enable `Swarm.EnableHolePunching` requires `Swarm.RelayClient.Enabled` to be enabled.")
74+
// If hole punching is explicitly enabled but the relay client is disabled then panic,
75+
// otherwise just silently disable hole punching
76+
if flag != config.Default {
77+
log.Fatal("Failed to enable `Swarm.EnableHolePunching`, it requires `Swarm.RelayClient.Enabled` to be true.")
78+
} else {
79+
log.Info("HolePunching has been disabled due to the RelayClient being disabled.")
80+
}
81+
return
7582
}
7683
opts.Opts = append(opts.Opts, libp2p.EnableHolePunching())
7784
}

docs/config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ to [upgrade to a direct connection](https://github.com/libp2p/specs/blob/master/
13831383
through a NAT/firewall whenever possible.
13841384
This feature requires `Swarm.RelayClient.Enabled` to be set to `true`.
13851385

1386-
Default: `false`
1386+
Default: `true`
13871387

13881388
Type: `flag`
13891389

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ require (
6868
github.com/jbenet/go-temp-err-catcher v0.1.0
6969
github.com/jbenet/goprocess v0.1.4
7070
github.com/libp2p/go-doh-resolver v0.4.0
71-
github.com/libp2p/go-libp2p v0.19.0
71+
github.com/libp2p/go-libp2p v0.19.1
7272
github.com/libp2p/go-libp2p-connmgr v0.3.2-0.20220115145817-a7820a5879c7 // indirect
7373
github.com/libp2p/go-libp2p-core v0.15.1
7474
github.com/libp2p/go-libp2p-discovery v0.6.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ github.com/libp2p/go-libp2p v0.13.0/go.mod h1:pM0beYdACRfHO1WcJlp65WXyG2A6NqYM+t
764764
github.com/libp2p/go-libp2p v0.14.3/go.mod h1:d12V4PdKbpL0T1/gsUNN8DfgMuRPDX8bS2QxCZlwRH0=
765765
github.com/libp2p/go-libp2p v0.14.4/go.mod h1:EIRU0Of4J5S8rkockZM7eJp2S0UrCyi55m2kJVru3rM=
766766
github.com/libp2p/go-libp2p v0.16.0/go.mod h1:ump42BsirwAWxKzsCiFnTtN1Yc+DuPu76fyMX364/O4=
767-
github.com/libp2p/go-libp2p v0.19.0 h1:zosskMbaobL7UDCVLEe1m5CGs1TaFNFoN/M5XLiKg0U=
768-
github.com/libp2p/go-libp2p v0.19.0/go.mod h1:Ki9jJXLO2YqrTIFxofV7Twyd3INWPT97+r8hGt7XPjI=
767+
github.com/libp2p/go-libp2p v0.19.1 h1:ysBA1vDxhvgy9WmXpDeuk082EakewbJAwfU+ApdTG6I=
768+
github.com/libp2p/go-libp2p v0.19.1/go.mod h1:Ki9jJXLO2YqrTIFxofV7Twyd3INWPT97+r8hGt7XPjI=
769769
github.com/libp2p/go-libp2p-asn-util v0.0.0-20200825225859-85005c6cf052/go.mod h1:nRMRTab+kZuk0LnKZpxhOVH/ndsdr2Nr//Zltc/vwgo=
770770
github.com/libp2p/go-libp2p-asn-util v0.1.0/go.mod h1:wu+AnM9Ii2KgO5jMmS1rz9dvzTdj8BXqsPR9HR0XB7I=
771771
github.com/libp2p/go-libp2p-asn-util v0.2.0 h1:rg3+Os8jbnO5DxkC7K/Utdi+DkY3q/d1/1q+8WeNAsw=

0 commit comments

Comments
 (0)