Skip to content

Commit

Permalink
Fix AutoNAT service for private network
Browse files Browse the repository at this point in the history
  • Loading branch information
requilence committed Apr 24, 2019
1 parent cc2d66f commit 4dc2a12
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

2 comments on commit 4dc2a12

@GitCop
Copy link

@GitCop GitCop commented on 4dc2a12 Apr 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

@GitCop GitCop commented on 4dc2a12 Apr 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

Please sign in to comment.