Files
openrouter/src/settings/dns/local_domains.cpp
T
wt cedc9cd995
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Waiting to run
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Waiting to run
making easy
2025-02-20 18:07:59 +07:00

27 lines
754 B
C++

#include <settings/dns/dns.hpp>
#include <syslog.h>
#include <fstream>
namespace api
{
namespace settings
{
namespace dns
{
void set_local_domains(nlohmann::json domains)
{
std::ofstream domainsfile("/etc/dnsmasq.conf.d/hosts");
for (nlohmann::json_abi_v3_11_3::json domain : domains)
{
std::string ip = domain["ip"];
std::string dom = domain["domain"];
domainsfile << ip << " " << dom << "\n";
}
domainsfile.close();
system("rc restart dnsmasq");
syslog(LOG_INFO, "%s", "DNS local domains changed");
}
}
}
}