| 556 | } |
| 557 | |
| 558 | std::string addHosts(const std::string &pars) |
| 559 | { |
| 560 | std::wstring ip, hostname; |
| 561 | deserializePars(pars, ip, hostname); |
| 562 | |
| 563 | if (!NetworkValidation::isValidIpAddress(ip)) { |
| 564 | spdlog::error(L"addHosts invalid IP address: \"{}\"", ip); |
| 565 | return serializeResult(false); |
| 566 | } |
| 567 | if (!NetworkValidation::isValidHostname(hostname)) { |
| 568 | spdlog::error(L"addHosts invalid hostname: \"{}\"", hostname); |
| 569 | return serializeResult(false); |
| 570 | } |
| 571 | |
| 572 | spdlog::debug("addHosts"); |
| 573 | bool success = HostsEdit::instance().addHosts(ip, hostname); |
| 574 | return serializeResult(success); |
| 575 | } |
| 576 | |
| 577 | std::string removeHosts(const std::string &pars) |
| 578 | { |
nothing calls this directly
no test coverage detected