diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2017-12-05 11:30:50 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2017-12-05 11:30:50 +0100 |
| commit | cfb017f984c8b7a85bc042aa60710bac44198150 (patch) | |
| tree | 8581e42069a6e89834857c8c72e08ef2a90d275b /app/lib/ipc-facade.js | |
| parent | 35bc9dcf84fbfca216fa2fb23d3d1d9d15bb4915 (diff) | |
| parent | bf11fc59de756cc94ff1aae83383a87817b796dd (diff) | |
| download | mullvadvpn-cfb017f984c8b7a85bc042aa60710bac44198150.tar.xz mullvadvpn-cfb017f984c8b7a85bc042aa60710bac44198150.zip | |
Merge branch 'refine-relay-types'
Diffstat (limited to 'app/lib/ipc-facade.js')
| -rw-r--r-- | app/lib/ipc-facade.js | 31 |
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, |
