update 2025-05-16 20:15:49

This commit is contained in:
actions-user 2025-05-16 20:15:49 +08:00
parent e4acc6e018
commit 4002788e58
4 changed files with 39 additions and 4 deletions

View File

@ -453,6 +453,21 @@ if api.is_finded("smartdns") then
end
return DynamicList.write(self, section, t)
end
function o.validate(self, value) --禁止私有IP
if type(value) == "table" then
for _, v in ipairs(value) do
if v:match("127%.0%.0%.") or
v:match("192%.168%.") or
v:match("10%.") or
v:match("172%.1[6-9]%.") or
v:match("172%.2[0-9]%.") or
v:match("172%.3[0-1]%.") then
return nil, translatef("Private IPs are not allowed: %s", v)
end
end
end
return value
end
end
o = s:taboption("DNS", ListValue, "xray_dns_mode", translate("Request protocol"))

View File

@ -118,6 +118,9 @@ msgstr "国内分组名"
msgid "You only need to configure domestic DNS packets in SmartDNS and set it redirect or as Dnsmasq upstream, and fill in the domestic DNS group name here."
msgstr "您只需要在SmartDNS配置好国内DNS分组并设置重定向或作为Dnsmasq上游此处填入国内DNS分组名。"
msgid "Private IPs are not allowed: %s"
msgstr "不允许使用私有 IP 地址:%s"
msgid "Filter Mode"
msgstr "过滤模式"

View File

@ -168,6 +168,23 @@ config_lines = {
DNS_MODE == "socks" and string.format("proxy-server socks5://%s -name %s", REMOTE_PROXY_SERVER, proxy_server_name) or nil
}
if DNS_MODE == "socks" then
local found_private = false
for dns in string.gmatch(REMOTE_DNS, "([^|]+)") do
-- 判断是否为私有地址
if dns:match("127%.0%.0%.") or
dns:match("192%.168%.") or
dns:match("10%.") or
dns:match("172%.1[6-9]%.") or
dns:match("172%.2[0-9]%.") or
dns:match("172%.3[0-1]%.") then
found_private = true
break
end
end
if found_private then
REMOTE_DNS = "tcp://1.1.1.1"
log(" * 错误SmartDNS 远程 DNS 不允许使用私有地址将默认使用tcp://1.1.1.1")
end
string.gsub(REMOTE_DNS, '[^' .. "|" .. ']+', function(w)
local server_dns = w
local server_param = string.format("server %s -group %s -proxy %s", "%s", REMOTE_GROUP, proxy_server_name)

View File

@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/MetaCubeX/mihomo.git
PKG_SOURCE_DATE:=2025-05-13
PKG_SOURCE_VERSION:=266fb03838365bb5df14d7531476514427eba2e4
PKG_MIRROR_HASH:=e449c3f931945fbe601a119cc7ef2630a7e8360bd51bd7cc98f9edc686c79c64
PKG_SOURCE_DATE:=2025-05-15
PKG_SOURCE_VERSION:=bb8c47d83df74d9873933067c689495944dea314
PKG_MIRROR_HASH:=6fb158a108d96fb3e6a95311812c5ec4a489505bd28b6722baaabc1f794fa99c
PKG_LICENSE:=GPL3.0+
PKG_MAINTAINER:=Joseph Mory <morytyann@gmail.com>
@ -16,7 +16,7 @@ PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=no-mips16
PKG_BUILD_VERSION:=alpha-266fb03
PKG_BUILD_VERSION:=alpha-bb8c47d
PKG_BUILD_TIME:=$(shell date -u -Iseconds)
GO_PKG:=github.com/metacubex/mihomo