diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-11-15 09:55:48 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2024-01-29 09:33:49 +0100 |
| commit | db9f5abf496019d3e40b62833c334b550e2d759a (patch) | |
| tree | 3d7c1f5dec3f9c28fdb9df604bfead229217a7b1 /gui/src/shared | |
| parent | 4d5a0533149b9af4541c002591ebc32255c5d433 (diff) | |
| download | mullvadvpn-db9f5abf496019d3e40b62833c334b550e2d759a.tar.xz mullvadvpn-db9f5abf496019d3e40b62833c334b550e2d759a.zip | |
Add api acces methods to daemon-rpc
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/daemon-rpc-types.ts | 57 | ||||
| -rw-r--r-- | gui/src/shared/utils.ts | 3 |
2 files changed, 59 insertions, 1 deletions
diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts index 48a4110e13..b409a6e835 100644 --- a/gui/src/shared/daemon-rpc-types.ts +++ b/gui/src/shared/daemon-rpc-types.ts @@ -173,7 +173,8 @@ export type DaemonEvent = | { relayList: IRelayListWithEndpointData } | { appVersionInfo: IAppVersionInfo } | { device: DeviceEvent } - | { deviceRemoval: Array<IDevice> }; + | { deviceRemoval: Array<IDevice> } + | { accessMethodSetting: AccessMethodSetting }; export interface ITunnelStateRelayInfo { endpoint: ITunnelEndpoint; @@ -427,6 +428,7 @@ export interface ISettings { splitTunnel: SplitTunnelSettings; obfuscationSettings: ObfuscationSettings; customLists: CustomLists; + apiAccessMethods: ApiAccessMethodSettings; } export type BridgeState = 'auto' | 'on' | 'off'; @@ -474,6 +476,59 @@ export type VoucherResponse = | { type: 'success'; newExpiry: string; secondsAdded: number } | { type: 'invalid' | 'already_used' | 'error' }; +export interface SocksAuth { + username: string; + password: string; +} + +export type Socks5LocalAccessMethod = { + type: 'socks5-local'; + remoteIp: string; + remotePort: number; + remoteTransportProtocol: RelayProtocol; + localPort: number; +}; + +export type Socks5RemoteAccessMethod = { + type: 'socks5-remote'; + ip: string; + port: number; + authentication?: SocksAuth; +}; + +export type ShadowsocksAccessMethod = { + type: 'shadowsocks'; + ip: string; + port: number; + password: string; + cipher: string; +}; + +export type CustomProxy = + | Socks5LocalAccessMethod + | Socks5RemoteAccessMethod + | ShadowsocksAccessMethod; + +export type AccessMethod = + | { + type: 'direct'; + } + | { + type: 'bridges'; + } + | CustomProxy; + +export type NewAccessMethodSetting = AccessMethod & { + name: string; + enabled: boolean; +}; + +export type AccessMethodSetting = NewAccessMethodSetting & { + id: string; +}; + +export type ApiAccessMethodSettings = Array<AccessMethodSetting>; + export function parseSocketAddress(socketAddrStr: string): ISocketAddress { const re = new RegExp(/(.+):(\d+)$/); const matches = socketAddrStr.match(re); diff --git a/gui/src/shared/utils.ts b/gui/src/shared/utils.ts new file mode 100644 index 0000000000..24984e4412 --- /dev/null +++ b/gui/src/shared/utils.ts @@ -0,0 +1,3 @@ +export function hasValue<T>(value: T): value is NonNullable<T> { + return value !== undefined && value !== null; +} |
