diff options
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 19 | ||||
| -rw-r--r-- | gui/src/renderer/components/ConnectionPanel.tsx | 14 | ||||
| -rw-r--r-- | gui/src/renderer/containers/ConnectionPanelContainer.tsx | 22 | ||||
| -rw-r--r-- | gui/src/shared/daemon-rpc-types.ts | 9 |
4 files changed, 61 insertions, 3 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index 029936093f..39e9d48f21 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -27,6 +27,7 @@ import { IDnsOptions, IErrorState, ILocation, + IObfuscationEndpoint, IOpenVpnConstraints, IOpenVpnTunnelData, IProxyEndpoint, @@ -40,6 +41,7 @@ import { ITunnelStateRelayInfo, IWireguardConstraints, IWireguardTunnelData, + ObfuscationType, ProxySettings, ProxyType, RelayLocation, @@ -899,6 +901,9 @@ function convertFromTunnelStateRelayInfo( tunnelType: convertFromTunnelType(state.tunnelEndpoint.tunnelType), protocol: convertFromTransportProtocol(state.tunnelEndpoint.protocol), proxy: state.tunnelEndpoint.proxy && convertFromProxyEndpoint(state.tunnelEndpoint.proxy), + obfuscationEndpoint: + state.tunnelEndpoint.obfuscation && + convertFromObfuscationEndpoint(state.tunnelEndpoint.obfuscation), entryEndpoint: state.tunnelEndpoint.entryEndpoint && convertFromEntryEndpoint(state.tunnelEndpoint.entryEndpoint), @@ -930,6 +935,20 @@ function convertFromProxyEndpoint(proxyEndpoint: grpcTypes.ProxyEndpoint.AsObjec }; } +function convertFromObfuscationEndpoint( + obfuscationEndpoint: grpcTypes.ObfuscationEndpoint.AsObject, +): IObfuscationEndpoint { + const obfuscationTypes: Record<grpcTypes.ObfuscationType, ObfuscationType> = { + [grpcTypes.ObfuscationType.UDP2TCP]: 'udp2tcp', + }; + + return { + ...obfuscationEndpoint, + protocol: convertFromTransportProtocol(obfuscationEndpoint.protocol), + obfuscationType: obfuscationTypes[obfuscationEndpoint.obfuscationType], + }; +} + function convertFromEntryEndpoint(entryEndpoint: grpcTypes.Endpoint.AsObject) { return { address: entryEndpoint.address, diff --git a/gui/src/renderer/components/ConnectionPanel.tsx b/gui/src/renderer/components/ConnectionPanel.tsx index 060802a1d9..7f4c28286b 100644 --- a/gui/src/renderer/components/ConnectionPanel.tsx +++ b/gui/src/renderer/components/ConnectionPanel.tsx @@ -4,6 +4,7 @@ import styled from 'styled-components'; import { colors } from '../../config.json'; import { + ObfuscationType, ProxyType, proxyTypeToString, RelayProtocol, @@ -29,6 +30,10 @@ export interface IBridgeData extends IEndpoint { bridgeType: ProxyType; } +export interface IObfuscationData extends IEndpoint { + obfuscationType: ObfuscationType; +} + export interface IOutAddress { ipv4?: string; ipv6?: string; @@ -43,6 +48,7 @@ interface IProps { entryLocationInAddress?: IInAddress; bridgeInfo?: IBridgeData; outAddress?: IOutAddress; + obfuscationEndpoint?: IObfuscationData; onToggle: () => void; className?: string; } @@ -126,10 +132,12 @@ export default class ConnectionPanel extends React.Component<IProps> { ); } - private getEntryPoint() { - const { inAddress, entryLocationInAddress, bridgeInfo } = this.props; + private getEntryPoint(): IEndpoint | undefined { + const { obfuscationEndpoint, inAddress, entryLocationInAddress, bridgeInfo } = this.props; - if (entryLocationInAddress && inAddress) { + if (obfuscationEndpoint) { + return obfuscationEndpoint; + } else if (entryLocationInAddress && inAddress) { return entryLocationInAddress; } else if (bridgeInfo && inAddress) { return bridgeInfo; diff --git a/gui/src/renderer/containers/ConnectionPanelContainer.tsx b/gui/src/renderer/containers/ConnectionPanelContainer.tsx index f55fa8cacd..5311f1a8e4 100644 --- a/gui/src/renderer/containers/ConnectionPanelContainer.tsx +++ b/gui/src/renderer/containers/ConnectionPanelContainer.tsx @@ -5,6 +5,7 @@ import { ITunnelEndpoint, parseSocketAddress } from '../../shared/daemon-rpc-typ import ConnectionPanel, { IBridgeData, IInAddress, + IObfuscationData, IOutAddress, } from '../components/ConnectionPanel'; import { IReduxState, ReduxDispatch } from '../redux/store'; @@ -50,6 +51,21 @@ function tunnelEndpointToBridgeData(endpoint: ITunnelEndpoint): IBridgeData | un }; } +function tunnelEndpointToObfuscationEndpoint( + endpoint: ITunnelEndpoint, +): IObfuscationData | undefined { + if (!endpoint.obfuscationEndpoint) { + return undefined; + } + + return { + ip: endpoint.obfuscationEndpoint.address, + port: endpoint.obfuscationEndpoint.port, + protocol: endpoint.obfuscationEndpoint.protocol, + obfuscationType: endpoint.obfuscationEndpoint.obfuscationType, + }; +} + const mapStateToProps = (state: IReduxState) => { const status = state.connection.status; @@ -73,6 +89,11 @@ const mapStateToProps = (state: IReduxState) => { ? tunnelEndpointToBridgeData(status.details.endpoint) : undefined; + const obfuscationEndpoint: IObfuscationData | undefined = + (status.state === 'connecting' || status.state === 'connected') && status.details + ? tunnelEndpointToObfuscationEndpoint(status.details.endpoint) + : undefined; + return { isOpen: state.userInterface.connectionPanelVisible, hostname: state.connection.hostname, @@ -82,6 +103,7 @@ const mapStateToProps = (state: IReduxState) => { entryLocationInAddress, bridgeInfo, outAddress, + obfuscationEndpoint, }; }; diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts index dc3088cc80..d1eab9cdce 100644 --- a/gui/src/shared/daemon-rpc-types.ts +++ b/gui/src/shared/daemon-rpc-types.ts @@ -61,6 +61,7 @@ export function tunnelTypeToString(tunnel: TunnelType): string { } export type RelayProtocol = 'tcp' | 'udp'; +export type ObfuscationType = 'udp2tcp'; export type Constraint<T> = 'any' | { only: T }; export type LiftedConstraint<T> = 'any' | T; @@ -86,6 +87,7 @@ export interface ITunnelEndpoint { protocol: RelayProtocol; tunnelType: TunnelType; proxy?: IProxyEndpoint; + obfuscationEndpoint?: IObfuscationEndpoint; entryEndpoint?: IEndpoint; } @@ -94,6 +96,13 @@ export interface IEndpoint { transportProtocol: RelayProtocol; } +export interface IObfuscationEndpoint { + address: string; + port: number; + protocol: RelayProtocol; + obfuscationType: ObfuscationType; +} + export interface IProxyEndpoint { address: string; protocol: RelayProtocol; |
