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

Function enableDnsLeaksProtection

src/helper/windows/process_command.cpp:643–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643std::string enableDnsLeaksProtection(const std::string &pars)
644{
645 std::vector<std::wstring> customDnsIp;
646 deserializePars(pars, customDnsIp);
647
648 // Rather than reject the whole request on bad input, sanitize it: drop any invalid IP entries
649 // and apply the valid remainder. These IPs are only excluded from the DNS firewall block, so
650 // dropping a malformed one fails closed (that IP simply stays blocked).
651 customDnsIp.erase(std::remove_if(customDnsIp.begin(), customDnsIp.end(),
652 [](const std::wstring &ip) {
653 if (NetworkValidation::isValidIpAddress(ip)) {
654 return false;
655 }
656 spdlog::error(L"enableDnsLeaksProtection: dropping invalid IP address: \"{}\"", ip);
657 return true;
658 }),
659 customDnsIp.end());
660
661 spdlog::debug("enableDnsLeaksProtection");
662 DnsFirewall::instance().setExcludeIps(customDnsIp);
663 DnsFirewall::instance().enable();
664 return std::string();
665}
666
667std::string disableDnsLeaksProtection(const std::string &pars)
668{

Callers

nothing calls this directly

Calls 4

deserializeParsFunction · 0.85
setExcludeIpsMethod · 0.80
isValidIpAddressFunction · 0.70
enableMethod · 0.45

Tested by

no test coverage detected