mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 14:23:56 +08:00
🎄 Sync 2026-10-12 21:17:30
This commit is contained in:
1 parent
8247b3bbae
commit
426eda7eae
3 files changed
+15
-3
No files matched your search
@@ -203,6 +203,18 @@ config_lines = {
|
||||
DNS_MODE == "socks" and string.format("proxy-server socks5://%s -name %s", REMOTE_PROXY_SERVER, proxy_server_name) or ""
|
||||
}
|
||||
if DNS_REDIRECT then
|
||||
local hosts = {}
|
||||
api.uci:foreach("dhcp", "host", function(s)
|
||||
if datatypes.hostname(s.name or "") and datatypes.ip4addr(s.ip or "") then
|
||||
hosts[#hosts + 1] = s.ip .. " " .. s.name
|
||||
end
|
||||
end)
|
||||
|
||||
local hosts_file = FLAG_PATH .. "/dhcp-static-hosts"
|
||||
if fs.writefile(hosts_file, table.concat(hosts, "\n") .. "\n") and #hosts > 0 then
|
||||
table.insert(config_lines, string.format("hosts-file %q", hosts_file))
|
||||
end
|
||||
|
||||
-- SmartDNS monitors the lease file and updates local records without a restart.
|
||||
local lease_file = api.uci_get("dhcp", "@dnsmasq[0]", "leasefile")
|
||||
if not lease_file or lease_file == "" then lease_file = "/tmp/dhcp.leases" end
|
||||
|
||||
Reference in new issue
Block a user