Sync 2023-11-12 16:22

This commit is contained in:
github-actions[bot] 2023-11-12 16:22:59 +08:00
parent 6f683715eb
commit b2eb82e0a9
16 changed files with 95 additions and 84947 deletions

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=190
PKG_RELEASE:=2
PKG_VERSION:=188
PKG_RELEASE:=3
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NONE_V2RAY \
@ -42,9 +42,6 @@ LUCI_DEPENDS:= \
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core \
+PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG:chinadns-ng \
+PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS:mosdns \
+PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS:jq \
+PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS:v2dat \
+PACKAGE_$(PKG_NAME)_INCLUDE_MosDNS:diffutils \
+PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria:hysteria \
+PACKAGE_$(PKG_NAME)_INCLUDE_Tuic_Client:tuic-client \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadow_TLS:shadow-tls \

View File

@ -69,7 +69,7 @@ o:depends("netflix_enable", "1")
o = s:option(ListValue, "shunt_dns_mode", translate("DNS Query Mode For Shunt Mode"))
o:value("1", translate("Use DNS2SOCKS query and cache"))
o:value("2", translate("Use MosDNS query"))
o:value("2", translate("Use MOSDNS query"))
o:depends("netflix_enable", "1")
o.default = 1
@ -97,9 +97,9 @@ o:value("tcp://4.2.2.1:53,tcp://4.2.2.2:53", translate("Level 3 Public DNS-2 (4.
o:value("tcp://4.2.2.3:53,tcp://4.2.2.4:53", translate("Level 3 Public DNS-3 (4.2.2.3-4)"))
o:value("tcp://1.1.1.1:53,tcp://1.0.0.1:53", translate("Cloudflare DNS"))
o:depends("shunt_dns_mode", "2")
o.description = translate("Custom DNS Server for MosDNS")
o.description = translate("Custom DNS Server for mosdns")
o = s:option(Flag, "shunt_mosdns_ipv6", translate("Disable IPv6 In MosDNS Query Mode (Shunt Mode)"))
o = s:option(Flag, "shunt_mosdns_ipv6", translate("Disable IPv6 In MOSDNS Query Mode (Shunt Mode)"))
o:depends("shunt_dns_mode", "2")
o.rmempty = false
o.default = "0"

View File

@ -93,7 +93,7 @@ o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode"))
o:value("1", translate("Use DNS2TCP query"))
o:value("2", translate("Use DNS2SOCKS query and cache"))
if is_finded("mosdns") then
o:value("3", translate("Use MosDNS query (Not Support Oversea Mode)"))
o:value("3", translate("Use MOSDNS query (Not Support Oversea Mode)"))
end
o:value("0", translate("Use Local DNS Service listen port 5335"))
o.default = 1
@ -125,9 +125,9 @@ o:value("tcp://4.2.2.1:53,tcp://4.2.2.2:53", translate("Level 3 Public DNS-2 (4.
o:value("tcp://4.2.2.3:53,tcp://4.2.2.4:53", translate("Level 3 Public DNS-3 (4.2.2.3-4)"))
o:value("tcp://1.1.1.1:53,tcp://1.0.0.1:53", translate("Cloudflare DNS"))
o:depends("pdnsd_enable", "3")
o.description = translate("Custom DNS Server for MosDNS")
o.description = translate("Custom DNS Server for mosdns")
o = s:option(Flag, "mosdns_disable_ipv6", translate("Disable IPv6 in MosDNS query mode (only for Non-CN domain)"))
o = s:option(Flag, "mosdns_ipv6", translate("Disable IPv6 in MOSDNS query mode"))
o:depends("pdnsd_enable", "3")
o.rmempty = false
o.default = "0"
@ -141,8 +141,8 @@ if is_finded("chinadns-ng") then
o:value("119.29.29.29:53", translate("DNSPod Public DNS (119.29.29.29)"))
o:value("223.5.5.5:53", translate("AliYun Public DNS (223.5.5.5)"))
o:value("180.76.76.76:53", translate("Baidu Public DNS (180.76.76.76)"))
o:value("101.226.4.6:53", translate("DNS Pai (CT/CMCC/CU) (101.226.4.6)"))
o:value("123.125.81.6:53", translate("DNS Pai (CU) (123.125.81.6)"))
o:value("101.226.4.6:53", translate("360 Security DNS (China Telecom) (101.226.4.6)"))
o:value("123.125.81.6:53", translate("360 Security DNS (China Unicom) (123.125.81.6)"))
o:value("1.2.4.8:53", translate("CNNIC SDNS (1.2.4.8)"))
o:depends({pdnsd_enable = "1", run_mode = "router"})
o:depends({pdnsd_enable = "2", run_mode = "router"})
@ -164,24 +164,5 @@ if is_finded("chinadns-ng") then
end
end
if is_finded("mosdns") then
o = s:option(Value, "chinadns_forward_mosdns", translate("Domestic DNS Server (ChinaDNS Mode With MosDNS)"))
o:value("", translate("Disable ChinaDNS in MosDNS"))
o:value("wan", translate("Use DNS from WAN"))
o:value("udp://114.114.114.114:53,udp://114.114.115.115:53", translate("Nanjing Xinfeng 114DNS"))
o:value("udp://119.29.29.29:53,udp://119.29.29.29:53", translate("DNSPod Public DNS"))
o:value("udp://223.5.5.5:53,udp://223.6.6.6:53", translate("AliYun Public DNS"))
o:value("udp://180.76.76.76:53,udp://180.76.76.76:53", translate("Baidu Public DNS"))
o:value("udp://101.226.4.6:53,udp://218.30.118.6:53", translate("DNS Pai (CT/CMCC/CU)"))
o:value("udp://123.125.81.6:53,udp://140.207.198.6:53", translate("DNS Pai (CU)"))
o:value("udp://1.2.4.8:53,udp://210.2.4.8:53", translate("CNNIC SDNS"))
o:depends({pdnsd_enable = "3", run_mode = "router"})
o.description = translate("Custom DNS Server format as IP:PORT (default: disabled)")
end
o = s:option(Flag, "mosdns_dnsleak", translate("Prevent DNS leak (Only Work With ChinaDNS Mode)"))
o:depends({pdnsd_enable = "3", run_mode = "router"})
o.rmempty = false
o.default = "0"
return m

View File

@ -14,8 +14,6 @@ local gfw_count = 0
local ad_count = 0
local ip_count = 0
local nfip_count = 0
local mainland_domain_count = 0
local non_mainland_domain_count = 0
local Process_list = luci.sys.exec("busybox ps -w")
local uci = luci.model.uci.cursor()
-- html constants
@ -54,14 +52,6 @@ if nixio.fs.access("/etc/ssrplus/netflixip.list") then
nfip_count = tonumber(luci.sys.exec("cat /etc/ssrplus/netflixip.list | wc -l"))
end
if nixio.fs.access("/etc/ssrplus/mosdns-chinadns/geosite_cn.txt") then
mainland_domain_count = tonumber(luci.sys.exec("cat /etc/ssrplus/mosdns-chinadns/geosite_cn.txt | wc -l"))
end
if nixio.fs.access("/etc/ssrplus/mosdns-chinadns/geosite_geolocation_not_cn.txt") then
non_mainland_domain_count = tonumber(luci.sys.exec("cat /etc/ssrplus/mosdns-chinadns/geosite_geolocation_not_cn.txt | wc -l"))
end
if Process_list:find("udp.only.ssr.reudp") then
reudp_run = 1
end
@ -180,24 +170,10 @@ s.template = "shadowsocksr/refresh"
s.value = ip_count .. " " .. translate("Records")
if uci:get_first("shadowsocksr", 'global', 'netflix_enable', '0') ~= '0' then
s = m:field(DummyValue, "nfip_data", translate("Netflix IP Data"))
s.rawhtml = true
s.template = "shadowsocksr/refresh"
s.value = nfip_count .. " " .. translate("Records")
end
if uci:get_first("shadowsocksr", 'global', 'pdnsd_enable', '0') == '3' then
s = m:field(DummyValue, "geo_data", translate("Loyalsoldier's GeoData"))
s.rawhtml = true
s.template = "shadowsocksr/refresh"
s = m:field(DummyValue, "mainland_domain_count", translate("Loyalsoldier's GeoData: Mainland Domain Data"))
s.rawhtml = true
s.value = mainland_domain_count .. " " .. translate("Records")
s = m:field(DummyValue, "non_mainland_domain_count", translate("Loyalsoldier's GeoData: Non-Mainland Domain Data"))
s.rawhtml = true
s.value = non_mainland_domain_count .. " " .. translate("Records")
s = m:field(DummyValue, "nfip_data", translate("Netflix IP Data"))
s.rawhtml = true
s.template = "shadowsocksr/refresh"
s.value = nfip_count .. " " .. translate("Records")
end
if uci:get_first("shadowsocksr", 'global', 'adblock', '0') == '1' then

View File

@ -188,6 +188,7 @@ msgstr "QUIC 连接接收窗口"
msgid "QUIC stream receive window"
msgstr "QUIC 流接收窗口"
msgid "Lazy Start"
msgstr "延迟启动"
@ -389,15 +390,6 @@ msgstr "【中国大陆 IP 段】数据库"
msgid "Netflix IP Data"
msgstr "【Netflix IP 段】数据库"
msgid "Loyalsoldier's GeoData"
msgstr "【GeoData】数据库 (Loyalsoldier)"
msgid "Loyalsoldier's GeoData: Mainland Domain Data"
msgstr "【GeoData 中的大陆域名】数据库 (Loyalsoldier)"
msgid "Loyalsoldier's GeoData: Non-Mainland Domain Data"
msgstr "【GeoData 中的非大陆域名】数据库 (Loyalsoldier)"
msgid "Advertising Data"
msgstr "【广告屏蔽】数据库"
@ -539,11 +531,11 @@ msgstr "使用 DNS2TCP 查询"
msgid "Use DNS2SOCKS query and cache"
msgstr "使用 DNS2SOCKS 查询并缓存"
msgid "Use MosDNS query (Not Support Oversea Mode)"
msgstr "使用 MosDNS 查询 (不支持海外用户回国模式)"
msgid "Use MOSDNS query (Not Support Oversea Mode)"
msgstr "使用 MOSDNS 查询 (不支持海外用户回国模式)"
msgid "Disable IPv6 in MosDNS query mode (only for Non-CN domain)"
msgstr "禁止 MosDNS 返回 IPv6 记录 (仅限非大陆域名)"
msgid "Disable IPv6 in MOSDNS query mode"
msgstr "禁止 MOSDNS 返回 IPv6 记录"
msgid "DNS Query Mode For Shunt Mode"
msgstr "分流模式下的 DNS 查询模式"
@ -551,23 +543,14 @@ msgstr "分流模式下的 DNS 查询模式"
msgid "Anti-pollution DNS Server For Shunt Mode"
msgstr "分流模式下的访问国外域名 DNS 服务器"
msgid "Use MosDNS query"
msgstr "使用 MosDNS 查询"
msgid "Use MOSDNS query"
msgstr "使用 MOSDNS 查询"
msgid "Custom DNS Server for MosDNS"
msgstr "MosDNS 自定义 DNS 服务器"
msgid "Custom DNS Server for mosdns"
msgstr "MOSDNS 自定义 DNS 服务器"
msgid "Domestic DNS Server (ChinaDNS Mode With MosDNS)"
msgstr "国内 DNS 服务器 (MosDNS 下的 ChinaDNS 模式)"
msgid "Disable IPv6 In MosDNS Query Mode (Shunt Mode)"
msgstr "禁止 MosDNS 返回 IPv6 记录 (分流模式)"
msgid "Prevent DNS leak (Only Work With ChinaDNS Mode)"
msgstr "防止DNS泄漏 (仅适用于ChinaDNS模式)"
msgid "Disable ChinaDNS in MosDNS"
msgstr "禁用 MosDNS 下的 ChinaDNS 模式"
msgid "Disable IPv6 In MOSDNS Query Mode (Shunt Mode)"
msgstr "禁止 MOSDNS 返回 IPv6 记录 (分流模式)"
msgid "DNS Server IP:Port"
msgstr "DNS 服务器 IP:Port"

View File

@ -38,7 +38,6 @@ tmp_shunt_port="303" #shunt temporary port
tmp_shunt_local_port="304" #shunt socks temporary port
tmp_shunt_dns_port="305" #shunt dns2socks temporary port
tmp_tcp_local_port="306" #tcp socks temporary port
mosdns_config_file=
server_count=0
redir_tcp=0
@ -99,12 +98,6 @@ get_host_ip() {
echo $ip
}
jq_ssr() {
temp_file="$(echo "$2" | awk -F '.' '{print $1"-temp."$2}')"
cat $2 | jq "$1" > "$temp_file"
mv "$temp_file" "$2"
}
clean_log() {
local logsnum=$(cat $LOG_FILE 2>/dev/null | wc -l)
[ "$logsnum" -gt 1000 ] && {
@ -213,79 +206,24 @@ start_dns() {
pdnsd_enable_flag=2
;;
3)
local mosdns_disable_ipv6="$(uci_get_by_type global mosdns_disable_ipv6)"
local mosdns_ipv6="$(uci_get_by_type global mosdns_ipv6)"
local mosdns_dnsserver="$(uci_get_by_type global tunnel_forward_mosdns)"
local chinadns_mosdns="$(uci_get_by_type global chinadns_forward_mosdns)"
local mosdns_dnsleak="$(uci_get_by_type global mosdns_dnsleak)"
local netflix_enable="$(uci_get_by_type global netflix_enable)"
if [ "$run_mode" = "router" ] && [ -n "$chinadns_mosdns" ]; then
mosdns_config_file="$TMP_PATH/mosdns-config-chinadns.json"
cp /etc/ssrplus/mosdns-config-chinadns.json $mosdns_config_file
tmp=$(for i in $(echo $mosdns_dnsserver | sed "s/,/ /g"); do
dnsserver=${i%:*}
dnsserver=${i##*/}
add_dns_into_ipset $run_mode $dnsserver
jq_ssr '.plugins[4].args.upstreams += [{"addr":"'"${i}"'","enable_pipeline":"true"}]' $mosdns_config_file
done)
output=$(for i in $(echo $mosdns_dnsserver | sed "s/,/ /g"); do
dnsserver=${i%:*}
dnsserver=${i##*/}
add_dns_into_ipset $run_mode $dnsserver
echo " - addr: $i"
echo " enable_pipeline: true"
done)
if [ "$chinadns_mosdns" = "wan" ]; then
wandns=$(ifstatus wan | jsonfilter -e '@["dns-server"]' | sed 's/\[//g; s/\]//g' | sed 's/"//g' | sed 's/ //g' | sed 's/,/ /g')
tmp=$(for i in $(echo $wandns); do
i="udp://$i:53"
jq_ssr '.plugins[5].args.upstreams += [{"addr":"'"${i}"'"}]' $mosdns_config_file
done)
else
tmp=$(for i in $(echo $chinadns_mosdns | sed "s/,/ /g"); do
jq_ssr '.plugins[5].args.upstreams += [{"addr":"'"${i}"'"}]' $mosdns_config_file
done)
fi
if [ "$mosdns_disable_ipv6" == "0" ]; then
jq_ssr '.plugins[10].args[0].exec="$remote_sequence_with_IPv6" | .plugins[12].args[0].exec="$remote_sequence_with_IPv6"' $mosdns_config_file
else
jq_ssr '.plugins[10].args[0].exec="$remote_sequence_disable_IPv6" | .plugins[12].args[0].exec="$remote_sequence_disable_IPv6"' $mosdns_config_file
fi
if [ "$mosdns_dnsleak" != "0" ]; then
jq_ssr '.plugins[13].args.primary="query_is_remote_ip"' $mosdns_config_file
fi
jq_ssr '.plugins[16].args.listen="0.0.0.0:'${dns_port}'" | .plugins[17].args.listen="0.0.0.0:'${dns_port}'"' $mosdns_config_file
if [ "$netflix_enable" == 1 ]; then
jq_ssr '.plugins |= (.[:4] + [{"tag": "netflix_domain", "type": "domain_set", "args": {"files": ["/etc/ssrplus/netflix.list"]}}] + .[4:])' $mosdns_config_file
jq_ssr '.plugins |= (.[:7] + [{"tag": "forward_netflix", "type": "forward", "args": {"upstreams": [{"addr":"udp://127.0.0.1:'"${tmp_shunt_dns_port}"'"}]}}] + .[7:])' $mosdns_config_file
jq_ssr '.plugins |= (.[:11] + [{"tag": "netflix_sequence", "type": "sequence", "args": [{"exec": "$forward_netflix"}]}] + .[11:])' $mosdns_config_file
jq_ssr '.plugins |= (.[:14] + [{"tag": "query_is_netflix_domain", "type": "sequence", "args": [{"matches": "qname $netflix_domain", "exec": "$netflix_sequence"}, {"exec": "ipset netflix,inet,24"}]}] + .[14:])' $mosdns_config_file
jq_ssr '.plugins[19].args |= (.[:3] + [{"exec": "$query_is_netflix_domain"}, {"exec": "jump has_resp_sequence"}] + .[3:])' $mosdns_config_file
fi
pdnsd_enable_flag=3
ln_start_bin $(first_type mosdns) mosdns start -c $mosdns_config_file
cat <<-EOF >> "$TMP_DNSMASQ_PATH/chinadns_fixed_server.conf"
no-poll
no-resolv
server=127.0.0.1#$dns_port
EOF
awk -v line=14 -v text="$output" 'NR == line+1 {print text} 1' /etc/ssrplus/mosdns-config.yaml | sed "s/DNS_PORT/$dns_port/g" > $TMP_PATH/mosdns-config.yaml
if [ "$mosdns_ipv6" == "0" ]; then
sed -i "s/DNS_MODE/main_sequence_with_IPv6/g" $TMP_PATH/mosdns-config.yaml
else
mosdns_config_file="$TMP_PATH/mosdns-config.json"
cp /etc/ssrplus/mosdns-config.json $mosdns_config_file
tmp=$(for i in $(echo $mosdns_dnsserver | sed "s/,/ /g"); do
dnsserver=${i%:*}
dnsserver=${i##*/}
add_dns_into_ipset $run_mode $dnsserver
jq_ssr '.plugins[1].args.upstreams += [{"addr":"'"${i}"'","enable_pipeline":"true"}]' $mosdns_config_file
done)
if [ "$mosdns_disable_ipv6" == "0" ]; then
jq_ssr '.plugins[4].args.entry="main_sequence_with_IPv6" | .plugins[5].args.entry="main_sequence_with_IPv6"' $mosdns_config_file
else
jq_ssr '.plugins[4].args.entry="main_sequence_disable_IPv6" | .plugins[5].args.entry="main_sequence_disable_IPv6"' $mosdns_config_file
fi
jq_ssr '.plugins[4].args.listen="0.0.0.0:'${dns_port}'" | .plugins[5].args.listen="0.0.0.0:'${dns_port}'"' $mosdns_config_file
pdnsd_enable_flag=3
ln_start_bin $(first_type mosdns) mosdns start -c $mosdns_config_file
sed -i "s/DNS_MODE/main_sequence_disable_IPv6/g" $TMP_PATH/mosdns-config.yaml
fi
ln_start_bin $(first_type mosdns) mosdns start -c $TMP_PATH/mosdns-config.yaml
pdnsd_enable_flag=3
;;
esac
@ -549,21 +487,21 @@ shunt_dns_command() {
ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_port $shunt_dnsserver 127.0.0.1:$tmp_shunt_dns_port -q
;;
2)
local shunt_mosdns_disable_ipv6="$(uci_get_by_type global shunt_mosdns_disable_ipv6)"
local shunt_mosdns_ipv6="$(uci_get_by_type global shunt_mosdns_ipv6)"
local shunt_mosdns_dnsserver="$(uci_get_by_type global shunt_mosdns_dnsserver)"
mosdns_shunt_config_file="$TMP_PATH/mosdns-config-shunt.json"
cp /etc/ssrplus/mosdns-config.json $mosdns_shunt_config_file
tmp=$(for i in $(echo $shunt_mosdns_dnsserver | sed "s/,/ /g"); do
jq_ssr '.plugins[1].args.upstreams += [{"addr":"'"${i}"'","socks5":"127.0.0.1:'"${tmp_port}"'","enable_pipeline":"true"}]' $mosdns_shunt_config_file
output=$(for i in $(echo $shunt_mosdns_dnsserver | sed "s/,/ /g"); do
echo " - addr: $i"
echo " socks5: \"127.0.0.1:$tmp_port\""
echo " enable_pipeline: true"
done)
awk -v line=14 -v text="$output" 'NR == line+1 {print text} 1' /etc/ssrplus/mosdns-config.yaml | sed "s/DNS_PORT/$tmp_shunt_dns_port/g" > $TMP_PATH/mosdns-config-shunt.yaml
if [ "$shunt_mosdns_disable_ipv6" == "0" ]; then
jq_ssr '.plugins[4].args.entry="main_sequence_with_IPv6" | .plugins[5].args.entry="main_sequence_with_IPv6"' $mosdns_shunt_config_file
if [ "$shunt_mosdns_ipv6" == "0" ]; then
sed -i "s/DNS_MODE/main_sequence_with_IPv6/g" $TMP_PATH/mosdns-config-shunt.yaml
else
jq_ssr '.plugins[4].args.entry="main_sequence_disable_IPv6" | .plugins[5].args.entry="main_sequence_disable_IPv6"' $mosdns_shunt_config_file
sed -i "s/DNS_MODE/main_sequence_disable_IPv6/g" $TMP_PATH/mosdns-config-shunt.yaml
fi
jq_ssr '.plugins[4].args.listen="0.0.0.0:'${tmp_shunt_dns_port}'" | .plugins[5].args.listen="0.0.0.0:'${tmp_shunt_dns_port}'"' $mosdns_shunt_config_file
ln_start_bin $(first_type mosdns) mosdns start -c $mosdns_shunt_config_file
ln_start_bin $(first_type mosdns) mosdns start -c $TMP_PATH/mosdns-config-shunt.yaml
;;
esac
}

View File

@ -1,202 +0,0 @@
{
"log": {
"level": "info"
},
"plugins": [
{
"tag": "lazy_cache",
"type": "cache",
"args": {
"size": 20000,
"lazy_cache_ttl": 86400
}
},
{
"tag": "geosite_cn",
"type": "domain_set",
"args": {
"files": [
"/etc/ssrplus/mosdns-chinadns/geosite_cn.txt",
"/etc/ssrplus/white.list"
]
}
},
{
"tag": "geoip_cn",
"type": "ip_set",
"args": {
"files": [
"/etc/ssrplus/china_ssr.txt"
]
}
},
{
"tag": "geosite_not_cn",
"type": "domain_set",
"args": {
"files": [
"/etc/ssrplus/mosdns-chinadns/geosite_geolocation_not_cn.txt",
"/etc/ssrplus/black.list"
]
}
},
{
"tag": "forward_remote",
"type": "forward",
"args": {
"concurrent": 2,
"upstreams": null
}
},
{
"tag": "forward_local",
"type": "forward",
"args": {
"concurrent": 2,
"upstreams": null
}
},
{
"tag": "local_sequence",
"type": "sequence",
"args": [
{
"exec": "$forward_local"
}
]
},
{
"tag": "remote_sequence_with_IPv6",
"type": "sequence",
"args": [
{
"exec": "$forward_remote"
}
]
},
{
"tag": "remote_sequence_disable_IPv6",
"type": "sequence",
"args": [
{
"exec": "prefer_ipv4"
},
{
"exec": "$forward_remote"
},
{
"matches": [
"qtype 28 65"
],
"exec": "reject 0"
}
]
},
{
"tag": "query_is_local_domain",
"type": "sequence",
"args": [
{
"matches": "qname $geosite_cn",
"exec": "$local_sequence"
}
]
},
{
"tag": "query_is_proxy_domain",
"type": "sequence",
"args": [
{
"matches": "qname $geosite_not_cn"
},
{
"exec": "ipset blacklist,inet,24"
}
]
},
{
"tag": "query_is_local_ip",
"type": "sequence",
"args": [
{
"exec": "$local_sequence"
},
{
"matches": "!resp_ip $geoip_cn",
"exec": "drop_resp"
}
]
},
{
"tag": "query_is_remote_ip",
"type": "sequence",
"args": [
{
"exec": "$remote_sequence_disable_IPv6"
},
{
"exec": "ipset blacklist,inet,24"
}
]
},
{
"tag": "fallback",
"type": "fallback",
"args": {
"primary": "query_is_local_ip",
"secondary": "query_is_remote_ip",
"threshold": 600,
"always_standby": true
}
},
{
"tag": "has_resp_sequence",
"type": "sequence",
"args": [
{
"matches": "has_resp",
"exec": "accept"
}
]
},
{
"tag": "main_sequence",
"type": "sequence",
"args": [
{
"exec": "$lazy_cache"
},
{
"exec": "$query_is_local_domain"
},
{
"exec": "jump has_resp_sequence"
},
{
"exec": "$query_is_proxy_domain"
},
{
"exec": "jump has_resp_sequence"
},
{
"exec": "$fallback"
}
]
},
{
"tag": "udp_server",
"type": "udp_server",
"args": {
"entry": "main_sequence"
}
},
{
"tag": "tcp_server",
"type": "tcp_server",
"args": {
"entry": "main_sequence"
}
}
]
}

View File

@ -1,71 +0,0 @@
{
"log": {
"level": "info"
},
"plugins": [
{
"tag": "lazy_cache",
"type": "cache",
"args": {
"size": 8000,
"lazy_cache_ttl": 86400
}
},
{
"tag": "forward_google",
"type": "forward",
"args": {
"concurrent": 2,
"upstreams": null
}
},
{
"tag": "main_sequence_disable_IPv6",
"type": "sequence",
"args": [
{
"exec": "$lazy_cache"
},
{
"exec": "prefer_ipv4"
},
{
"exec": "$forward_google"
},
{
"matches": [
"qtype 28 65"
],
"exec": "reject 0"
}
]
},
{
"tag": "main_sequence_with_IPv6",
"type": "sequence",
"args": [
{
"exec": "$lazy_cache"
},
{
"exec": "$forward_google"
}
]
},
{
"tag": "udp_server",
"type": "udp_server",
"args": {
"entry": "DNS_MODE"
}
},
{
"tag": "tcp_server",
"type": "tcp_server",
"args": {
"entry": "DNS_MODE"
}
}
]
}

View File

@ -0,0 +1,43 @@
log:
level: info
plugins:
- tag: lazy_cache
type: cache
args:
size: 8000
lazy_cache_ttl: 86400
- tag: forward_google
type: forward
args:
concurrent: 2
upstreams:
- tag: main_sequence_disable_IPv6
type: sequence
args:
- exec: $lazy_cache
- exec: prefer_ipv4
- exec: $forward_google
- matches:
- qtype 28 65
exec: reject 0
- tag: main_sequence_with_IPv6
type: sequence
args:
- exec: $lazy_cache
- exec: $forward_google
- tag: udp_server
type: udp_server
args:
entry: DNS_MODE
listen: 0.0.0.0:DNS_PORT
- tag: tcp_server
type: tcp_server
args:
entry: DNS_MODE
listen: 0.0.0.0:DNS_PORT

View File

@ -111,8 +111,8 @@ while [ "1" == "1" ]; do #死循环
logger -t "$NAME" "mosdns tunnel error.restart!"
echolog "mosdns tunnel error.restart!"
dnsserver=$(uci_get_by_type global tunnel_forward 8.8.4.4:53)
kill -9 $(busybox ps -w | grep $TMP_BIN_PATH/mosdns | grep -v grep | grep $mosdns_config_file | awk '{print $1}') >/dev/null 2>&1
ln_start_bin $(first_type mosdns) mosdns start -c $mosdns_config_file
kill -9 $(busybox ps -w | grep $TMP_BIN_PATH/mosdns | grep -v grep | awk '{print $1}') >/dev/null 2>&1
ln_start_bin $(first_type mosdns) mosdns start -c /etc/mosdns/config.yaml
fi
fi
#chinadns-ng

View File

@ -1,44 +0,0 @@
#!/bin/sh
rm -rf /tmp/geo*
#wget --no-check-certificate -q -O /tmp/geoip.dat https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat
wget --no-check-certificate -q -O /tmp/geosite.dat https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat
remove_full_string() {
temp_file="$(echo "$1" | awk -F '.' '{print $1"-temp."$2}')"
temp_file2="$(echo "$1" | awk -F '.' '{print $1"-temp2."$2}')"
cat $1 | grep 'full:' | awk -F 'full:' '{print $2}' > $temp_file
cat $1 | grep -v 'full:' > $temp_file2
cat $temp_file $temp_file2 | sort -u | uniq -u > $1
rm -rf $temp_file $temp_file2
}
clean_up() {
temp_file="$(echo "$1" | awk -F '.' '{print $1"-temp."$2}')"
diff $1 $2 | grep '< ' | awk -F '< ' '{print $2}' > $temp_file
mv $temp_file $1
}
merge_file() {
temp_file="/tmp/merged"
cat $1 $2 | sort -u | uniq -u > $temp_file
mv $temp_file $2
}
if [ -f "/tmp/geosite.dat" ]; then
#v2dat unpack geosite -o /tmp/ -f cn -f apple-cn -f google-cn -f geolocation-!cn /tmp/geosite.dat
v2dat unpack geosite -o /tmp/ -f cn -f google-cn -f geolocation-!cn /tmp/geosite.dat
remove_full_string /tmp/geosite_cn.txt
#remove_full_string /tmp/geosite_apple-cn.txt
remove_full_string /tmp/geosite_google-cn.txt
remove_full_string /tmp/geosite_geolocation-!cn.txt
clean_up /tmp/geosite_cn.txt /tmp/geosite_google-cn.txt
merge_file /tmp/geosite_google-cn.txt /tmp/geosite_geolocation-!cn.txt
mv /tmp/geosite_cn.txt /etc/ssrplus/mosdns-chinadns/geosite_cn.txt
mv /tmp/geosite_geolocation-!cn.txt /etc/ssrplus/mosdns-chinadns/geosite_geolocation_not_cn.txt
rm -rf /tmp/geosite*
echo 111
else
echo 000
fi

View File

@ -184,16 +184,6 @@ if args then
update(uci:get_first("shadowsocksr", "global", "nfip_url"), "/etc/ssrplus/netflixip.list", args)
os.exit(0)
end
if args == "geo_data" then
string = luci.sys.exec("/usr/share/shadowsocksr/geodata_update.sh")
if string.find(string, "111") then
icount = luci.sys.exec("cat /etc/ssrplus/mosdns-chinadns/geosite* | wc -l")
log(0, tonumber(icount))
else
log(-1)
end
os.exit(0)
end
else
log("正在更新【GFW列表】数据库")
update(uci:get_first("shadowsocksr", "global", "gfwlist_url"), "/etc/ssrplus/gfw_list.conf", "gfw_data", TMP_DNSMASQ_PATH .. "/gfw_list.conf")

View File

@ -1,46 +0,0 @@
#
# Copyright (C) 2015-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=v2dat
PKG_SOURCE_DATE:=2022-12-15
PKG_SOURCE_VERSION:=47b8ee51fb528e11e1a83453b7e767a18d20d1f7
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/urlesistiana/v2dat/tar.gz/$(PKG_SOURCE_VERSION)?
PKG_HASH:=dca45a31006aca3dba5f543f6990ca755ffb2bde8e533cc2bbe6bac9ec12f157
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILE:=LICENSE
PKG_MAINTAINER:=sbwml <admin@cooluc.com>
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
GO_PKG:=github.com/urlesistiana/v2dat
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/v2dat
SECTION:=utils
CATEGORY:=Utilities
TITLE:=V2ray geo/ip data unpack tools
URL:=https://github.com/urlesistiana/v2dat
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
GO_PKG_TARGET_VARS:=$(filter-out CGO_ENABLED=%,$(GO_PKG_TARGET_VARS)) CGO_ENABLED=0
define Package/v2dat/install
$(call GoPackage/Package/Install/Bin,$(1))
endef
$(eval $(call GoBinPackage,v2dat))
$(eval $(call BuildPackage,v2dat))

View File

@ -1,47 +0,0 @@
From 7c6a252ab3f7d9aeb743f9fa8d0cc8c7402f984d Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Wed, 20 Sep 2023 20:52:27 +0800
Subject: [PATCH] format logtime
---
mlog/logger.go | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/mlog/logger.go b/mlog/logger.go
index c8b08a9..b44c88d 100644
--- a/mlog/logger.go
+++ b/mlog/logger.go
@@ -1,17 +1,28 @@
package mlog
-import "go.uber.org/zap"
+import (
+ "time"
+
+ "go.uber.org/zap"
+ "go.uber.org/zap/zapcore"
+)
var logger = mustInitLogger()
func mustInitLogger() *zap.Logger {
- l, err := zap.NewDevelopment(zap.WithCaller(false))
+ config := zap.NewDevelopmentConfig()
+ config.EncoderConfig.EncodeTime = customTimeEncoder
+ l, err := config.Build(zap.WithCaller(false))
if err != nil {
panic("failed to init mlog:" + err.Error())
}
return l
}
+func customTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) {
+ enc.AppendString(t.Format("2006-01-02 15:04:05"))
+}
+
func L() *zap.Logger {
return logger
}
--
2.34.8