-
Notifications
You must be signed in to change notification settings - Fork 330
Allow to set traversal methods order #3758
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
Conversation
| // FlagTraversalOrder order of NAT traversal methods to be used for providing service. | ||
| FlagTraversal = cli.StringFlag{ | ||
| Name: "traversal", | ||
| Usage: "Comma separated order of NAT traversal methods to be used for providing service", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be useful to provide possible values here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are including all values as default. Here is how it looks in help:
--traversal value Comma separated order of NAT traversal methods to be used for providing service (default: "holepunching,upnp,manual")
p2p/listener.go
Outdated
| // acquiring extra ports for nat pinger if provider is behind nat, port mapping failed | ||
| // and no manual port forwarding is enabled. | ||
| func (m *listener) prepareLocalPorts(id, outboundIP string, tracer *trace.Tracer) (string, []int, []func(), error) { | ||
| func (m *listener) prepareLocalPorts(id string, tracer *trace.Tracer) (string, []int, []func(), nat.StartPorts, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point the returns values here should be remade. Adding one more return here is just more confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be wrapped into struct with meaningful names attached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to change it with the next couple of PRs. So merging like this now.
p2p/nat/hole_punching.go
Outdated
| } | ||
|
|
||
| return &natHolePunchingPort{ | ||
| pool: port.NewFixedRangePool(*udpPortRange), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wont this panic when ParseRange returns error and nil for udpPortRange?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, faced it with tests too, changed.
097d4d3 to
4246469
Compare
Codecov Report
@@ Coverage Diff @@
## master #3758 +/- ##
==========================================
- Coverage 43.61% 43.47% -0.14%
==========================================
Files 325 325
Lines 16689 16669 -20
==========================================
- Hits 7279 7247 -32
- Misses 8655 8674 +19
+ Partials 755 748 -7
Continue to review full report at Codecov.
|
#3588