mirror of https://github.com/kenzok8/small.git
update 2025-03-05 00:17:12
This commit is contained in:
parent
bc0f2e9017
commit
69aece8f3f
|
@ -45,7 +45,34 @@ o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/chi
|
||||||
o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/apple-cn.txt", translate("Loyalsoldier/apple-cn"))
|
o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/apple-cn.txt", translate("Loyalsoldier/apple-cn"))
|
||||||
o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/google-cn.txt", translate("Loyalsoldier/google-cn"))
|
o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/google-cn.txt", translate("Loyalsoldier/google-cn"))
|
||||||
|
|
||||||
s:append(Template(appname .. "/rule/rule_version"))
|
if has_xray or has_singbox then
|
||||||
|
o = s:option(ListValue, "geoip_url", translate("GeoIP Update URL"))
|
||||||
|
o:value("https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest", translate("Loyalsoldier/geoip"))
|
||||||
|
o:value("https://api.github.com/repos/MetaCubeX/meta-rules-dat/releases/latest", translate("MetaCubeX/geoip"))
|
||||||
|
o.default = "https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest"
|
||||||
|
|
||||||
|
o = s:option(ListValue, "geosite_url", translate("Geosite Update URL"))
|
||||||
|
o:value("https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest", translate("Loyalsoldier/geosite"))
|
||||||
|
o:value("https://api.github.com/repos/MetaCubeX/meta-rules-dat/releases/latest", translate("MetaCubeX/geosite"))
|
||||||
|
o.default = "https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest"
|
||||||
|
|
||||||
|
o = s:option(Value, "v2ray_location_asset", translate("Location of Geo rule files"), translate("This variable specifies a directory where geoip.dat and geosite.dat files are."))
|
||||||
|
o.default = "/usr/share/v2ray/"
|
||||||
|
o.placeholder = "/usr/share/v2ray/"
|
||||||
|
o.rmempty = false
|
||||||
|
|
||||||
|
if api.is_finded("geoview") then
|
||||||
|
o = s:option(Flag, "enable_geoview", translate("Enable Geo Data Parsing"))
|
||||||
|
o.default = 0
|
||||||
|
o.rmempty = false
|
||||||
|
o.description = "<ul>"
|
||||||
|
.. "<li>" .. translate("Experimental feature.") .. "</li>"
|
||||||
|
.. "<li>" .. "1." .. translate("Analyzes and preloads GeoIP/Geosite data to enhance the shunt performance of Sing-box/Xray.") .. "</li>"
|
||||||
|
.. "<li>" .. "2." .. translate("Once enabled, the rule list can support GeoIP/Geosite rules.") .. "</li>"
|
||||||
|
.. "<li>" .. translate("Note: Increases resource usage; Geosite analysis is only supported in ChinaDNS-NG and SmartDNS modes.") .. "</li>"
|
||||||
|
.. "</ul>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---- Auto Update
|
---- Auto Update
|
||||||
o = s:option(Flag, "auto_update", translate("Enable auto update rules"))
|
o = s:option(Flag, "auto_update", translate("Enable auto update rules"))
|
||||||
|
@ -88,23 +115,9 @@ o.default = 2
|
||||||
o:depends("week_update", "8")
|
o:depends("week_update", "8")
|
||||||
o.rmempty = true
|
o.rmempty = true
|
||||||
|
|
||||||
|
s:append(Template(appname .. "/rule/rule_version"))
|
||||||
|
|
||||||
if has_xray or has_singbox then
|
if has_xray or has_singbox then
|
||||||
o = s:option(Value, "v2ray_location_asset", translate("Location of V2ray/Xray asset"), translate("This variable specifies a directory where geoip.dat and geosite.dat files are."))
|
|
||||||
o.default = "/usr/share/v2ray/"
|
|
||||||
o.rmempty = false
|
|
||||||
|
|
||||||
if api.is_finded("geoview") then
|
|
||||||
o = s:option(Flag, "enable_geoview", translate("Enable Geo Data Parsing"))
|
|
||||||
o.default = 0
|
|
||||||
o.rmempty = false
|
|
||||||
o.description = "<ul>"
|
|
||||||
.. "<li>" .. translate("Experimental feature.") .. "</li>"
|
|
||||||
.. "<li>" .. "1." .. translate("Analyzes and preloads GeoIP/Geosite data to enhance the shunt performance of Sing-box/Xray.") .. "</li>"
|
|
||||||
.. "<li>" .. "2." .. translate("Once enabled, the rule list can support GeoIP/Geosite rules.") .. "</li>"
|
|
||||||
.. "<li>" .. translate("Note: Increases resource usage; Geosite analysis is only supported in ChinaDNS-NG and SmartDNS modes.") .. "</li>"
|
|
||||||
.. "</ul>"
|
|
||||||
end
|
|
||||||
|
|
||||||
s = m:section(TypedSection, "shunt_rules", "Sing-Box/Xray " .. translate("Shunt Rule"), "<a style='color: red'>" .. translate("Please note attention to the priority, the higher the order, the higher the priority.") .. "</a>")
|
s = m:section(TypedSection, "shunt_rules", "Sing-Box/Xray " .. translate("Shunt Rule"), "<a style='color: red'>" .. translate("Please note attention to the priority, the higher the order, the higher the priority.") .. "</a>")
|
||||||
s.template = "cbi/tblsection"
|
s.template = "cbi/tblsection"
|
||||||
s.anonymous = false
|
s.anonymous = false
|
||||||
|
|
|
@ -937,8 +937,14 @@ msgstr "小时"
|
||||||
msgid "Hour"
|
msgid "Hour"
|
||||||
msgstr "小时"
|
msgstr "小时"
|
||||||
|
|
||||||
msgid "Location of V2ray/Xray asset"
|
msgid "GeoIP Update URL"
|
||||||
msgstr "V2ray/Xray 资源文件目录"
|
msgstr "GeoIP 更新URL"
|
||||||
|
|
||||||
|
msgid "Geosite Update URL"
|
||||||
|
msgstr "Geosite 更新URL"
|
||||||
|
|
||||||
|
msgid "Location of Geo rule files"
|
||||||
|
msgstr "Geo 规则文件目录"
|
||||||
|
|
||||||
msgid "This variable specifies a directory where geoip.dat and geosite.dat files are."
|
msgid "This variable specifies a directory where geoip.dat and geosite.dat files are."
|
||||||
msgstr "此变量指定 geoip.dat 和 geosite.dat 文件所在的目录。"
|
msgstr "此变量指定 geoip.dat 和 geosite.dat 文件所在的目录。"
|
||||||
|
|
|
@ -72,6 +72,8 @@ config global_rules
|
||||||
list chnlist_url 'https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf'
|
list chnlist_url 'https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf'
|
||||||
list chnlist_url 'https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf'
|
list chnlist_url 'https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf'
|
||||||
option v2ray_location_asset '/usr/share/v2ray/'
|
option v2ray_location_asset '/usr/share/v2ray/'
|
||||||
|
option geoip_url 'https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest'
|
||||||
|
option geosite_url 'https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest'
|
||||||
|
|
||||||
config global_app
|
config global_app
|
||||||
option singbox_file '/usr/bin/sing-box'
|
option singbox_file '/usr/bin/sing-box'
|
||||||
|
|
|
@ -350,8 +350,7 @@ parse_doh() {
|
||||||
get_geoip() {
|
get_geoip() {
|
||||||
local geoip_code="$1"
|
local geoip_code="$1"
|
||||||
local geoip_type_flag=""
|
local geoip_type_flag=""
|
||||||
local geoip_path="$(config_t_get global_rules v2ray_location_asset)"
|
local geoip_path="${V2RAY_LOCATION_ASSET%*/}/geoip.dat"
|
||||||
geoip_path="${geoip_path%*/}/geoip.dat"
|
|
||||||
[ -s "$geoip_path" ] || { echo ""; return 1; }
|
[ -s "$geoip_path" ] || { echo ""; return 1; }
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"ipv4") geoip_type_flag="-ipv6=false" ;;
|
"ipv4") geoip_type_flag="-ipv6=false" ;;
|
||||||
|
@ -777,9 +776,8 @@ run_redir() {
|
||||||
sing-box)
|
sing-box)
|
||||||
local protocol=$(config_n_get $node protocol)
|
local protocol=$(config_n_get $node protocol)
|
||||||
[ "$protocol" = "_shunt" ] && {
|
[ "$protocol" = "_shunt" ] && {
|
||||||
local geo_path="$(config_t_get global_rules v2ray_location_asset)"
|
local geoip_path="${V2RAY_LOCATION_ASSET%*/}/geoip.dat"
|
||||||
local geoip_path="${geo_path%*/}/geoip.dat"
|
local geosite_path="${V2RAY_LOCATION_ASSET%*/}/geosite.dat"
|
||||||
local geosite_path="${geo_path%*/}/geosite.dat"
|
|
||||||
if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then
|
if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then
|
||||||
echolog "* 缺少Geo规则文件,UDP Sing-Box分流节点无法正常使用!"
|
echolog "* 缺少Geo规则文件,UDP Sing-Box分流节点无法正常使用!"
|
||||||
fi
|
fi
|
||||||
|
@ -789,9 +787,8 @@ run_redir() {
|
||||||
xray)
|
xray)
|
||||||
local protocol=$(config_n_get $node protocol)
|
local protocol=$(config_n_get $node protocol)
|
||||||
[ "$protocol" = "_shunt" ] && {
|
[ "$protocol" = "_shunt" ] && {
|
||||||
local geo_path="$(config_t_get global_rules v2ray_location_asset)"
|
local geoip_path="${V2RAY_LOCATION_ASSET%*/}/geoip.dat"
|
||||||
local geoip_path="${geo_path%*/}/geoip.dat"
|
local geosite_path="${V2RAY_LOCATION_ASSET%*/}/geosite.dat"
|
||||||
local geosite_path="${geo_path%*/}/geosite.dat"
|
|
||||||
if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then
|
if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then
|
||||||
echolog "* 缺少Geo规则文件,UDP Xray分流节点无法正常使用!"
|
echolog "* 缺少Geo规则文件,UDP Xray分流节点无法正常使用!"
|
||||||
fi
|
fi
|
||||||
|
@ -896,9 +893,8 @@ run_redir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "$protocol" = "_shunt" ] && {
|
[ "$protocol" = "_shunt" ] && {
|
||||||
local geo_path="$(config_t_get global_rules v2ray_location_asset)"
|
local geoip_path="${V2RAY_LOCATION_ASSET%*/}/geoip.dat"
|
||||||
local geoip_path="${geo_path%*/}/geoip.dat"
|
local geosite_path="${V2RAY_LOCATION_ASSET%*/}/geosite.dat"
|
||||||
local geosite_path="${geo_path%*/}/geosite.dat"
|
|
||||||
if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then
|
if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then
|
||||||
echolog "* 缺少Geo规则文件,TCP Sing-Box分流节点无法正常使用!"
|
echolog "* 缺少Geo规则文件,TCP Sing-Box分流节点无法正常使用!"
|
||||||
fi
|
fi
|
||||||
|
@ -983,9 +979,8 @@ run_redir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "$protocol" = "_shunt" ] && {
|
[ "$protocol" = "_shunt" ] && {
|
||||||
local geo_path="$(config_t_get global_rules v2ray_location_asset)"
|
local geoip_path="${V2RAY_LOCATION_ASSET%*/}/geoip.dat"
|
||||||
local geoip_path="${geo_path%*/}/geoip.dat"
|
local geosite_path="${V2RAY_LOCATION_ASSET%*/}/geosite.dat"
|
||||||
local geosite_path="${geo_path%*/}/geosite.dat"
|
|
||||||
if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then
|
if [ ! -s "$geoip_path" ] || [ ! -s "$geosite_path" ]; then
|
||||||
echolog "* 缺少Geo规则文件,TCP Xray分流节点无法正常使用!"
|
echolog "* 缺少Geo规则文件,TCP Xray分流节点无法正常使用!"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -88,7 +88,7 @@ local function insert_array_after(array1, array2, target) --将array2插入到ar
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_geosite(list_arg, out_path)
|
local function get_geosite(list_arg, out_path)
|
||||||
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset")
|
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"
|
||||||
geosite_path = geosite_path:match("^(.*)/") .. "/geosite.dat"
|
geosite_path = geosite_path:match("^(.*)/") .. "/geosite.dat"
|
||||||
if not is_file_nonzero(geosite_path) then return 1 end
|
if not is_file_nonzero(geosite_path) then return 1 end
|
||||||
if api.is_finded("geoview") and list_arg and out_path then
|
if api.is_finded("geoview") and list_arg and out_path then
|
||||||
|
|
|
@ -92,7 +92,7 @@ local function insert_array_after(array1, array2, target) --将array2插入到ar
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_geosite(list_arg, out_path)
|
local function get_geosite(list_arg, out_path)
|
||||||
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset")
|
local geosite_path = uci:get(appname, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"
|
||||||
geosite_path = geosite_path:match("^(.*)/") .. "/geosite.dat"
|
geosite_path = geosite_path:match("^(.*)/") .. "/geosite.dat"
|
||||||
if not is_file_nonzero(geosite_path) then return 1 end
|
if not is_file_nonzero(geosite_path) then return 1 end
|
||||||
if api.is_finded("geoview") and list_arg and out_path then
|
if api.is_finded("geoview") and list_arg and out_path then
|
||||||
|
|
|
@ -33,8 +33,8 @@ local gfwlist_url = uci:get(name, "@global_rules[0]", "gfwlist_url") or {"https:
|
||||||
local chnroute_url = uci:get(name, "@global_rules[0]", "chnroute_url") or {"https://ispip.clang.cn/all_cn.txt"}
|
local chnroute_url = uci:get(name, "@global_rules[0]", "chnroute_url") or {"https://ispip.clang.cn/all_cn.txt"}
|
||||||
local chnroute6_url = uci:get(name, "@global_rules[0]", "chnroute6_url") or {"https://ispip.clang.cn/all_cn_ipv6.txt"}
|
local chnroute6_url = uci:get(name, "@global_rules[0]", "chnroute6_url") or {"https://ispip.clang.cn/all_cn_ipv6.txt"}
|
||||||
local chnlist_url = uci:get(name, "@global_rules[0]", "chnlist_url") or {"https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf","https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf","https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/google.china.conf"}
|
local chnlist_url = uci:get(name, "@global_rules[0]", "chnlist_url") or {"https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/accelerated-domains.china.conf","https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/apple.china.conf","https://fastly.jsdelivr.net/gh/felixonmars/dnsmasq-china-list/google.china.conf"}
|
||||||
local geoip_api = "https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest"
|
local geoip_api = uci:get(name, "@global_rules[0]", "geoip_url") or "https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest"
|
||||||
local geosite_api = "https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest"
|
local geosite_api = uci:get(name, "@global_rules[0]", "geosite_url") or "https://api.github.com/repos/Loyalsoldier/v2ray-rules-dat/releases/latest"
|
||||||
local asset_location = uci:get(name, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"
|
local asset_location = uci:get(name, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"
|
||||||
local use_nft = uci:get(name, "@global_forwarding[0]", "use_nft") or "0"
|
local use_nft = uci:get(name, "@global_forwarding[0]", "use_nft") or "0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue