Skip to content

Commit

Permalink
Fix AutoNAT service for private network
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Roman Khafizianov <requilence@gmail.com>
  • Loading branch information
requilence committed Apr 24, 2019
1 parent cc2d66f commit 3371d1e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/node/libp2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,16 +523,19 @@ func P2PPubsubRouter(mctx MetricsCtx, lc fx.Lifecycle, in p2pPSRoutingIn) (p2pRo
}, psRouter
}

func AutoNATService(mctx MetricsCtx, lc fx.Lifecycle, cfg *config.Config, host host.Host) error {
func AutoNATService(repo repo.Repo, mctx MetricsCtx, lc fx.Lifecycle, cfg *config.Config, host host.Host) error {
if !cfg.Swarm.EnableAutoNATService {
return nil
}
var opts []libp2p.Option

// collect private net option in case swarm.key is presented
opts, _, _ := P2PPNet(repo)

if cfg.Experimental.QUIC {
opts = append(opts, libp2p.DefaultTransports, libp2p.Transport(libp2pquic.NewTransport))
opts.Opts = append(opts.Opts, libp2p.DefaultTransports, libp2p.Transport(libp2pquic.NewTransport))
}

_, err := autonat.NewAutoNATService(lifecycleCtx(mctx, lc), host, opts...)
_, err := autonat.NewAutoNATService(lifecycleCtx(mctx, lc), host, opts.Opts...)
return err
}

Expand Down

0 comments on commit 3371d1e

Please sign in to comment.