diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-06-27 20:25:45 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-06-28 19:18:45 +0000 |
| commit | d91a855e6b7981e90f7cd9f6d2374dcb54cd04bb (patch) | |
| tree | e3d66089e74e9414b7624e414f28efa1ab14a9a3 /gui | |
| parent | ea3466c3bf5eb16619d67bd61e27d635d879c51b (diff) | |
| download | mullvadvpn-d91a855e6b7981e90f7cd9f6d2374dcb54cd04bb.tar.xz mullvadvpn-d91a855e6b7981e90f7cd9f6d2374dcb54cd04bb.zip | |
Change how tunnel endpoint is broadcasted
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 24 | ||||
| -rw-r--r-- | gui/src/renderer/containers/ConnectionPanelContainer.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/redux/connection/actions.ts | 14 | ||||
| -rw-r--r-- | gui/src/renderer/redux/connection/reducers.ts | 4 | ||||
| -rw-r--r-- | gui/src/shared/daemon-rpc-types.ts | 8 | ||||
| -rw-r--r-- | gui/test/components/NotificationArea.spec.tsx | 14 |
6 files changed, 41 insertions, 27 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index bf6134465f..435edacdf7 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -237,17 +237,19 @@ const tunnelStateSchema = oneOf( }), object({ state: enumeration('connecting', 'connected'), - details: partialObject({ - address: string, - protocol: enumeration('tcp', 'udp'), - tunnel_type: enumeration('wireguard', 'openvpn'), - proxy: maybe( - partialObject({ - address: string, - protocol: enumeration('tcp', 'udp'), - proxy_type: enumeration('shadowsocks', 'custom'), - }), - ), + details: object({ + endpoint: partialObject({ + address: string, + protocol: enumeration('tcp', 'udp'), + tunnel_type: enumeration('wireguard', 'openvpn'), + proxy: maybe( + partialObject({ + address: string, + protocol: enumeration('tcp', 'udp'), + proxy_type: enumeration('shadowsocks', 'custom'), + }), + ), + }), }), }), object({ diff --git a/gui/src/renderer/containers/ConnectionPanelContainer.tsx b/gui/src/renderer/containers/ConnectionPanelContainer.tsx index 77b164c65b..44d3330c78 100644 --- a/gui/src/renderer/containers/ConnectionPanelContainer.tsx +++ b/gui/src/renderer/containers/ConnectionPanelContainer.tsx @@ -43,12 +43,12 @@ const mapStateToProps = (state: IReduxState) => { const inAddress: IInAddress | undefined = (status.state === 'connecting' || status.state === 'connected') && status.details - ? tunnelEndpointToRelayInAddress(status.details) + ? tunnelEndpointToRelayInAddress(status.details.endpoint) : undefined; const bridgeInfo: IBridgeData | undefined = (status.state === 'connecting' || status.state === 'connected') && status.details - ? tunnelEndpointToBridgeData(status.details) + ? tunnelEndpointToBridgeData(status.details.endpoint) : undefined; return { diff --git a/gui/src/renderer/redux/connection/actions.ts b/gui/src/renderer/redux/connection/actions.ts index b84e85f8e6..8f5b2e62bb 100644 --- a/gui/src/renderer/redux/connection/actions.ts +++ b/gui/src/renderer/redux/connection/actions.ts @@ -2,17 +2,17 @@ import { AfterDisconnect, BlockReason, ILocation, - ITunnelEndpoint, + ITunnelStateRelayInfo, } from '../../../shared/daemon-rpc-types'; interface IConnectingAction { type: 'CONNECTING'; - tunnelEndpoint?: ITunnelEndpoint; + details?: ITunnelStateRelayInfo; } interface IConnectedAction { type: 'CONNECTED'; - tunnelEndpoint: ITunnelEndpoint; + details: ITunnelStateRelayInfo; } interface IDisconnectedAction { @@ -48,17 +48,17 @@ export type ConnectionAction = | IBlockedAction | IUpdateBlockStateAction; -function connecting(tunnelEndpoint?: ITunnelEndpoint): IConnectingAction { +function connecting(details?: ITunnelStateRelayInfo): IConnectingAction { return { type: 'CONNECTING', - tunnelEndpoint, + details, }; } -function connected(tunnelEndpoint: ITunnelEndpoint): IConnectedAction { +function connected(details: ITunnelStateRelayInfo): IConnectedAction { return { type: 'CONNECTED', - tunnelEndpoint, + details, }; } diff --git a/gui/src/renderer/redux/connection/reducers.ts b/gui/src/renderer/redux/connection/reducers.ts index 8b971cb7cc..4772df8fc5 100644 --- a/gui/src/renderer/redux/connection/reducers.ts +++ b/gui/src/renderer/redux/connection/reducers.ts @@ -41,13 +41,13 @@ export default function( case 'CONNECTING': return { ...state, - status: { state: 'connecting', details: action.tunnelEndpoint }, + status: { state: 'connecting', details: action.details }, }; case 'CONNECTED': return { ...state, - status: { state: 'connected', details: action.tunnelEndpoint }, + status: { state: 'connected', details: action.details }, }; case 'DISCONNECTED': diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts index 62d765c0b0..b245685f85 100644 --- a/gui/src/shared/daemon-rpc-types.ts +++ b/gui/src/shared/daemon-rpc-types.ts @@ -75,10 +75,14 @@ export type DaemonEvent = | { relayList: IRelayList } | { wireguardKey: KeygenEvent }; +export interface ITunnelStateRelayInfo { + endpoint: ITunnelEndpoint; +} + export type TunnelState = | { state: 'disconnected' } - | { state: 'connecting'; details?: ITunnelEndpoint } - | { state: 'connected'; details: ITunnelEndpoint } + | { state: 'connecting'; details?: ITunnelStateRelayInfo } + | { state: 'connected'; details: ITunnelStateRelayInfo } | { state: 'disconnecting'; details: AfterDisconnect } | { state: 'blocked'; details: BlockReason }; diff --git a/gui/test/components/NotificationArea.spec.tsx b/gui/test/components/NotificationArea.spec.tsx index 7b1a69bd8a..f2674e848c 100644 --- a/gui/test/components/NotificationArea.spec.tsx +++ b/gui/test/components/NotificationArea.spec.tsx @@ -63,9 +63,17 @@ describe('components/NotificationArea', () => { tunnelState={{ state: 'connected', details: { - address: '1.2.3.4', - protocol: 'tcp', - tunnelType: 'openvpn', + endpoint: { + address: '1.2.3.4', + protocol: 'tcp', + tunnelType: 'openvpn', + }, + location: { + country: 'Sweden', + latitude: 57.70887, + longitude: 11.97456, + mullvadExitIp: true, + }, }, }} version={defaultVersion} |
