summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-11-20 13:31:43 +0100
committerAndrej Mihajlov <and@mullvad.net>2017-11-23 12:41:13 +0100
commit5cbb22d21196a3dcef75455fda7dd686c1dfd001 (patch)
tree158a1900b5754a1160c7e4c131be39577df603fc /app
parentc384e2f4c5bc520d089e412927450484e8cd930f (diff)
downloadmullvadvpn-5cbb22d21196a3dcef75455fda7dd686c1dfd001.tar.xz
mullvadvpn-5cbb22d21196a3dcef75455fda7dd686c1dfd001.zip
Update RelaySettingsSchema and RelaySettingsUpdate
Diffstat (limited to 'app')
-rw-r--r--app/lib/ipc-facade.js65
1 files changed, 51 insertions, 14 deletions
diff --git a/app/lib/ipc-facade.js b/app/lib/ipc-facade.js
index 86eb61d549..9ebbdd73f1 100644
--- a/app/lib/ipc-facade.js
+++ b/app/lib/ipc-facade.js
@@ -27,36 +27,73 @@ export type BackendState = {
state: SecurityState,
target_state: SecurityState,
};
+type RelayProtocol = 'tcp' | 'udp';
type RelaySettings = {
host: 'any' | { only: string },
tunnel: {
openvpn: {
port: 'any' | { only: number },
- protocol: 'any' | { only: 'tcp' | 'udp' },
+ protocol: 'any' | { only: RelayProtocol },
},
},
};
export type RelaySettingsUpdate = {
- host?: 'any' | { only: string },
- tunnel: {
- openvpn: {
- port?: 'any' | { only: number },
- protocol?: 'any' | { only: 'tcp' | 'udp' },
+ normal: {
+ location?: 'any' | {
+ only: { city: Array<string> } | { country: string },
},
+ tunnel: {
+ openvpn: {
+ port?: 'any' | { only: number },
+ protocol?: 'any' | { only: RelayProtocol },
+ },
+ }
},
+} | {
+ custom_tunnel_endpoint: {
+ host: string,
+ tunnel: {
+ openvpn: {
+ port: number,
+ protocol: RelayProtocol
+ }
+ }
+ }
};
const Constraint = (v) => oneOf(string, object({
only: v,
}));
-const RelaySettingsSchema = object({
- host: Constraint(string),
- tunnel: object({
- openvpn: object({
- port: Constraint(number),
- protocol: Constraint(enumeration('udp', 'tcp')),
- }),
+const RelaySettingsSchema = oneOf(
+ object({
+ normal: object({
+ location: Constraint(oneOf(
+ object({
+ city: arrayOf(string),
+ }),
+ object({
+ country: string
+ }),
+ )),
+ tunnel: Constraint(object({
+ openvpn: object({
+ port: Constraint(number),
+ protocol: Constraint(enumeration('udp', 'tcp')),
+ }),
+ })),
+ })
}),
-});
+ object({
+ custom_tunnel_endpoint: object({
+ host: string,
+ tunnel: object({
+ openvpn: object({
+ port: number,
+ protocol: enumeration('udp', 'tcp'),
+ })
+ })
+ })
+ })
+);
export interface IpcFacade {