diff options
| -rw-r--r-- | gui/packages/desktop/src/renderer/lib/daemon-rpc.js | 8 | ||||
| -rw-r--r-- | gui/packages/desktop/src/renderer/lib/relay-settings-builder.js | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gui/packages/desktop/src/renderer/lib/daemon-rpc.js b/gui/packages/desktop/src/renderer/lib/daemon-rpc.js index 36dd61238c..a712f9b73e 100644 --- a/gui/packages/desktop/src/renderer/lib/daemon-rpc.js +++ b/gui/packages/desktop/src/renderer/lib/daemon-rpc.js @@ -70,7 +70,10 @@ export type TunnelState = | BlockedState; export type RelayProtocol = 'tcp' | 'udp'; -export type RelayLocation = {| city: [string, string] |} | {| country: string |}; +export type RelayLocation = + | {| hostname: [string, string, string] |} + | {| city: [string, string] |} + | {| country: string |}; type OpenVpnConstraints = { port: 'any' | { only: number }, @@ -139,6 +142,9 @@ const RelaySettingsSchema = oneOf( location: constraint( oneOf( object({ + hostname: arrayOf(string), + }), + object({ city: arrayOf(string), }), object({ diff --git a/gui/packages/desktop/src/renderer/lib/relay-settings-builder.js b/gui/packages/desktop/src/renderer/lib/relay-settings-builder.js index 5f6c279e3f..5065a485f6 100644 --- a/gui/packages/desktop/src/renderer/lib/relay-settings-builder.js +++ b/gui/packages/desktop/src/renderer/lib/relay-settings-builder.js @@ -49,6 +49,10 @@ class NormalRelaySettingsBuilder { this._payload.location = { only: { city: [country, city] } }; return this; }, + hostname: (country: string, city: string, hostname: string) => { + this._payload.location = { only: { hostname: [country, city, hostname] } }; + return this; + }, any: () => { this._payload.location = 'any'; return this; @@ -58,6 +62,11 @@ class NormalRelaySettingsBuilder { return this.any(); } + if (location.hostname) { + const [country, city, hostname] = location.hostname; + return this.hostname(country, city, hostname); + } + if (location.city) { const [country, city] = location.city; return this.city(country, city); |
