Skip to content

Commit

Permalink
config for disabling NAT port mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Aug 27, 2021
1 parent 982a377 commit 17b7dce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion node/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ var LibP2P = Options(
Override(new(routing.Routing), lp2p.Routing),

// Services
Override(NatPortMapKey, lp2p.NatPortMap),
Override(BandwidthReporterKey, lp2p.BandwidthCounter),
Override(AutoNATSvcKey, lp2p.AutoNATService),

Expand Down Expand Up @@ -277,6 +276,8 @@ func ConfigCommon(cfg *config.Common, enableLibp2pNode bool) Option {
Override(AddrsFactoryKey, lp2p.AddrsFactory(
cfg.Libp2p.AnnounceAddresses,
cfg.Libp2p.NoAnnounceAddresses)),

If(!cfg.Libp2p.DisableNatPortMap, Override(NatPortMapKey, lp2p.NatPortMap)),
),
Override(new(dtypes.MetadataDS), modules.Datastore(cfg.Backup.DisableMetadataLog)),
)
Expand Down
9 changes: 9 additions & 0 deletions node/config/doc_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions node/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ type Libp2p struct {
BootstrapPeers []string
ProtectedPeers []string

// When not disabled (default), lotus asks NAT devices (e.g., routers), to
// open up an external port and forward it to the port lotus is running on.
// When this works (i.e., when your router supports NAT port forwarding),
// it makes the local lotus node accessible from the public internet
DisableNatPortMap bool

ConnMgrLow uint
ConnMgrHigh uint
ConnMgrGrace Duration
Expand Down

0 comments on commit 17b7dce

Please sign in to comment.