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

Improvement/naive detection of nat #292

Merged
merged 3 commits into from Jul 12, 2018

Conversation

Projects
None yet
3 participants
@tadovas
Copy link
Member

commented Jul 12, 2018

No description provided.

@tadovas tadovas requested review from Waldz and zolia Jul 12, 2018

@tadovas tadovas requested a review from donce as a code owner Jul 12, 2018

@tadovas tadovas changed the base branch from master to release/0.2 Jul 12, 2018

@tadovas tadovas force-pushed the improvement/naive-detection-of-NAT branch from 064c483 to 5195372 Jul 12, 2018

@tadovas tadovas force-pushed the improvement/naive-detection-of-NAT branch from 5195372 to 4c52040 Jul 12, 2018

@@ -105,7 +110,16 @@ func (cmd *Command) Start() (err error) {
return err
}

sessionManager := cmd.sessionManagerFactory(primitives, vpnServerIP)
if outboundIP != publicIP {
log.Infof(

This comment has been minimized.

Copy link
@Waldz

Waldz Jul 12, 2018

Member

Should be higher level Error()

This comment has been minimized.

Copy link
@tadovas

tadovas Jul 12, 2018

Author Member

It's just a warning - not an error

// if for some reason we will need truly external IP, use GetPublicIP()
vpnServerIP, err := cmd.ipResolver.GetOutboundIP()
outboundIP, err := cmd.ipResolver.GetOutboundIP()

This comment has been minimized.

Copy link
@Waldz

Waldz Jul 12, 2018

Member

Aren't we doing option openvpn.ip with this?
For those who wants has different public IP and wats to map it in router

This comment has been minimized.

Copy link
@tadovas

tadovas Jul 12, 2018

Author Member

There is not such option at the moment. And this is a quick detection with posibility for user to take some action.

@Waldz Waldz changed the base branch from release/0.2 to master Jul 12, 2018

@Waldz Waldz changed the base branch from master to release/0.2 Jul 12, 2018

forwardInfo := fmt.Sprintf("%s:%v -> %s:%v", publicIP, options.OpenvpnPort, outboundIP, options.OpenvpnPort)
log.Warnf(
`WARNING: It seems that publicaly visible ip: [%s] does not match your local machines ip: [%s].
You should probaly need to do port forwarding on your router: %s.`,

This comment has been minimized.

Copy link
@Waldz

Waldz Jul 12, 2018

Member

..on your router: PUBLIC_IP:1194 -> MACHINE_IP:1194 e.g. %s:1194->%s:1194
and you can put example values from detected values

This comment has been minimized.

Copy link
@Waldz

Waldz Jul 12, 2018

Member

Sorry, did not see that it's already like that

This comment has been minimized.

Copy link
@tadovas

tadovas Jul 12, 2018

Author Member

👍

@@ -76,14 +77,14 @@ func (cmd *Command) Start() (err error) {
providerContact, err := cmd.dialogWaiter.Start()

// if for some reason we will need truly external IP, use GetPublicIP()
vpnServerIP, err := cmd.ipResolver.GetOutboundIP()
outboundIP, err := cmd.ipResolver.GetOutboundIP()

This comment has been minimized.

Copy link
@Waldz

Waldz Jul 12, 2018

Member

Sad that we do 2-3 requests. Is it possible to avoid it?

This comment has been minimized.

Copy link
@tadovas

tadovas Jul 12, 2018

Author Member

Without too much refactoring? Yes - by passing outboundIP to openvpnServiceAddress function as parameter instead of looking up it again inside. I can live with this approach :)

This comment has been minimized.

Copy link
@tadovas

tadovas Jul 12, 2018

Author Member

Fixed :) reduced ipify query to 1 request

@mysteriumnetwork mysteriumnetwork deleted a comment from tadovas Jul 12, 2018

@Waldz

Waldz approved these changes Jul 12, 2018

@zolia

zolia approved these changes Jul 12, 2018

Copy link
Member

left a comment

all good

@tadovas tadovas merged commit b84f64e into release/0.2 Jul 12, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@tadovas tadovas deleted the improvement/naive-detection-of-NAT branch Jul 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.