diff options
| author | Oskar <oskar@mullvad.net> | 2024-08-21 17:08:37 +0200 |
|---|---|---|
| committer | Oskar <oskar@mullvad.net> | 2024-08-21 17:08:37 +0200 |
| commit | 0cc9684200426eef11b65cf8373d29eddf8aa90e (patch) | |
| tree | 68dc1c457f693035ea26b723414b7cd2a28958e3 /gui/src/renderer/containers | |
| parent | b26659e05b50c3a1b0499620f683748287707769 (diff) | |
| parent | 6ceed1dffca2fc0c4b867fe60638db5bf29f1065 (diff) | |
| download | mullvadvpn-0cc9684200426eef11b65cf8373d29eddf8aa90e.tar.xz mullvadvpn-0cc9684200426eef11b65cf8373d29eddf8aa90e.zip | |
Merge branch 'implement-feature-indicators-in-main-view-des-910'
Diffstat (limited to 'gui/src/renderer/containers')
| -rw-r--r-- | gui/src/renderer/containers/ConnectionPanelContainer.tsx | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/gui/src/renderer/containers/ConnectionPanelContainer.tsx b/gui/src/renderer/containers/ConnectionPanelContainer.tsx deleted file mode 100644 index b12902bc5d..0000000000 --- a/gui/src/renderer/containers/ConnectionPanelContainer.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; - -import { ITunnelEndpoint, parseSocketAddress } from '../../shared/daemon-rpc-types'; -import ConnectionPanel, { - IBridgeData, - IInAddress, - IObfuscationData, - IOutAddress, -} from '../components/ConnectionPanel'; -import { IReduxState, ReduxDispatch } from '../redux/store'; -import userInterfaceActions from '../redux/userinterface/actions'; - -function tunnelEndpointToRelayInAddress(tunnelEndpoint: ITunnelEndpoint): IInAddress { - const socketAddr = parseSocketAddress(tunnelEndpoint.address); - return { - ip: socketAddr.host, - port: socketAddr.port, - protocol: tunnelEndpoint.protocol, - tunnelType: tunnelEndpoint.tunnelType, - }; -} - -function tunnelEndpointToEntryLocationInAddress( - tunnelEndpoint: ITunnelEndpoint, -): IInAddress | undefined { - if (!tunnelEndpoint.entryEndpoint) { - return undefined; - } - - const socketAddr = parseSocketAddress(tunnelEndpoint.entryEndpoint.address); - return { - ip: socketAddr.host, - port: socketAddr.port, - protocol: tunnelEndpoint.entryEndpoint.transportProtocol, - tunnelType: tunnelEndpoint.tunnelType, - }; -} - -function tunnelEndpointToBridgeData(endpoint: ITunnelEndpoint): IBridgeData | undefined { - if (!endpoint.proxy) { - return undefined; - } - - const socketAddr = parseSocketAddress(endpoint.proxy.address); - return { - ip: socketAddr.host, - port: socketAddr.port, - protocol: endpoint.proxy.protocol, - bridgeType: endpoint.proxy.proxyType, - }; -} - -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; - - const outAddress: IOutAddress = { - ipv4: state.connection.ipv4, - ipv6: state.connection.ipv6, - }; - - const inAddress: IInAddress | undefined = - (status.state === 'connecting' || status.state === 'connected') && status.details - ? tunnelEndpointToRelayInAddress(status.details.endpoint) - : undefined; - - const entryLocationInAddress: IInAddress | undefined = - (status.state === 'connecting' || status.state === 'connected') && status.details - ? tunnelEndpointToEntryLocationInAddress(status.details.endpoint) - : undefined; - - const bridgeInfo: IBridgeData | undefined = - (status.state === 'connecting' || status.state === 'connected') && status.details - ? tunnelEndpointToBridgeData(status.details.endpoint) - : undefined; - - const obfuscationEndpoint: IObfuscationData | undefined = - (status.state === 'connecting' || status.state === 'connected') && status.details - ? tunnelEndpointToObfuscationEndpoint(status.details.endpoint) - : undefined; - - const daita = - ((status.state === 'connected' || status.state === 'connecting') && - status.details?.endpoint.daita) ?? - false; - - return { - isOpen: state.userInterface.connectionPanelVisible, - hostname: state.connection.hostname, - bridgeHostname: state.connection.bridgeHostname, - entryHostname: state.connection.entryHostname, - inAddress, - entryLocationInAddress, - bridgeInfo, - outAddress, - obfuscationEndpoint, - daita, - }; -}; - -const mapDispatchToProps = (dispatch: ReduxDispatch) => { - const userInterface = bindActionCreators(userInterfaceActions, dispatch); - - return { - onToggle: userInterface.toggleConnectionPanel, - }; -}; - -export default connect(mapStateToProps, mapDispatchToProps)(ConnectionPanel); |
