Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config for disabling NAT port mapping #7204

Merged
merged 2 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
19 changes: 16 additions & 3 deletions node/config/doc_gen.go

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

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

ConnMgrLow uint
ConnMgrHigh uint
// 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 is the number of connections that the basic connection manager
// will trim down to.
ConnMgrLow uint
// ConnMgrHigh is the number of connections that, when exceeded, will trigger
// a connection GC operation. Note: protected/recently formed connections don't
// count towards this limit.
ConnMgrHigh uint
// ConnMgrGrace is a time duration that new connections are immune from being
// closed by the connection manager.
ConnMgrGrace Duration
}

Expand Down