Conversation
5edea98 to
2ed7fa8
Compare
1acfc01 to
6228ea7
Compare
| case *traversal.NoopPinger: | ||
| log.Infof("noop pinger detected, returning nil client config.") | ||
| return nil, nil | ||
| } |
There was a problem hiding this comment.
It looks like configuration depends on implementation of traversal.Pinger - maybe it should provide the config to avoid type-conditionals?
There was a problem hiding this comment.
Not sure if it is a bad solution, since introducing another config dependency will additionally span throughout the code. Does if worth it?
6228ea7 to
7ac6338
Compare
7ac6338 to
79b0498
Compare
e8160ac to
af29200
Compare
| Parse(config json.RawMessage) (ip string, port int, serviceType services.ServiceType, err error) | ||
| } | ||
|
|
||
| type portSupplier interface { |
There was a problem hiding this comment.
We gave this interface in multiple places. Can't we define it once somewhere?
There are many examples of such definitions in a standard library: https://golang.org/pkg/io/#Reader
|
|
||
| // Params contains session parameters needed to NAT ping remote peer | ||
| type Params struct { | ||
| RequestConfig json.RawMessage |
There was a problem hiding this comment.
Why is it called RequesConfig?
Is it a config of the request?
There was a problem hiding this comment.
This config comes with session setup request.
Co-Authored-By: zolia <antanas@mysterium.network>
| } | ||
|
|
||
| log.Infof("%s ping target received: IP: %v, port: %v", prefix, IP, port) | ||
| log.Infof("%sping target received: IP: %v, port: %v", prefix, IP, port) |
There was a problem hiding this comment.
its not, its format string, prefix at the end.
vkuznecovas
left a comment
There was a problem hiding this comment.
I'm not sure about the moving of the ServicePortSupplier interface to a single spot and then having it referenced in other packages. You're adding hard coupling between the packages where there need not be any. I know it ain't DRY, but I'd rather have less coupling between the packages as you'll end up in a cyclic reference type of situation soon if you do that a lot.
But if everyone else is happy with this - I'm not going to block.
| "testing" | ||
|
|
||
| "github.com/mysteriumnetwork/node/core/port" | ||
|
|
There was a problem hiding this comment.
this whitespace is still redundant
| proposal := openvpn_discovery.NewServiceProposalWithLocation(currentLocation, transportOptions.Protocol) | ||
|
|
||
| var portSupplier port.ServicePortSupplier = di.PortPool | ||
| if transportOptions.Port != 0 && locationInfo.PubIP == locationInfo.OutIP { |
There was a problem hiding this comment.
I'm a bit surprised nobody noticed. This actually changes behavior in most cases (because most clients will have a router), and openvpn.port flag/option is ignored and thus it's always randomized (which causes problems for desktop clients, so for now we decided to use static port 1194 - passing it through options when starting service via tequilapi).
Why was this check needed: locationInfo.PubIP == locationInfo.OutIP? I can't find any useful info in commit messages. Any ideas, @zolia , @vkuznecovas ?
There was a problem hiding this comment.
locationInfo.PubIP == locationInfo.OutIP supposed to check if we are behind the NAT.
If IP on the host and public IP is the same, we, probably, don't need to do any NAT traversal since IP is reachable without it.
There was a problem hiding this comment.
True, but I think we should respect user flags despite this.
For future reference. I see upsides and downsides of such solution. In this case, if we have package which is very very feature isolated and self sustained. I think such packageS could expose more generic interfaces. In this case |
Implements NATProxy for OpenVPN.
What lacks: