summaryrefslogtreecommitdiffhomepage
path: root/app/lib
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-11-20 13:46:26 +0100
committerAndrej Mihajlov <and@mullvad.net>2017-11-23 12:41:13 +0100
commit36a84eca50eea4d5ff21fef829c675965d0114c3 (patch)
tree6d481728ac1dd67fd1412d2816d2575b5d26f520 /app/lib
parent5cbb22d21196a3dcef75455fda7dd686c1dfd001 (diff)
downloadmullvadvpn-36a84eca50eea4d5ff21fef829c675965d0114c3.tar.xz
mullvadvpn-36a84eca50eea4d5ff21fef829c675965d0114c3.zip
Add custom endpoint handling in syncRelaySettings
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/backend.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js
index 105af65fd0..17144339da 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -8,7 +8,6 @@ import accountActions from '../redux/account/actions';
import connectionActions from '../redux/connection/actions';
import settingsActions from '../redux/settings/actions';
import { push } from 'react-router-redux';
-import { defaultServer } from '../config';
import type { ReduxStore } from '../redux/store';
import type { AccountToken, BackendState, RelaySettingsUpdate } from './ipc-facade';
@@ -318,16 +317,19 @@ export class Backend {
.then( constraints => {
log.debug('Got constraints from backend', constraints);
- const host = constraints.host === 'any'
- ? defaultServer
- : constraints.host.only || defaultServer;
+ const { custom_tunnel_endpoint, normal } = constraints;
- const openvpn = constraints.tunnel.openvpn;
- this._store.dispatch(settingsActions.updateRelay({
- host: host,
- port: this._apiToReduxConstraints(openvpn.port),
- protocol: this._apiToReduxConstraints(openvpn.protocol),
- }));
+ if(normal) {
+ // TODO: handle normal constraints
+ log.warn('syncRelaySettings: Normal constraints are not implemented yet.');
+ } else if(custom_tunnel_endpoint) {
+ const { host, tunnel: { openvpn } } = custom_tunnel_endpoint;
+ this._store.dispatch(settingsActions.updateRelay({
+ host: host,
+ port: openvpn.port,
+ protocol: openvpn.protocol,
+ }));
+ }
})
.catch( e => {
log.error('Failed getting relay constraints', e);