Skip to content

Commit

Permalink
feat: Swarm.EnableHolePunching by default
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Apr 19, 2022
1 parent 3d29088 commit f63bbfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions core/node/libp2p/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
2 changes: 1 addition & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,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`

Expand Down

0 comments on commit f63bbfd

Please sign in to comment.