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 25, 2019
1 parent c1bc202 commit 12f6bee
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions core/node/libp2p/libp2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,19 @@ func AutoNATService(mctx helpers.MetricsCtx, lc fx.Lifecycle, cfg *config.Config
if !cfg.Swarm.EnableAutoNATService {
return nil
}
var opts []libp2p.Option

// collect private net option in case swarm.key is presented
opts, _, err := P2PPNet(repo)
if err != nil {
// swarm key exists but was failed to decode
return err
}

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(helpers.LifecycleCtx(mctx, lc), host, opts...)
_, err = autonat.NewAutoNATService(helpers.LifecycleCtx(mctx, lc), host, opts.Opts...)
return err
}

Expand Down

0 comments on commit 12f6bee

Please sign in to comment.