mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-17 05:32:56 +08:00
update 2026-08-15 00:44:02
This commit is contained in:
1 parent
58e04d6ceb
commit
a59171002f
84 files changed
+919
-835
No files matched your search
@@ -204,7 +204,7 @@ end
|
||||
current_node = current_node_id and m:get(current_node_id) or {}
|
||||
|
||||
o = s:option(Flag, "log", translate("Enable Node Log"))
|
||||
o:depends({ _hide_node_option = "1", ['!reverse'] = true })
|
||||
o:depends({ node = "", ['!reverse'] = true })
|
||||
|
||||
o = s:option(ListValue, "loglevel", translate("Log Level"))
|
||||
o.default = "warn"
|
||||
@@ -352,6 +352,10 @@ o:depends("remote_dns_protocol", "http3")
|
||||
o:depends("remote_dns_protocol", "quic")
|
||||
o:depends("remote_dns_protocol", "tls")
|
||||
|
||||
o = s:option(Value, "remote_rewrite_ttl", translate("Remote DNS") .. " TTL")
|
||||
o.datatype = "min(1)"
|
||||
o.default = "30"
|
||||
|
||||
o = s:option(ListValue, "dns_hosts_mode", translate("Domain Override"))
|
||||
o:value("default", translate("Use global config"))
|
||||
o:value("disable", translate("No patterns are used"))
|
||||
@@ -377,6 +381,9 @@ local o_node = s.fields["node"]
|
||||
for k, v in pairs(nodes_table) do
|
||||
o_node:value(v.id, v["remark"])
|
||||
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
if v.type == "sing-box" then
|
||||
s.fields["remote_rewrite_ttl"]:depends({ node = v.id })
|
||||
end
|
||||
if v.node_type == "normal" or v.protocol == "_balancing" or v.protocol == "_urltest" then
|
||||
--Shunt node has its own separate options.
|
||||
s.fields["remote_fakedns"]:depends({ node = v.id, remote_dns_protocol = "tcp" })
|
||||
|
||||
@@ -234,6 +234,12 @@ o:value("UseIP")
|
||||
o:value("UseIPv4")
|
||||
o:value("UseIPv6")
|
||||
|
||||
if current_node.type == "sing-box" then
|
||||
o = s:taboption("DNS", Value, "remote_rewrite_ttl", translate("Remote DNS") .. " TTL")
|
||||
o.datatype = "min(1)"
|
||||
o.default = "30"
|
||||
end
|
||||
|
||||
o = s:taboption("DNS", TextValue, "dns_hosts", translate("Domain Override"))
|
||||
o.rows = 5
|
||||
o.wrap = "off"
|
||||
|
||||
@@ -1116,6 +1116,7 @@ function gen_config(var)
|
||||
local remote_dns_query_strategy = var["remote_dns_query_strategy"]
|
||||
local remote_dns_fake = var["remote_dns_fake"]
|
||||
local remote_dns_client_ip = var["remote_dns_client_ip"]
|
||||
local remote_rewrite_ttl = var["remote_rewrite_ttl"] or "30"
|
||||
local dns_cache = var["dns_cache"]
|
||||
local tags = var["tags"]
|
||||
local no_run = var["no_run"]
|
||||
@@ -2026,7 +2027,7 @@ function gen_config(var)
|
||||
end
|
||||
if value.outboundTag ~= "block" and value.outboundTag ~= "direct" then
|
||||
dns_rule.server = "remote"
|
||||
dns_rule.rewrite_ttl = 30
|
||||
dns_rule.rewrite_ttl = tonumber(remote_rewrite_ttl)
|
||||
if true then
|
||||
local block_rule
|
||||
if remote_strategy == "ipv4_only" then
|
||||
@@ -2073,29 +2074,42 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
if default_dns_flag == "remote" then
|
||||
local block_rule
|
||||
local dns_rule_query_type = { "A", "AAAA" }
|
||||
if remote_strategy == "ipv4_only" then
|
||||
block_rule = {
|
||||
query_type = { "AAAA" },
|
||||
action = "predefined",
|
||||
rcode = "NOERROR"
|
||||
}
|
||||
dns_rule_query_type = { "A" }
|
||||
elseif remote_strategy == "ipv6_only" then
|
||||
block_rule = {
|
||||
query_type = { "A" },
|
||||
action = "predefined",
|
||||
rcode = "NOERROR"
|
||||
}
|
||||
dns_rule_query_type = { "AAAA" }
|
||||
end
|
||||
if block_rule then
|
||||
table.insert(dns.rules, block_rule)
|
||||
end
|
||||
if remote_dns_fake then
|
||||
-- When default is not direct and enable fakedns, default DNS use FakeDNS.
|
||||
local fakedns_dns_rule = {
|
||||
query_type = dns_rule_query_type,
|
||||
server = fakedns_tag,
|
||||
disable_cache = true,
|
||||
rewrite_ttl = 30
|
||||
rewrite_ttl = tonumber(remote_rewrite_ttl)
|
||||
}
|
||||
table.insert(dns.rules, fakedns_dns_rule)
|
||||
else
|
||||
local remote_dns_rule = {
|
||||
query_type = dns_rule_query_type,
|
||||
server = "remote",
|
||||
disable_cache = true,
|
||||
}
|
||||
table.insert(dns.rules, remote_dns_rule)
|
||||
end
|
||||
local remote_dns_rule = {
|
||||
server = "remote",
|
||||
disable_cache = true,
|
||||
rewrite_ttl = tonumber(remote_rewrite_ttl)
|
||||
}
|
||||
table.insert(dns.rules, remote_dns_rule)
|
||||
end
|
||||
local dns_in_inbound = {
|
||||
type = "direct",
|
||||
|
||||
@@ -201,7 +201,7 @@ run_xray() {
|
||||
|
||||
run_singbox() {
|
||||
local flag node redir_port tcp_proxy_way socks_address socks_port socks_username socks_password http_address http_port http_username http_password
|
||||
local dns_listen_port direct_dns_query_strategy remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_dns_detour remote_fakedns remote_dns_query_strategy dns_cache
|
||||
local dns_listen_port direct_dns_query_strategy remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_dns_detour remote_fakedns remote_dns_query_strategy remote_rewrite_ttl dns_cache
|
||||
local loglevel log_file config_file
|
||||
eval_set_val $@
|
||||
local type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
|
||||
@@ -317,6 +317,7 @@ run_singbox() {
|
||||
[ -n "$dns_listen_port" ] && json_add_string "dns_listen_port" "${dns_listen_port}"
|
||||
[ -n "$dns_cache" ] && json_add_string "dns_cache" "${dns_cache}"
|
||||
[ "$remote_fakedns" = "1" ] && json_add_string "remote_dns_fake" "1"
|
||||
[ -n "$remote_rewrite_ttl" ] && json_add_string "remote_rewrite_ttl" "${remote_rewrite_ttl}"
|
||||
}
|
||||
json_add_string "direct_dns_udp_port" "${DIRECT_DNS_UDP_PORT}"
|
||||
json_add_string "direct_dns_udp_server" "${DIRECT_DNS_UDP_SERVER}"
|
||||
@@ -612,6 +613,7 @@ run_global() {
|
||||
|
||||
local _remote_dns_client_ip=$(config_t_get global remote_dns_client_ip)
|
||||
[ -n "${_remote_dns_client_ip}" ] && V2RAY_ARGS="${V2RAY_ARGS} remote_dns_client_ip=${_remote_dns_client_ip}"
|
||||
V2RAY_ARGS="${V2RAY_ARGS} remote_rewrite_ttl=$(config_t_get global remote_rewrite_ttl)"
|
||||
}
|
||||
dns_msg="${dns_msg})"
|
||||
|
||||
@@ -982,7 +984,7 @@ acl_app() {
|
||||
dnsmasq_port=${GLOBAL_DNSMASQ_PORT:-11400}
|
||||
for sid in $items; do
|
||||
index=$(expr $index + 1)
|
||||
local enabled sid remarks sources interface tcp_no_redir_ports udp_no_redir_ports node direct_dns_query_strategy remote_dns_protocol remote_dns remote_dns_doh remote_dns_client_ip remote_dns_detour remote_fakedns remote_dns_query_strategy log loglevel log_file
|
||||
local enabled sid remarks sources interface tcp_no_redir_ports udp_no_redir_ports node direct_dns_query_strategy remote_dns_protocol remote_dns remote_dns_doh remote_dns_client_ip remote_dns_detour remote_fakedns remote_dns_query_strategy remote_rewrite_ttl log loglevel log_file
|
||||
local _ip _mac _iprange _ipset _ip_or_mac source_list config_file
|
||||
[ "$(config_n_get $sid enabled)" = "1" ] || continue
|
||||
has_enabled=1
|
||||
@@ -1086,7 +1088,8 @@ acl_app() {
|
||||
dns_listen_port=${dns_port} \
|
||||
direct_dns_query_strategy=${direct_dns_query_strategy} \
|
||||
remote_dns_protocol=${remote_dns_protocol} remote_dns_tcp_server=${remote_dns} remote_dns_udp_server=${remote_dns} remote_dns_doh="${remote_dns}" \
|
||||
remote_dns_client_ip=${remote_dns_client_ip} remote_dns_detour=${remote_dns_detour} remote_fakedns=${remote_fakedns} remote_dns_query_strategy=${remote_dns_query_strategy} \
|
||||
remote_dns_client_ip=${remote_dns_client_ip} remote_dns_detour=${remote_dns_detour} remote_dns_query_strategy=${remote_dns_query_strategy} \
|
||||
remote_fakedns=${remote_fakedns} remote_rewrite_ttl=${remote_rewrite_ttl} \
|
||||
config_file=${config_file} \
|
||||
log_file="${log_file}" loglevel="${loglevel}"
|
||||
local status=$?
|
||||
@@ -1108,7 +1111,7 @@ acl_app() {
|
||||
}
|
||||
fi
|
||||
}
|
||||
unset enabled sid remarks sources interface tcp_no_redir_ports udp_no_redir_ports node direct_dns_query_strategy remote_dns_protocol remote_dns remote_dns_doh remote_dns_client_ip remote_dns_detour remote_fakedns remote_dns_query_strategy
|
||||
unset enabled sid remarks sources interface tcp_no_redir_ports udp_no_redir_ports node direct_dns_query_strategy remote_dns_protocol remote_dns remote_dns_doh remote_dns_client_ip remote_dns_detour remote_fakedns remote_dns_query_strategy remote_rewrite_ttl
|
||||
unset _ip _mac _iprange _ipset _ip_or_mac source_list config_file
|
||||
done
|
||||
unset redir_port dns_port dnsmasq_port
|
||||
|
||||
Reference in new issue
Block a user