diff --git a/client/electron/go_helpers.ts b/client/electron/go_helpers.ts index 7071682c24..ec7df45eba 100644 --- a/client/electron/go_helpers.ts +++ b/client/electron/go_helpers.ts @@ -20,7 +20,7 @@ import {pathToEmbeddedTun2socksBinary} from './app_paths'; import {ChildProcessHelper} from './process'; -import {TransportConfigJson} from '../src/www/app/outline_server_repository/vpn'; +import {TransportConfigJson} from '../src/www/app/outline_server_repository/config'; /** * Verifies the UDP connectivity of the server specified in `config`. diff --git a/client/electron/go_vpn_tunnel.ts b/client/electron/go_vpn_tunnel.ts index 8539a5301c..6dcfceef41 100755 --- a/client/electron/go_vpn_tunnel.ts +++ b/client/electron/go_vpn_tunnel.ts @@ -21,10 +21,8 @@ import {checkUDPConnectivity} from './go_helpers'; import {ChildProcessHelper, ProcessTerminatedSignalError} from './process'; import {RoutingDaemon} from './routing_service'; import {VpnTunnel} from './vpn_tunnel'; -import { - TransportConfigJson, - TunnelStatus, -} from '../src/www/app/outline_server_repository/vpn'; +import * as config from '../src/www/app/outline_server_repository/config'; +import {TunnelStatus} from '../src/www/app/outline_server_repository/vpn'; const isLinux = platform() === 'linux'; const isWindows = platform() === 'win32'; @@ -66,7 +64,7 @@ export class GoVpnTunnel implements VpnTunnel { constructor( private readonly routing: RoutingDaemon, - readonly transportConfig: TransportConfigJson + readonly transportConfig: config.TransportConfigJson ) { this.tun2socks = new GoTun2socks(); @@ -251,7 +249,7 @@ class GoTun2socks { * @param isUdpEnabled Indicates whether the remote Outline server supports UDP. */ async start( - config: TransportConfigJson, + config: config.TransportConfigJson, isUdpEnabled: boolean ): Promise { // ./tun2socks.exe \ diff --git a/client/electron/index.ts b/client/electron/index.ts index bf93f1d71b..90f49fb44c 100644 --- a/client/electron/index.ts +++ b/client/electron/index.ts @@ -39,11 +39,9 @@ import {GoVpnTunnel} from './go_vpn_tunnel'; import {installRoutingServices, RoutingDaemon} from './routing_service'; import {TunnelStore} from './tunnel_store'; import {VpnTunnel} from './vpn_tunnel'; +import * as config from '../src/www/app/outline_server_repository/config'; import { - getHostFromTransportConfig, - setTransportConfigHost, StartRequestJson, - TunnelConfigJson, TunnelStatus, } from '../src/www/app/outline_server_repository/vpn'; import * as errors from '../src/www/model/errors'; @@ -346,14 +344,14 @@ async function tearDownAutoLaunch() { // Factory function to create a VPNTunnel instance backed by a network stack // specified at build time. async function createVpnTunnel( - tunnelConfig: TunnelConfigJson, + tunnelConfig: config.TunnelConfigJson, isAutoConnect: boolean ): Promise { // We must convert the host from a potential "hostname" to an "IP" address // because startVpn will add a routing table entry that prefixed with this // host (e.g. "/32"), therefore must be an IP address. // TODO: make sure we resolve it in the native code - const host = getHostFromTransportConfig(tunnelConfig.transport); + const host = config.getHostFromTransportConfig(tunnelConfig.transport); if (!host) { throw new errors.IllegalServerConfiguration('host is missing'); } @@ -361,7 +359,7 @@ async function createVpnTunnel( const routing = new RoutingDaemon(hostIp || '', isAutoConnect); // Make sure the transport will use the IP we will allowlist. const resolvedTransport = - setTransportConfigHost(tunnelConfig.transport, hostIp) ?? + config.setTransportConfigHost(tunnelConfig.transport, hostIp) ?? tunnelConfig.transport; const tunnel = new GoVpnTunnel(routing, resolvedTransport); routing.onNetworkChange = tunnel.networkChanged.bind(tunnel);