diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-09-08 11:31:09 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-09-08 14:23:27 +0200 |
| commit | d541f4ee98182faa6c4e52727c948612b4d7ad53 (patch) | |
| tree | bb2e6eec41581f3018fbb22a6c9afb5962e23fb3 | |
| parent | 057f46bc30102b48b54775c4f43288c87e8203bb (diff) | |
| download | mullvadvpn-d541f4ee98182faa6c4e52727c948612b4d7ad53.tar.xz mullvadvpn-d541f4ee98182faa6c4e52727c948612b4d7ad53.zip | |
Replace setCountry with setCustomRelay
| -rw-r--r-- | app/lib/backend.js | 4 | ||||
| -rw-r--r-- | app/lib/ipc-facade.js | 10 | ||||
| -rw-r--r-- | test/connect.spec.js | 6 | ||||
| -rw-r--r-- | test/mocks/ipc.js | 2 |
4 files changed, 13 insertions, 9 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js index 9567c91fd7..9d1fb21d35 100644 --- a/app/lib/backend.js +++ b/app/lib/backend.js @@ -231,8 +231,8 @@ export class Backend { this._store.dispatch(connectionActions.connectingTo(addr)); - - return this._ipc.setCountry(addr) + // TODO: Don't hardcode these values + return this._ipc.setCustomRelay(addr, 1300, 'udp') .then( () => { return this._ipc.connect(); }) diff --git a/app/lib/ipc-facade.js b/app/lib/ipc-facade.js index 063dfd11ae..0a9ceebf65 100644 --- a/app/lib/ipc-facade.js +++ b/app/lib/ipc-facade.js @@ -31,7 +31,7 @@ export interface IpcFacade { getAccountData(AccountToken): Promise<AccountData>, getAccount(): Promise<?AccountToken>, setAccount(accountToken: AccountToken): Promise<void>, - setCountry(address: string): Promise<void>, + setCustomRelay(host: string, port: number, protocol: 'udp' | 'tcp'): Promise<void>, connect(): Promise<void>, disconnect(): Promise<void>, getIp(): Promise<Ip>, @@ -86,8 +86,12 @@ export class RealIpc implements IpcFacade { return; } - setCountry(address: string): Promise<void> { - return this._ipc.send('set_country', address) + setCustomRelay(host: string, port: number, protocol: 'udp' | 'tcp'): Promise<void> { + return this._ipc.send('set_custom_relay', { + host, + port, + protocol, + }) .then(this._ignoreResponse); } diff --git a/test/connect.spec.js b/test/connect.spec.js index 9ecedb53a1..98aba67356 100644 --- a/test/connect.spec.js +++ b/test/connect.spec.js @@ -7,13 +7,13 @@ import { IpcChain } from './helpers/IpcChain'; describe('connect', () => { - it('should invoke set_country and then connect in the backend', (done) => { + it('should invoke set_custom_relay and then connect in the backend', (done) => { const { store, mockIpc, backend } = setupBackendAndStore(); const chain = new IpcChain(mockIpc); - chain.require('setCountry') + chain.require('setCustomRelay') .withInputValidation( - (country) => expect(country).to.equal('example.com') + (relayHostName) => expect(relayHostName).to.equal('example.com') ) .done(); diff --git a/test/mocks/ipc.js b/test/mocks/ipc.js index d28c49e6f6..472811ef4c 100644 --- a/test/mocks/ipc.js +++ b/test/mocks/ipc.js @@ -27,7 +27,7 @@ export function newMockIpc() { setAccount: () => { return new Promise(r => r()); }, - setCountry: () => { + setCustomRelay: () => { return new Promise(r => r()); }, connect: () => { |
