summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-12-05 11:30:50 +0100
committerAndrej Mihajlov <and@mullvad.net>2017-12-05 11:30:50 +0100
commitcfb017f984c8b7a85bc042aa60710bac44198150 (patch)
tree8581e42069a6e89834857c8c72e08ef2a90d275b
parent35bc9dcf84fbfca216fa2fb23d3d1d9d15bb4915 (diff)
parentbf11fc59de756cc94ff1aae83383a87817b796dd (diff)
downloadmullvadvpn-cfb017f984c8b7a85bc042aa60710bac44198150.tar.xz
mullvadvpn-cfb017f984c8b7a85bc042aa60710bac44198150.zip
Merge branch 'refine-relay-types'
-rw-r--r--app/lib/ipc-facade.js31
1 files changed, 17 insertions, 14 deletions
diff --git a/app/lib/ipc-facade.js b/app/lib/ipc-facade.js
index dc9147890c..a4cf9bdc9f 100644
--- a/app/lib/ipc-facade.js
+++ b/app/lib/ipc-facade.js
@@ -6,7 +6,7 @@ import { validate } from 'validated/object';
import type { Coordinate2d } from '../types';
-export type AccountData = {expiry: string};
+export type AccountData = { expiry: string };
export type AccountToken = string;
export type Ip = string;
export type Location = {
@@ -29,6 +29,7 @@ export type BackendState = {
};
export type RelayProtocol = 'tcp' | 'udp';
+export type RelayLocation = {| city: [string, string] |} | {| country: string |};
type OpenVpnParameters = {
port: 'any' | { only: number },
@@ -41,12 +42,15 @@ type TunnelOptions<TOpenVpnParameters> = {
type RelaySettingsNormal<TTunnelOptions> = {
location: 'any' | {
- only: { city: Array<string> } | { country: string },
+ only: RelayLocation,
+ },
+ tunnel: 'any' | {
+ only: TTunnelOptions
},
- tunnel: 'any' | TTunnelOptions,
};
-type RelaySettingsCustom = {
+// types describing the structure of RelaySettings
+export type RelaySettingsCustom = {
host: string,
tunnel: {
openvpn: {
@@ -55,20 +59,19 @@ type RelaySettingsCustom = {
}
}
};
-
-type RelaySettings = {
+export type RelaySettings = {|
normal: RelaySettingsNormal<TunnelOptions<OpenVpnParameters>>
-} | {
+|} | {|
custom_tunnel_endpoint: RelaySettingsCustom
-};
+|};
-export type RelaySettingsUpdate = {
- normal: $Shape<
- RelaySettingsNormal< TunnelOptions<$Shape<OpenVpnParameters> > >
- >
-} | {
+// types describing the partial update of RelaySettings
+export type RelaySettingsNormalUpdate = $Shape< RelaySettingsNormal< TunnelOptions<$Shape<OpenVpnParameters> > > >;
+export type RelaySettingsUpdate = {|
+ normal: RelaySettingsNormalUpdate
+|} | {|
custom_tunnel_endpoint: RelaySettingsCustom
-};
+|};
const Constraint = (v) => oneOf(string, object({
only: v,