summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/components/Connect.js10
-rw-r--r--app/config.json6
-rw-r--r--app/containers/ConnectPage.js2
-rw-r--r--app/containers/SelectLocationPage.js8
-rw-r--r--app/lib/backend.js12
-rw-r--r--app/lib/ipc-facade.js12
-rw-r--r--app/redux/connection/actions.js9
-rw-r--r--app/redux/connection/reducers.js4
8 files changed, 41 insertions, 22 deletions
diff --git a/app/components/Connect.js b/app/components/Connect.js
index 7d6269655a..66696fef64 100644
--- a/app/components/Connect.js
+++ b/app/components/Connect.js
@@ -10,6 +10,7 @@ import ExternalLinkSVG from '../assets/images/icon-extLink.svg';
import type { ServerInfo } from '../lib/backend';
import type { HeaderBarStyle } from './HeaderBar';
import type { ConnectionReduxState } from '../redux/connection/reducers';
+import type { RelayEndpoint } from '../lib/ipc-facade';
export type ConnectProps = {
accountExpiry: string,
@@ -17,7 +18,7 @@ export type ConnectProps = {
preferredServer: string,
onSettings: () => void,
onSelectLocation: () => void,
- onConnect: (address: string) => void,
+ onConnect: (relayEndpoint: RelayEndpoint) => void,
onCopyIP: () => void,
onDisconnect: () => void,
onExternalLink: (type: string) => void,
@@ -301,7 +302,12 @@ export default class Connect extends Component {
const preferredServer = this.props.preferredServer;
const serverInfo = this.props.getServerInfo(preferredServer);
if(serverInfo) {
- this.props.onConnect(serverInfo.address);
+ // TODO: Don't use these hardcoded values
+ this.props.onConnect({
+ host: serverInfo.address,
+ port: 1300,
+ protocol: 'udp',
+ });
}
}
diff --git a/app/config.json b/app/config.json
index d6cd2993f0..fe8d12d84a 100644
--- a/app/config.json
+++ b/app/config.json
@@ -132,8 +132,8 @@
8.541694
]
},
- "uk.mullvad.net": {
- "address": "uk.mullvad.net",
+ "gb.mullvad.net": {
+ "address": "gb.mullvad.net",
"name": "United Kingdom",
"city": "London",
"country": "United Kingdom",
@@ -153,4 +153,4 @@
]
}
}
-} \ No newline at end of file
+}
diff --git a/app/containers/ConnectPage.js b/app/containers/ConnectPage.js
index ceb16054ce..d629e83fc7 100644
--- a/app/containers/ConnectPage.js
+++ b/app/containers/ConnectPage.js
@@ -21,7 +21,7 @@ const mapDispatchToProps = (dispatch, props) => {
return {
onSettings: () => dispatch(push('/settings')),
onSelectLocation: () => dispatch(push('/select-location')),
- onConnect: (addr) => connect(backend, addr),
+ onConnect: (relayEndpoint) => connect(backend, relayEndpoint),
onCopyIP: () => copyIPAddress(),
onDisconnect: () => disconnect(backend),
onExternalLink: (type) => shell.openExternal(links[type]),
diff --git a/app/containers/SelectLocationPage.js b/app/containers/SelectLocationPage.js
index 824274c15c..c11c4b59dd 100644
--- a/app/containers/SelectLocationPage.js
+++ b/app/containers/SelectLocationPage.js
@@ -18,7 +18,13 @@ const mapDispatchToProps = (dispatch, props) => {
// add delay to let the map load
setTimeout(() => {
settings.updateSettings({ preferredServer });
- backend.connect(server.address);
+
+ // TODO: Don't use these hardcoded values
+ backend.connect({
+ host: server.address,
+ port: 1300,
+ protocol: 'udp',
+ });
}, 600);
}
};
diff --git a/app/lib/backend.js b/app/lib/backend.js
index 9567c91fd7..9d451960e4 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -11,6 +11,7 @@ import { push } from 'react-router-redux';
import type { BackendState } from './ipc-facade';
import type { ConnectionState } from '../redux/connection/reducers';
+import type { RelayEndpoint } from './ipc-facade';
export type EventType = 'connect' | 'connecting' | 'disconnect' | 'login' | 'logging' | 'logout' | 'updatedIp' | 'updatedLocation' | 'updatedReachability';
export type ErrorType = 'NO_CREDIT' | 'NO_INTERNET' | 'INVALID_ACCOUNT';
@@ -129,7 +130,7 @@ export class Backend {
fastestServer(): ServerInfo {
return {
- address: 'uk.mullvad.net',
+ address: 'gb.mullvad.net',
name: 'Fastest',
city: 'London',
country: 'United Kingdom',
@@ -227,17 +228,16 @@ export class Backend {
});
}
- connect(addr: string): Promise<void> {
+ connect(relayEndpoint: RelayEndpoint): Promise<void> {
- this._store.dispatch(connectionActions.connectingTo(addr));
+ this._store.dispatch(connectionActions.connectingTo(relayEndpoint));
-
- return this._ipc.setCountry(addr)
+ return this._ipc.setCustomRelay(relayEndpoint)
.then( () => {
return this._ipc.connect();
})
.catch(e => {
- log.info('Failed connecting to', addr, e);
+ log.info('Failed connecting to', relayEndpoint.host, '-', e.message);
this._store.dispatch(connectionActions.disconnected());
});
}
diff --git a/app/lib/ipc-facade.js b/app/lib/ipc-facade.js
index 063dfd11ae..736d4fc31c 100644
--- a/app/lib/ipc-facade.js
+++ b/app/lib/ipc-facade.js
@@ -25,13 +25,19 @@ export type BackendState = {
state: SecurityState,
target_state: SecurityState,
};
+export type RelayEndpoint = {
+ host: string,
+ port: number,
+ protocol: 'tcp' | 'udp',
+};
+
export interface IpcFacade {
setConnectionString(string): void,
getAccountData(AccountToken): Promise<AccountData>,
getAccount(): Promise<?AccountToken>,
setAccount(accountToken: AccountToken): Promise<void>,
- setCountry(address: string): Promise<void>,
+ setCustomRelay(RelayEndpoint): Promise<void>,
connect(): Promise<void>,
disconnect(): Promise<void>,
getIp(): Promise<Ip>,
@@ -86,8 +92,8 @@ export class RealIpc implements IpcFacade {
return;
}
- setCountry(address: string): Promise<void> {
- return this._ipc.send('set_country', address)
+ setCustomRelay(relayEndpoint: RelayEndpoint): Promise<void> {
+ return this._ipc.send('set_custom_relay', [relayEndpoint])
.then(this._ignoreResponse);
}
diff --git a/app/redux/connection/actions.js b/app/redux/connection/actions.js
index eebc503a18..73a94fcc06 100644
--- a/app/redux/connection/actions.js
+++ b/app/redux/connection/actions.js
@@ -3,11 +3,12 @@
import { clipboard } from 'electron';
import type { Backend } from '../../lib/backend';
+import type { RelayEndpoint } from '../../lib/ipc-facade';
import type { ReduxGetState, ReduxDispatch } from '../store';
import type { Coordinate2d } from '../../types';
-const connect = (backend: Backend, addr: string) => () => backend.connect(addr);
+const connect = (backend: Backend, relay: RelayEndpoint) => () => backend.connect(relay);
const disconnect = (backend: Backend) => () => backend.disconnect();
const copyIPAddress = () => {
return (_dispatch: ReduxDispatch, getState: ReduxGetState) => {
@@ -21,7 +22,7 @@ const copyIPAddress = () => {
type ConnectingAction = {
type: 'CONNECTING',
- serverAddress?: string,
+ relayEndpoint?: RelayEndpoint,
};
type ConnectedAction = {
type: 'CONNECTED',
@@ -62,10 +63,10 @@ export type ConnectionAction = NewPublicIpAction
| OnlineAction
| OfflineAction;
-function connectingTo(serverAddress: string): ConnectingAction {
+function connectingTo(relayEndpoint: RelayEndpoint): ConnectingAction {
return {
type: 'CONNECTING',
- serverAddress: serverAddress,
+ relayEndpoint: relayEndpoint,
};
}
diff --git a/app/redux/connection/reducers.js b/app/redux/connection/reducers.js
index 8f389df159..8adfac594a 100644
--- a/app/redux/connection/reducers.js
+++ b/app/redux/connection/reducers.js
@@ -62,8 +62,8 @@ function onConnecting(state, action) {
status: 'connecting',
};
- if (action.serverAddress) {
- newState.serverAddress = action.serverAddress;
+ if (action.relayEndpoint) {
+ newState.serverAddress = action.relayEndpoint.host;
}
return { ...state, ...newState};
}