Skip to content

Commit

Permalink
Merge branch 'custom-dns-ui'
Browse files Browse the repository at this point in the history
  • Loading branch information
raksooo committed Nov 17, 2020
2 parents 765f777 + 6332e99 commit 6d95d36
Show file tree
Hide file tree
Showing 16 changed files with 607 additions and 17 deletions.
8 changes: 1 addition & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,13 @@ Line wrap the file at 100 chars. Th
- Add `--wait` flag to `connect`, `disconnect` and `reconnect` CLI subcommands to make the CLI wait
for the target state to be reached before exiting.
- Navigate back to the main view when escape is pressed.

#### Windows
- Add support for custom DNS resolvers (CLI only).
- Add support for custom DNS resolvers.

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

#### macOS
- Add support for custom DNS resolvers (CLI only).

### Changed
- Use the API to fetch API IP addresses instead of DNS.
- Remove WireGuard keys during uninstallation after the firewall is unlocked.
Expand Down
8 changes: 8 additions & 0 deletions gui/assets/images/icon-add.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions gui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"electron-log": "^4.1.1",
"gettext-parser": "^4.0.3",
"google-protobuf": "^4.0.0-rc.2",
"ip": "^1.1.5",
"linux-app-list": "^1.0.1",
"mkdirp": "^1.0.3",
"moment": "^2.24.0",
Expand Down Expand Up @@ -46,6 +47,7 @@
"@types/gettext-parser": "^4.0.0",
"@types/google-protobuf": "^3.7.2",
"@types/history": "^4.7.8",
"@types/ip": "^1.1.0",
"@types/mkdirp": "^1.0.0",
"@types/mocha": "^5.2.6",
"@types/node": "^10.12.3",
Expand Down
13 changes: 13 additions & 0 deletions gui/src/main/daemon-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
ProxySettings,
VoucherResponse,
TunnelProtocol,
IDnsOptions,
} from '../shared/daemon-rpc-types';

import * as managementInterface from './management_interface/management_interface_grpc_pb';
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1029,6 +1038,10 @@ function convertFromTunnelOptions(tunnelOptions: grpcTypes.TunnelOptions.AsObjec
generic: {
enableIpv6: tunnelOptions.generic!.enableIpv6,
},
dns: {
custom: tunnelOptions.dnsOptions?.custom ?? false,
addresses: tunnelOptions.dnsOptions?.addressesList ?? [],
},
};
}

Expand Down
8 changes: 8 additions & 0 deletions gui/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
DaemonEvent,
IAccountData,
IAppVersionInfo,
IDnsOptions,
ILocation,
IRelayList,
ISettings,
Expand Down Expand Up @@ -137,6 +138,10 @@ class ApplicationMain {
wireguard: {
mtu: undefined,
},
dns: {
custom: false,
addresses: [],
},
},
};
private guiSettings = new GuiSettings();
Expand Down Expand Up @@ -984,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);
});
Expand Down
6 changes: 6 additions & 0 deletions gui/src/renderer/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
BridgeState,
IAccountData,
IAppVersionInfo,
IDnsOptions,
ILocation,
IRelayList,
ISettings,
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -611,6 +616,7 @@ export default class AppRenderer {
reduxSettings.updateOpenVpnMssfix(newSettings.tunnelOptions.openvpn.mssfix);
reduxSettings.updateWireguardMtu(newSettings.tunnelOptions.wireguard.mtu);
reduxSettings.updateBridgeState(newSettings.bridgeState);
reduxSettings.updateDnsOptions(newSettings.tunnelOptions.dns);

this.setRelaySettings(newSettings.relaySettings);
this.setBridgeSettings(newSettings.bridgeSettings);
Expand Down

0 comments on commit 6d95d36

Please sign in to comment.