MCPcopy Create free account
hub / github.com/Windscribe/Desktop-App / startStunnel

Function startStunnel

src/helper/linux/process_command.cpp:362–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362std::string startStunnel(const std::string &pars)
363{
364 std::string hostname;
365 unsigned int port, localPort;
366 bool extraPadding;
367 deserializePars(pars, hostname, port, localPort, extraPadding);
368
369 spdlog::debug("Starting stunnel");
370
371 if (!Validation::isValidIpv4Address(hostname)) {
372 return serializeResult(false);
373 }
374
375 std::string wstunnelPath;
376 if (!Utils::resolveExePath(Utils::getExePath(), WS_PRODUCT_NAME_LOWER "wstunnel", wstunnelPath)) {
377 return serializeResult(false);
378 }
379
380 std::vector<std::string> args = {
381 "--listenAddress", "127.0.0.1:" + std::to_string(localPort),
382 "--remoteAddress", "https://" + hostname + ":" + std::to_string(port),
383 "--logFilePath", "",
384 };
385 if (extraPadding) {
386 args.push_back("--extraTlsPadding");
387 }
388 args.push_back("--tunnelType");
389 args.push_back("2");
390
391 Spawn::Options opts;
392 opts.runAsUser = WS_PRODUCT_NAME_LOWER;
393 return serializeResult(Spawn::spawnDetached(wstunnelPath, args, opts));
394}
395
396std::string startWstunnel(const std::string &pars)
397{

Callers

nothing calls this directly

Calls 7

deserializeParsFunction · 0.85
isValidIpv4AddressFunction · 0.85
serializeResultFunction · 0.85
to_stringFunction · 0.85
spawnDetachedFunction · 0.85
resolveExePathFunction · 0.70
getExePathFunction · 0.70

Tested by

no test coverage detected