| 394 | } |
| 395 | |
| 396 | std::string startWstunnel(const std::string &pars) |
| 397 | { |
| 398 | std::string hostname; |
| 399 | unsigned int port, localPort; |
| 400 | deserializePars(pars, hostname, port, localPort); |
| 401 | |
| 402 | spdlog::debug("Starting wstunnel"); |
| 403 | |
| 404 | if (!Validation::isValidIpv4Address(hostname)) { |
| 405 | return serializeResult(false); |
| 406 | } |
| 407 | |
| 408 | std::string wstunnelPath; |
| 409 | if (!Utils::resolveExePath(Utils::getExePath(), WS_PRODUCT_NAME_LOWER "wstunnel", wstunnelPath)) { |
| 410 | return serializeResult(false); |
| 411 | } |
| 412 | |
| 413 | std::vector<std::string> args = { |
| 414 | "--listenAddress", "127.0.0.1:" + std::to_string(localPort), |
| 415 | "--remoteAddress", "wss://" + hostname + ":" + std::to_string(port) + "/tcp/127.0.0.1/1194", |
| 416 | "--logFilePath", "", |
| 417 | }; |
| 418 | |
| 419 | Spawn::Options opts; |
| 420 | opts.runAsUser = WS_PRODUCT_NAME_LOWER; |
| 421 | return serializeResult(Spawn::spawnDetached(wstunnelPath, args, opts)); |
| 422 | } |
| 423 | |
| 424 | std::string setMacAddress(const std::string &pars) |
| 425 | { |
nothing calls this directly
no test coverage detected