Skip to content

Commit b0293fe

Browse files
authored
Merge pull request #7204 from filecoin-project/feat/natmap-config
config for disabling NAT port mapping
2 parents 7db4dda + 3708a7a commit b0293fe

3 files changed

Lines changed: 33 additions & 6 deletions

File tree

node/builder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ var LibP2P = Options(
195195
Override(new(routing.Routing), lp2p.Routing),
196196

197197
// Services
198-
Override(NatPortMapKey, lp2p.NatPortMap),
199198
Override(BandwidthReporterKey, lp2p.BandwidthCounter),
200199
Override(AutoNATSvcKey, lp2p.AutoNATService),
201200

@@ -277,6 +276,8 @@ func ConfigCommon(cfg *config.Common, enableLibp2pNode bool) Option {
277276
Override(AddrsFactoryKey, lp2p.AddrsFactory(
278277
cfg.Libp2p.AnnounceAddresses,
279278
cfg.Libp2p.NoAnnounceAddresses)),
279+
280+
If(!cfg.Libp2p.DisableNatPortMap, Override(NatPortMapKey, lp2p.NatPortMap)),
280281
),
281282
Override(new(dtypes.MetadataDS), modules.Datastore(cfg.Backup.DisableMetadataLog)),
282283
)

node/config/doc_gen.go

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/config/types.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,21 @@ type Libp2p struct {
292292
BootstrapPeers []string
293293
ProtectedPeers []string
294294

295-
ConnMgrLow uint
296-
ConnMgrHigh uint
295+
// When not disabled (default), lotus asks NAT devices (e.g., routers), to
296+
// open up an external port and forward it to the port lotus is running on.
297+
// When this works (i.e., when your router supports NAT port forwarding),
298+
// it makes the local lotus node accessible from the public internet
299+
DisableNatPortMap bool
300+
301+
// ConnMgrLow is the number of connections that the basic connection manager
302+
// will trim down to.
303+
ConnMgrLow uint
304+
// ConnMgrHigh is the number of connections that, when exceeded, will trigger
305+
// a connection GC operation. Note: protected/recently formed connections don't
306+
// count towards this limit.
307+
ConnMgrHigh uint
308+
// ConnMgrGrace is a time duration that new connections are immune from being
309+
// closed by the connection manager.
297310
ConnMgrGrace Duration
298311
}
299312

0 commit comments

Comments
 (0)