summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2022-09-06 15:50:50 +0200
committerOskar Nyberg <oskar@mullvad.net>2022-09-06 15:50:50 +0200
commit9f738b87b2a8240447f4736e585554b6fd32641a (patch)
treec0f038180488bbcfa7e7d53ecb00634bb4693d4d /gui/src
parent53dc9fd011b75beb543d3e33f551f26d218e0168 (diff)
parent149733d2c5297e9445431ac5fd3abae34711503a (diff)
downloadmullvadvpn-9f738b87b2a8240447f4736e585554b6fd32641a.tar.xz
mullvadvpn-9f738b87b2a8240447f4736e585554b6fd32641a.zip
Merge branch 'refactor-default-settings'
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/default-settings.ts70
-rw-r--r--gui/src/main/settings.ts70
2 files changed, 73 insertions, 67 deletions
diff --git a/gui/src/main/default-settings.ts b/gui/src/main/default-settings.ts
new file mode 100644
index 0000000000..13650926a4
--- /dev/null
+++ b/gui/src/main/default-settings.ts
@@ -0,0 +1,70 @@
+import { ISettings, ObfuscationType, Ownership } from '../shared/daemon-rpc-types';
+
+export function getDefaultSettings(): ISettings {
+ return {
+ allowLan: false,
+ autoConnect: false,
+ blockWhenDisconnected: false,
+ showBetaReleases: false,
+ splitTunnel: {
+ enableExclusions: false,
+ appsList: [],
+ },
+ relaySettings: {
+ normal: {
+ location: 'any',
+ tunnelProtocol: 'any',
+ providers: [],
+ ownership: Ownership.any,
+ openvpnConstraints: {
+ port: 'any',
+ protocol: 'any',
+ },
+ wireguardConstraints: {
+ port: 'any',
+ ipVersion: 'any',
+ useMultihop: false,
+ entryLocation: 'any',
+ },
+ },
+ },
+ bridgeSettings: {
+ normal: {
+ location: 'any',
+ providers: [],
+ ownership: Ownership.any,
+ },
+ },
+ bridgeState: 'auto',
+ tunnelOptions: {
+ generic: {
+ enableIpv6: false,
+ },
+ openvpn: {
+ mssfix: undefined,
+ },
+ wireguard: {
+ mtu: undefined,
+ },
+ dns: {
+ state: 'default',
+ defaultOptions: {
+ blockAds: false,
+ blockTrackers: false,
+ blockMalware: false,
+ blockAdultContent: false,
+ blockGambling: false,
+ },
+ customOptions: {
+ addresses: [],
+ },
+ },
+ },
+ obfuscationSettings: {
+ selectedObfuscation: ObfuscationType.auto,
+ udp2tcpSettings: {
+ port: 'any',
+ },
+ },
+ };
+}
diff --git a/gui/src/main/settings.ts b/gui/src/main/settings.ts
index 3a12852011..26fd14e0fa 100644
--- a/gui/src/main/settings.ts
+++ b/gui/src/main/settings.ts
@@ -1,9 +1,10 @@
import BridgeSettingsBuilder from '../shared/bridge-settings-builder';
-import { ISettings, ObfuscationType, Ownership } from '../shared/daemon-rpc-types';
+import { ISettings } from '../shared/daemon-rpc-types';
import { ICurrentAppVersionInfo } from '../shared/ipc-types';
import log from '../shared/logging';
import { getOpenAtLogin, setOpenAtLogin } from './autostart';
import { DaemonRpc } from './daemon-rpc';
+import { getDefaultSettings } from './default-settings';
import GuiSettings from './gui-settings';
import { IpcMainEventChannel } from './ipc-event-channel';
@@ -15,72 +16,7 @@ export interface SettingsDelegate {
export default class Settings implements Readonly<ISettings> {
private guiSettings = new GuiSettings();
- private settingsValue: ISettings = {
- allowLan: false,
- autoConnect: false,
- blockWhenDisconnected: false,
- showBetaReleases: false,
- splitTunnel: {
- enableExclusions: false,
- appsList: [],
- },
- relaySettings: {
- normal: {
- location: 'any',
- tunnelProtocol: 'any',
- providers: [],
- ownership: Ownership.any,
- openvpnConstraints: {
- port: 'any',
- protocol: 'any',
- },
- wireguardConstraints: {
- port: 'any',
- ipVersion: 'any',
- useMultihop: false,
- entryLocation: 'any',
- },
- },
- },
- bridgeSettings: {
- normal: {
- location: 'any',
- providers: [],
- ownership: Ownership.any,
- },
- },
- bridgeState: 'auto',
- tunnelOptions: {
- generic: {
- enableIpv6: false,
- },
- openvpn: {
- mssfix: undefined,
- },
- wireguard: {
- mtu: undefined,
- },
- dns: {
- state: 'default',
- defaultOptions: {
- blockAds: false,
- blockTrackers: false,
- blockMalware: false,
- blockAdultContent: false,
- blockGambling: false,
- },
- customOptions: {
- addresses: [],
- },
- },
- },
- obfuscationSettings: {
- selectedObfuscation: ObfuscationType.auto,
- udp2tcpSettings: {
- port: 'any',
- },
- },
- };
+ private settingsValue = getDefaultSettings();
public constructor(
private delegate: SettingsDelegate,