diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-05-19 10:06:32 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-05-19 10:06:32 +0200 |
| commit | 9cca46231f623247fac50694a66fb5eedada15d8 (patch) | |
| tree | a62db50609fe2679d1f1105558a4712f8300693d /gui/src/main | |
| parent | 0211a43e2f9e1b7beccaefd9a2a09672f1877fd8 (diff) | |
| parent | a39213f52d76ddf08ed0a637a0fe831b3581466e (diff) | |
| download | mullvadvpn-9cca46231f623247fac50694a66fb5eedada15d8.tar.xz mullvadvpn-9cca46231f623247fac50694a66fb5eedada15d8.zip | |
Merge branch 'update-filters'
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 33 | ||||
| -rw-r--r-- | gui/src/main/index.ts | 3 |
2 files changed, 36 insertions, 0 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index c40e40b864..166a48c9cb 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -44,6 +44,7 @@ import { LoggedInDeviceState, LoggedOutDeviceState, ObfuscationType, + Ownership, ProxySettings, ProxyType, RelayLocation, @@ -326,6 +327,12 @@ export class DaemonRpc { normalUpdate.setProviders(providerUpdate); } + if (settingsUpdate.ownership !== undefined) { + const ownershipUpdate = new grpcTypes.OwnershipUpdate(); + ownershipUpdate.setOwnership(convertToOwnership(settingsUpdate.ownership)); + normalUpdate.setOwnership(ownershipUpdate); + } + grpcRelaySettings.setNormal(normalUpdate); await this.call<grpcTypes.RelaySettingsUpdate, Empty>( this.client.updateRelaySettings, @@ -1014,6 +1021,7 @@ function convertFromRelaySettings( : 'any'; const tunnelProtocol = convertFromTunnelTypeConstraint(normal.getTunnelType()!); const providers = normal.getProvidersList(); + const ownership = convertFromOwnership(normal.getOwnership()); const openvpnConstraints = convertFromOpenVpnConstraints(normal.getOpenvpnConstraints()!); const wireguardConstraints = convertFromWireguardConstraints( normal.getWireguardConstraints()!, @@ -1024,6 +1032,7 @@ function convertFromRelaySettings( location, tunnelProtocol, providers, + ownership, wireguardConstraints, openvpnConstraints, }, @@ -1043,10 +1052,12 @@ function convertFromBridgeSettings( const grpcLocation = normalSettings.location; const location = grpcLocation ? { only: convertFromLocation(grpcLocation) } : 'any'; const providers = normalSettings.providersList; + const ownership = convertFromOwnership(normalSettings.ownership); return { normal: { location, providers, + ownership, }, }; } @@ -1210,6 +1221,28 @@ function convertFromDaemonEvent(data: grpcTypes.DaemonEvent): DaemonEvent { throw new Error(`Unknown daemon event received containing ${keys}`); } +function convertFromOwnership(ownership: grpcTypes.Ownership): Ownership { + switch (ownership) { + case grpcTypes.Ownership.ANY: + return Ownership.any; + case grpcTypes.Ownership.MULLVAD_OWNED: + return Ownership.mullvadOwned; + case grpcTypes.Ownership.RENTED: + return Ownership.rented; + } +} + +function convertToOwnership(ownership: Ownership): grpcTypes.Ownership { + switch (ownership) { + case Ownership.any: + return grpcTypes.Ownership.ANY; + case Ownership.mullvadOwned: + return grpcTypes.Ownership.MULLVAD_OWNED; + case Ownership.rented: + return grpcTypes.Ownership.RENTED; + } +} + function convertFromOpenVpnConstraints( constraints: grpcTypes.OpenvpnConstraints, ): IOpenVpnConstraints { diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 4d0f915bb9..622194fbd7 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -36,6 +36,7 @@ import { IRelayList, ISettings, liftConstraint, + Ownership, RelaySettings, RelaySettingsUpdate, TunnelState, @@ -162,6 +163,7 @@ class ApplicationMain { location: 'any', tunnelProtocol: 'any', providers: [], + ownership: Ownership.any, openvpnConstraints: { port: 'any', protocol: 'any', @@ -178,6 +180,7 @@ class ApplicationMain { normal: { location: 'any', providers: [], + ownership: Ownership.any, }, }, bridgeState: 'auto', |
