Skip to content

Commit 6d95d36

Browse files
committed
Merge branch 'custom-dns-ui'
2 parents 765f777 + 6332e99 commit 6d95d36

File tree

16 files changed

+607
-17
lines changed

16 files changed

+607
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,13 @@ Line wrap the file at 100 chars. Th
2828
- Add `--wait` flag to `connect`, `disconnect` and `reconnect` CLI subcommands to make the CLI wait
2929
for the target state to be reached before exiting.
3030
- Navigate back to the main view when escape is pressed.
31-
32-
#### Windows
33-
- Add support for custom DNS resolvers (CLI only).
31+
- Add support for custom DNS resolvers.
3432

3533
#### Linux
3634
- Optionally use NetworkManager to create WireGuard devices.
37-
- Add support for custom DNS resolvers (CLI only).
3835
- Disable NetworkManager's connectivity check before applying firewall rules to avoid triggerring
3936
NetworkManager's [bug](https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/312#note_453724)
4037

41-
#### macOS
42-
- Add support for custom DNS resolvers (CLI only).
43-
4438
### Changed
4539
- Use the API to fetch API IP addresses instead of DNS.
4640
- Remove WireGuard keys during uninstallation after the firewall is unlocked.

gui/assets/images/icon-add.svg

Lines changed: 8 additions & 0 deletions
Loading

gui/package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gui/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"electron-log": "^4.1.1",
1919
"gettext-parser": "^4.0.3",
2020
"google-protobuf": "^4.0.0-rc.2",
21+
"ip": "^1.1.5",
2122
"linux-app-list": "^1.0.1",
2223
"mkdirp": "^1.0.3",
2324
"moment": "^2.24.0",
@@ -46,6 +47,7 @@
4647
"@types/gettext-parser": "^4.0.0",
4748
"@types/google-protobuf": "^3.7.2",
4849
"@types/history": "^4.7.8",
50+
"@types/ip": "^1.1.0",
4951
"@types/mkdirp": "^1.0.0",
5052
"@types/mocha": "^5.2.6",
5153
"@types/node": "^10.12.3",

gui/src/main/daemon-rpc.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
ProxySettings,
4949
VoucherResponse,
5050
TunnelProtocol,
51+
IDnsOptions,
5152
} from '../shared/daemon-rpc-types';
5253

5354
import * as managementInterface from './management_interface/management_interface_grpc_pb';
@@ -452,6 +453,14 @@ export class DaemonRpc {
452453
};
453454
}
454455

456+
public async setDnsOptions(dns: IDnsOptions): Promise<void> {
457+
const dnsOptions = new grpcTypes.DnsOptions();
458+
dnsOptions.setCustom(dns.custom);
459+
dnsOptions.setAddressesList(dns.addresses);
460+
461+
await this.call<grpcTypes.DnsOptions, Empty>(this.client.setDnsOptions, dnsOptions);
462+
}
463+
455464
public async verifyWireguardKey(): Promise<boolean> {
456465
const response = await this.callEmpty<BoolValue>(this.client.verifyWireguardKey);
457466
return response.getValue();
@@ -1029,6 +1038,10 @@ function convertFromTunnelOptions(tunnelOptions: grpcTypes.TunnelOptions.AsObjec
10291038
generic: {
10301039
enableIpv6: tunnelOptions.generic!.enableIpv6,
10311040
},
1041+
dns: {
1042+
custom: tunnelOptions.dnsOptions?.custom ?? false,
1043+
addresses: tunnelOptions.dnsOptions?.addressesList ?? [],
1044+
},
10321045
};
10331046
}
10341047

gui/src/main/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
DaemonEvent,
1616
IAccountData,
1717
IAppVersionInfo,
18+
IDnsOptions,
1819
ILocation,
1920
IRelayList,
2021
ISettings,
@@ -137,6 +138,10 @@ class ApplicationMain {
137138
wireguard: {
138139
mtu: undefined,
139140
},
141+
dns: {
142+
custom: false,
143+
addresses: [],
144+
},
140145
},
141146
};
142147
private guiSettings = new GuiSettings();
@@ -984,6 +989,9 @@ class ApplicationMain {
984989
IpcMainEventChannel.settings.handleUpdateBridgeSettings((bridgeSettings: BridgeSettings) => {
985990
return this.daemonRpc.setBridgeSettings(bridgeSettings);
986991
});
992+
IpcMainEventChannel.settings.handleDnsOptions((dns: IDnsOptions) => {
993+
return this.daemonRpc.setDnsOptions(dns);
994+
});
987995
IpcMainEventChannel.autoStart.handleSet((autoStart: boolean) => {
988996
return this.setAutoStart(autoStart);
989997
});

gui/src/renderer/app.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
BridgeState,
3333
IAccountData,
3434
IAppVersionInfo,
35+
IDnsOptions,
3536
ILocation,
3637
IRelayList,
3738
ISettings,
@@ -303,6 +304,10 @@ export default class AppRenderer {
303304
return IpcRendererEventChannel.settings.updateBridgeSettings(bridgeSettings);
304305
}
305306

307+
public setDnsOptions(dns: IDnsOptions) {
308+
return IpcRendererEventChannel.settings.setDnsOptions(dns);
309+
}
310+
306311
public removeAccountFromHistory(accountToken: AccountToken): Promise<void> {
307312
return IpcRendererEventChannel.accountHistory.removeItem(accountToken);
308313
}
@@ -611,6 +616,7 @@ export default class AppRenderer {
611616
reduxSettings.updateOpenVpnMssfix(newSettings.tunnelOptions.openvpn.mssfix);
612617
reduxSettings.updateWireguardMtu(newSettings.tunnelOptions.wireguard.mtu);
613618
reduxSettings.updateBridgeState(newSettings.bridgeState);
619+
reduxSettings.updateDnsOptions(newSettings.tunnelOptions.dns);
614620

615621
this.setRelaySettings(newSettings.relaySettings);
616622
this.setBridgeSettings(newSettings.bridgeSettings);

0 commit comments

Comments
 (0)