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

Disable port mapping for routers with a private IP #1890

Merged
merged 1 commit into from
Mar 17, 2020

Conversation

soffokl
Copy link
Member

@soffokl soffokl commented Mar 17, 2020

Closes #1850

@codecov-io
Copy link

Codecov Report

Merging #1890 into master will increase coverage by 0.05%.
The diff coverage is 78.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1890      +/-   ##
==========================================
+ Coverage   47.16%   47.22%   +0.05%     
==========================================
  Files         288      288              
  Lines       11790    11804      +14     
==========================================
+ Hits         5561     5574      +13     
- Misses       5786     5787       +1     
  Partials      443      443              
Impacted Files Coverage Δ
nat/mapping/port_mapping.go 83.60% <78.57%> (-1.50%) ⬇️
nat/traversal/pinger.go 75.73% <0.00%> (ø)
communication/nats/dialog/dialog_waiter.go 88.88% <0.00%> (+2.77%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c056f41...82d195d. Read the comment docs.


log.Debug().Msgf("Detected router public IP address: %s", ip)

for _, s := range []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"} {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe better to validate against IP oracle external IP instead of hardcoding these values. Some exotic private networks might be skipped here

Copy link
Contributor

Choose a reason for hiding this comment

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

There are no exotic private networks. Only these are considered by numeration standards. Everything else is either reserved for such things as multicasting or should be considered public.

@soffokl soffokl force-pushed the disable-portmapping-for-private-routers branch from 82d195d to c23d6ac Compare March 17, 2020 10:12
@soffokl soffokl merged commit d7a2dc2 into master Mar 17, 2020
@soffokl soffokl deleted the disable-portmapping-for-private-routers branch March 17, 2020 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable port-mapping if more than one NAT router detected
5 participants