diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-11-03 15:15:30 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-11-16 17:19:49 +0100 |
| commit | 29d055a7ebf4c97148e9212c580d5ef5f1c24cb4 (patch) | |
| tree | d957ea77ea4194028be9dada175ce9fcfde1d1b6 /gui/src | |
| parent | f9bebec26836aacb0c043a7b86482f2ae9c61495 (diff) | |
| download | mullvadvpn-29d055a7ebf4c97148e9212c580d5ef5f1c24cb4.tar.xz mullvadvpn-29d055a7ebf4c97148e9212c580d5ef5f1c24cb4.zip | |
Add IPC and RPC calls for updating dns options
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 9 | ||||
| -rw-r--r-- | gui/src/main/index.ts | 4 | ||||
| -rw-r--r-- | gui/src/renderer/app.tsx | 5 | ||||
| -rw-r--r-- | gui/src/shared/ipc-event-channel.ts | 6 |
4 files changed, 24 insertions, 0 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index 0252c22e13..c7f4ce8608 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -48,6 +48,7 @@ import { ProxySettings, VoucherResponse, TunnelProtocol, + IDnsOptions, } from '../shared/daemon-rpc-types'; import * as managementInterface from './management_interface/management_interface_grpc_pb'; @@ -452,6 +453,14 @@ export class DaemonRpc { }; } + public async setDnsOptions(dns: IDnsOptions): Promise<void> { + const dnsOptions = new grpcTypes.DnsOptions(); + dnsOptions.setCustom(dns.custom); + dnsOptions.setAddressesList(dns.addresses); + + await this.call<grpcTypes.DnsOptions, Empty>(this.client.setDnsOptions, dnsOptions); + } + public async verifyWireguardKey(): Promise<boolean> { const response = await this.callEmpty<BoolValue>(this.client.verifyWireguardKey); return response.getValue(); diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 9e7e9e931c..d780e8e128 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -15,6 +15,7 @@ import { DaemonEvent, IAccountData, IAppVersionInfo, + IDnsOptions, ILocation, IRelayList, ISettings, @@ -988,6 +989,9 @@ class ApplicationMain { IpcMainEventChannel.settings.handleUpdateBridgeSettings((bridgeSettings: BridgeSettings) => { return this.daemonRpc.setBridgeSettings(bridgeSettings); }); + IpcMainEventChannel.settings.handleDnsOptions((dns: IDnsOptions) => { + return this.daemonRpc.setDnsOptions(dns); + }); IpcMainEventChannel.autoStart.handleSet((autoStart: boolean) => { return this.setAutoStart(autoStart); }); diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index c24874b9a6..17e117f739 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -32,6 +32,7 @@ import { BridgeState, IAccountData, IAppVersionInfo, + IDnsOptions, ILocation, IRelayList, ISettings, @@ -303,6 +304,10 @@ export default class AppRenderer { return IpcRendererEventChannel.settings.updateBridgeSettings(bridgeSettings); } + public setDnsOptions(dns: IDnsOptions) { + return IpcRendererEventChannel.settings.setDnsOptions(dns); + } + public removeAccountFromHistory(accountToken: AccountToken): Promise<void> { return IpcRendererEventChannel.accountHistory.removeItem(accountToken); } diff --git a/gui/src/shared/ipc-event-channel.ts b/gui/src/shared/ipc-event-channel.ts index 5cd1d22098..a7410dd22c 100644 --- a/gui/src/shared/ipc-event-channel.ts +++ b/gui/src/shared/ipc-event-channel.ts @@ -13,6 +13,7 @@ import { BridgeState, IAccountData, IAppVersionInfo, + IDnsOptions, ILocation, IRelayList, ISettings, @@ -78,6 +79,7 @@ interface ISettingsMethods extends IReceiver<ISettings> { setWireguardMtu(mtu?: number): Promise<void>; updateRelaySettings(update: RelaySettingsUpdate): Promise<void>; updateBridgeSettings(bridgeSettings: BridgeSettings): Promise<void>; + setDnsOptions(dns: IDnsOptions): Promise<void>; } interface ISettingsHandlers extends ISender<ISettings> { @@ -90,6 +92,7 @@ interface ISettingsHandlers extends ISender<ISettings> { handleWireguardMtu(fn: (mtu?: number) => Promise<void>): void; handleUpdateRelaySettings(fn: (update: RelaySettingsUpdate) => Promise<void>): void; handleUpdateBridgeSettings(fn: (bridgeSettings: BridgeSettings) => Promise<void>): void; + handleDnsOptions(fn: (dns: IDnsOptions) => Promise<void>): void; } interface IGuiSettingsMethods extends IReceiver<IGuiSettingsState> { @@ -188,6 +191,7 @@ const SET_OPENVPN_MSSFIX = 'set-openvpn-mssfix'; const SET_WIREGUARD_MTU = 'set-wireguard-mtu'; const UPDATE_RELAY_SETTINGS = 'update-relay-settings'; const UPDATE_BRIDGE_SETTINGS = 'update-bridge-location'; +const SET_DNS_OPTIONS = 'set-dns-options'; const LOCATION_CHANGED = 'location-changed'; const RELAYS_CHANGED = 'relays-changed'; @@ -275,6 +279,7 @@ export class IpcRendererEventChannel { setWireguardMtu: requestSender(SET_WIREGUARD_MTU), updateRelaySettings: requestSender(UPDATE_RELAY_SETTINGS), updateBridgeSettings: requestSender(UPDATE_BRIDGE_SETTINGS), + setDnsOptions: requestSender(SET_DNS_OPTIONS), }; public static location: IReceiver<ILocation> = { @@ -385,6 +390,7 @@ export class IpcMainEventChannel { handleWireguardMtu: requestHandler(SET_WIREGUARD_MTU), handleUpdateRelaySettings: requestHandler(UPDATE_RELAY_SETTINGS), handleUpdateBridgeSettings: requestHandler(UPDATE_BRIDGE_SETTINGS), + handleDnsOptions: requestHandler(SET_DNS_OPTIONS), }; public static relays: ISender<IRelayListPair> = { |
