Skip to content

Commit

Permalink
use the base host for autonat
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Dec 19, 2021
1 parent dd20a60 commit 8e6432a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import (
"github.com/libp2p/go-libp2p-peerstore/pstoremem"

"github.com/libp2p/go-libp2p/p2p/host/autorelay"
"github.com/libp2p/go-libp2p/p2p/host/base"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
routed "github.com/libp2p/go-libp2p/p2p/host/routed"
circuitv2 "github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client"
relayv2 "github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay"
"github.com/libp2p/go-libp2p/p2p/protocol/holepunch"

autonat "github.com/libp2p/go-libp2p-autonat"
blankhost "github.com/libp2p/go-libp2p-blankhost"
discovery "github.com/libp2p/go-libp2p-discovery"
swarm "github.com/libp2p/go-libp2p-swarm"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
Expand Down Expand Up @@ -312,7 +312,11 @@ func (cfg *Config) NewNode() (host.Host, error) {
h.Close()
return nil, err
}
dialerHost := blankhost.NewBlankHost(dialer)
dialerHost, err := base.NewHost(dialer)
if err != nil {
h.Close()
return nil, err
}
if err := autoNatCfg.addTransports(dialerHost); err != nil {
dialerHost.Close()
h.Close()
Expand Down

0 comments on commit 8e6432a

Please sign in to comment.