summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2024-04-09 08:04:29 +0200
committerOskar Nyberg <oskar@mullvad.net>2024-04-11 17:21:23 +0200
commita1fa168418366e350be10b338c69bd1fda0d83b5 (patch)
tree31adb74ba8ab6aee9bf8e53d2bae580111509cac /gui/src/shared
parentc4d6f31c41d19133f8e23701de487846cc7ec362 (diff)
downloadmullvadvpn-a1fa168418366e350be10b338c69bd1fda0d83b5.tar.xz
mullvadvpn-a1fa168418366e350be10b338c69bd1fda0d83b5.zip
Remove bridge settings builder
Diffstat (limited to 'gui/src/shared')
-rw-r--r--gui/src/shared/bridge-settings-builder.ts28
-rw-r--r--gui/src/shared/relay-location-builder.ts41
2 files changed, 0 insertions, 69 deletions
diff --git a/gui/src/shared/bridge-settings-builder.ts b/gui/src/shared/bridge-settings-builder.ts
deleted file mode 100644
index 2ee5469707..0000000000
--- a/gui/src/shared/bridge-settings-builder.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { BridgeSettings, IBridgeConstraints, Ownership } from './daemon-rpc-types';
-import makeLocationBuilder, { ILocationBuilder } from './relay-location-builder';
-
-export default class BridgeSettingsBuilder {
- private payload: Partial<IBridgeConstraints> = {};
-
- public build(): BridgeSettings {
- if (this.payload.location) {
- return {
- type: 'normal',
- normal: {
- location: this.payload.location,
- providers: this.payload.providers ?? [],
- ownership: this.payload.ownership ?? Ownership.any,
- },
- custom: undefined,
- };
- } else {
- throw new Error('Unsupported configuration');
- }
- }
-
- get location(): ILocationBuilder<BridgeSettingsBuilder> {
- return makeLocationBuilder(this, (location) => {
- this.payload.location = location;
- });
- }
-}
diff --git a/gui/src/shared/relay-location-builder.ts b/gui/src/shared/relay-location-builder.ts
deleted file mode 100644
index 7e585f9eaf..0000000000
--- a/gui/src/shared/relay-location-builder.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { Constraint, LiftedConstraint, RelayLocation } from './daemon-rpc-types';
-
-export interface ILocationBuilder<Self> {
- country(country: string): Self;
- city(country: string, city: string): Self;
- hostname(country: string, city: string, hostname: string): Self;
- any(): Self;
- fromRaw(location: LiftedConstraint<RelayLocation>): Self;
-}
-
-export default function makeLocationBuilder<T>(
- context: T,
- receiver: (constraint: Constraint<RelayLocation>) => void,
-): ILocationBuilder<T> {
- return {
- country: (country: string) => {
- receiver({ only: { country } });
- return context;
- },
- city: (country: string, city: string) => {
- receiver({ only: { country, city } });
- return context;
- },
- hostname: (country: string, city: string, hostname: string) => {
- receiver({ only: { country, city, hostname } });
- return context;
- },
- any: () => {
- receiver('any');
- return context;
- },
- fromRaw(location: LiftedConstraint<RelayLocation>) {
- if (location === 'any') {
- return this.any();
- } else {
- receiver({ only: location });
- return context;
- }
- },
- };
-}