Merge Mainline

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2021-03-14 23:47:44 +08:00
commit 6c186eafb0
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
60 changed files with 8101 additions and 7959 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.42.02 PKG_VERSION:=0.42.03
PKG_RELEASE:=beta PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash> PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

View File

@ -204,7 +204,7 @@ uci:commit("openclash")
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "config")) HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "config"))
end end
btndl = tb:option(Button,"download",translate("Download Configurations")) btndl = tb:option(Button,"download",translate("Download Config"))
btndl.template="openclash/other_button" btndl.template="openclash/other_button"
btndl.render=function(e,t,a) btndl.render=function(e,t,a)
e.inputstyle="remove" e.inputstyle="remove"
@ -237,6 +237,44 @@ btndl.write = function (a,t)
HTTP.close() HTTP.close()
end end
btndlr = tb:option(Button,"download_run",translate("Download Running Config"))
btndlr.template="openclash/other_button"
btndlr.render=function(c,t,a)
if string.sub(SYS.exec("uci get openclash.config.config_path 2>/dev/null"), 23, -2) == e[t].name then
a.display=""
else
a.display="none"
end
c.inputstyle="remove"
Button.render(c,t,a)
end
btndlr.write = function (a,t)
local sPath, sFile, fd, block
sPath = "/etc/openclash/"..e[t].name
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('tar -C "%s" -cz .' % {sPath}, "r")
sFile = sFile .. ".tar.gz"
else
fd = nixio.open(sPath, "r")
end
if not fd then
return
end
HTTP.header('Content-Disposition', 'attachment; filename="%s"' % {sFile})
HTTP.prepare_content("application/octet-stream")
while true do
block = fd:read(nixio.const.buffersize)
if (not block) or (#block ==0) then
break
else
HTTP.write(block)
end
end
fd:close()
HTTP.close()
end
btnrm=tb:option(Button,"remove",translate("Remove")) btnrm=tb:option(Button,"remove",translate("Remove"))
btnrm.render=function(e,t,a) btnrm.render=function(e,t,a)
e.inputstyle="reset" e.inputstyle="reset"

View File

@ -52,11 +52,11 @@ end
o = s:option(ListValue, "type", translate("Group Type")) o = s:option(ListValue, "type", translate("Group Type"))
o.rmempty = true o.rmempty = true
o.description = translate("Choose The Operation Mode") o.description = translate("Choose The Operation Mode")
o:value("select", translate("Select ")) o:value("select", translate("Manual-Select"))
o:value("url-test", translate("URL-Test")) o:value("url-test", translate("URL-Test"))
o:value("fallback", translate("Fallback")) o:value("fallback", translate("Fallback"))
o:value("load-balance", translate("Load-Balance")) o:value("load-balance", translate("Load-Balance"))
o:value("relay", translate("Relay Traffic")) o:value("relay", translate("Relay-Traffic"))
o = s:option(ListValue, "strategy", translate("Strategy Type")) o = s:option(ListValue, "strategy", translate("Strategy Type"))
o.rmempty = true o.rmempty = true

View File

@ -134,6 +134,17 @@ end
o:value("DIRECT") o:value("DIRECT")
o:value("REJECT") o:value("REJECT")
o = s:option(ListValue, "Scholar", translate("Scholar"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
if groupname ~= nil and groupname ~= "" then
o:value(groupname)
end
end
o:value("DIRECT")
o:value("REJECT")
o = s:option(ListValue, "Microsoft", translate("Microsoft")) o = s:option(ListValue, "Microsoft", translate("Microsoft"))
o:depends("rule_name", "lhie1") o:depends("rule_name", "lhie1")
o.rmempty = true o.rmempty = true

View File

@ -40,7 +40,7 @@ nm1=tb1:option(DummyValue,"name",translate("File Name"))
mt1=tb1:option(DummyValue,"mtime",translate("Update Time")) mt1=tb1:option(DummyValue,"mtime",translate("Update Time"))
sz1=tb1:option(DummyValue,"size",translate("Size")) sz1=tb1:option(DummyValue,"size",translate("Size"))
btndl1 = tb1:option(Button,"download1",translate("Download Configurations")) btndl1 = tb1:option(Button,"download1",translate("Download Config"))
btndl1.template="openclash/other_button" btndl1.template="openclash/other_button"
btndl1.render=function(y,x,r) btndl1.render=function(y,x,r)
y.inputstyle="remove" y.inputstyle="remove"

View File

@ -40,7 +40,7 @@ nm2=tb2:option(DummyValue,"name",translate("File Name"))
mt2=tb2:option(DummyValue,"mtime",translate("Update Time")) mt2=tb2:option(DummyValue,"mtime",translate("Update Time"))
sz2=tb2:option(DummyValue,"size",translate("Size")) sz2=tb2:option(DummyValue,"size",translate("Size"))
btndl2 = tb2:option(Button,"download2",translate("Download Configurations")) btndl2 = tb2:option(Button,"download2",translate("Download Config"))
btndl2.template="openclash/other_button" btndl2.template="openclash/other_button"
btndl2.render=function(m,n,h) btndl2.render=function(m,n,h)
m.inputstyle="remove" m.inputstyle="remove"

View File

@ -10,7 +10,8 @@ local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
m = SimpleForm("openclash", translate("Other Rule Providers List")) m = SimpleForm("openclash", translate("Other Rule Providers List"))
m.description=translate("规则项目: Profiles ( https://github.com/DivineEngine/Profiles )<br/>") m.description=translate("规则项目: ConnersHua ( https://github.com/DivineEngine/Profiles ) \
<br/>: lhie1 ( https://github.com/lhie1/Rules )")
m.reset = false m.reset = false
m.submit = false m.submit = false

View File

@ -104,9 +104,12 @@ msgstr "保存配置"
msgid "Apply Configurations" msgid "Apply Configurations"
msgstr "应用配置" msgstr "应用配置"
msgid "Download Configurations" msgid "Download Config"
msgstr "下载配置" msgstr "下载配置"
msgid "Download Running Config"
msgstr "下载运行配置"
msgid "Select Mode" msgid "Select Mode"
msgstr "*运行模式" msgstr "*运行模式"
@ -484,6 +487,9 @@ msgstr "Youtube流量"
msgid "Apple" msgid "Apple"
msgstr "苹果服务流量" msgstr "苹果服务流量"
msgid "Scholar"
msgstr "学术网站流量"
msgid "Microsoft" msgid "Microsoft"
msgstr "微软服务流量" msgstr "微软服务流量"
@ -786,7 +792,7 @@ msgstr "检测频率(秒)"
msgid "Tolerance(ms)" msgid "Tolerance(ms)"
msgstr "节点切换容忍值(毫秒)" msgstr "节点切换容忍值(毫秒)"
msgid "Select " msgid "Manual-Select"
msgstr "Select【手动选择】" msgstr "Select【手动选择】"
msgid "URL-Test" msgid "URL-Test"
@ -798,7 +804,7 @@ msgstr "Fallback【故障切换】"
msgid "Load-Balance" msgid "Load-Balance"
msgstr "Load-Balance【负载均衡】" msgstr "Load-Balance【负载均衡】"
msgid "Relay Traffic" msgid "Relay-Traffic"
msgstr "Relay【嵌套中转】" msgstr "Relay【嵌套中转】"
msgid "Other Group" msgid "Other Group"
@ -874,7 +880,7 @@ msgid "Exclude Keyword Match"
msgstr "排除节点" msgstr "排除节点"
msgid "(eg: hk or tw&bgp)" msgid "(eg: hk or tw&bgp)"
msgstr "(格式示例:香港、台湾&bgp" msgstr "(格式示例:香港 或 台湾&bgp 或 新加坡&bgp&奈飞"
msgid "Config File List" msgid "Config File List"
msgstr "配置文件列表" msgstr "配置文件列表"

View File

@ -55,13 +55,13 @@ config dns_servers
option group 'nameserver' option group 'nameserver'
option type 'udp' option type 'udp'
option ip '119.28.28.28' option ip '119.28.28.28'
option enabled '1' option enabled '0'
config dns_servers config dns_servers
option group 'nameserver' option group 'nameserver'
option type 'udp' option type 'udp'
option ip '223.5.5.5' option ip '223.5.5.5'
option enabled '1' option enabled '0'
config dns_servers config dns_servers
option type 'https' option type 'https'
@ -76,7 +76,7 @@ config dns_servers
option type 'https' option type 'https'
config dns_servers config dns_servers
option enabled '1' option enabled '0'
option group 'fallback' option group 'fallback'
option ip 'dns.google' option ip 'dns.google'
option port '853' option port '853'
@ -89,7 +89,7 @@ config dns_servers
option ip '1.1.1.1/dns-query' option ip '1.1.1.1/dns-query'
config dns_servers config dns_servers
option enabled '1' option enabled '0'
option group 'fallback' option group 'fallback'
option ip '1.1.1.1' option ip '1.1.1.1'
option port '853' option port '853'

View File

@ -86,3 +86,4 @@ stun.*.*.*
heartbeat.belkin.com heartbeat.belkin.com
*.linksys.com *.linksys.com
*.linksyssmartwifi.com *.linksyssmartwifi.com
+.battlenet.com.cn

View File

@ -32,4 +32,15 @@
##- SRC-IP-CIDR,192.168.1.1/32,DIRECT ##- SRC-IP-CIDR,192.168.1.1/32,DIRECT
##- SRC-IP-CIDR,198.18.0.1/32,DIRECT ##- SRC-IP-CIDR,198.18.0.1/32,DIRECT
##DDNS
##-DOMAIN-SUFFIX,checkip.dyndns.org,DIRECT
##-DOMAIN-SUFFIX,checkipv6.dyndns.org,DIRECT
##-DOMAIN-SUFFIX,checkip.synology.com,DIRECT
##-DOMAIN-SUFFIX,ifconfig.co,DIRECT
##-DOMAIN-SUFFIX,api.myip.com,DIRECT
##-DOMAIN-SUFFIX,ip-api.com,DIRECT
##-DOMAIN-SUFFIX,ipapi.co,DIRECT
##-DOMAIN-SUFFIX,ip6.seeip.org,DIRECT
##-DOMAIN-SUFFIX,members.3322.org,DIRECT
##在线IP段转CIDR地址http://ip2cidr.com ##在线IP段转CIDR地址http://ip2cidr.com

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,9 +10,9 @@
content="Clash web port" content="Clash web port"
/> />
<title>Clash</title> <title>Clash</title>
<script type="module" crossorigin src="./assets/index.236bee55.js"></script> <script type="module" crossorigin src="./assets/index.0bf7b2ad.js"></script>
<link rel="modulepreload" href="./assets/vendor.b176d855.js"> <link rel="modulepreload" href="./assets/vendor.b176d855.js">
<link rel="stylesheet" href="./assets/index.5dfcf857.css"> <link rel="stylesheet" href="./assets/index.0e294c2a.css">
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>

View File

@ -1,10 +1,16 @@
#!/bin/bash #!/bin/bash
. /lib/functions.sh . /lib/functions.sh
. /usr/share/openclash/openclash_ps.sh
. /usr/share/openclash/ruby.sh . /usr/share/openclash/ruby.sh
status=$(unify_ps_status "openclash.sh") set_lock() {
[ "$status" -gt 3 ] && exit 0 exec 889>"/tmp/lock/openclash_subs.lock" 2>/dev/null
flock -x 889 2>/dev/null
}
del_lock() {
flock -u 889 2>/dev/null
rm -rf "/tmp/lock/openclash_subs.lock"
}
START_LOG="/tmp/openclash_start.log" START_LOG="/tmp/openclash_start.log"
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S") LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
@ -18,6 +24,7 @@ enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null) disable_masq_cache=$(uci get openclash.config.disable_masq_cache 2>/dev/null)
if_restart=0 if_restart=0
only_download=0 only_download=0
set_lock
urlencode() { urlencode() {
local data local data
@ -391,3 +398,4 @@ else
[ "$(uci get openclash.config.auto_update 2>/dev/null)" -eq 1 ] && [ "$(uci get openclash.config.config_auto_update_mode 2>/dev/null)" -ne 1 ] && echo "0 $(uci get openclash.config.auto_update_time 2>/dev/null) * * $(uci get openclash.config.config_update_week_time 2>/dev/null) /usr/share/openclash/openclash.sh" >> $CRON_FILE [ "$(uci get openclash.config.auto_update 2>/dev/null)" -eq 1 ] && [ "$(uci get openclash.config.config_auto_update_mode 2>/dev/null)" -ne 1 ] && echo "0 $(uci get openclash.config.auto_update_time 2>/dev/null) * * $(uci get openclash.config.config_update_week_time 2>/dev/null) /usr/share/openclash/openclash.sh" >> $CRON_FILE
/etc/init.d/cron restart /etc/init.d/cron restart
fi fi
del_lock

View File

@ -30,10 +30,10 @@ if [ -n "$(pidof clash)" ] && [ -f "$CONFIG_FILE" ]; then
cmp -s "$HISTORY_TMP" "$HISTORY_PATH" cmp -s "$HISTORY_TMP" "$HISTORY_PATH"
if [ "$?" -ne "0" ] && [ -s "$HISTORY_TMP" ]; then if [ "$?" -ne "0" ] && [ -s "$HISTORY_TMP" ]; then
mv "$HISTORY_TMP" "$HISTORY_PATH" 2>/dev/null mv "$HISTORY_TMP" "$HISTORY_PATH" 2>/dev/null
echo "${LOGTIME} History:【${CONFIG_NAME}】 Update Successful" >> $LOG_FILE echo "${LOGTIME} Groups History:【${CONFIG_NAME}】 Update Successful" >> $LOG_FILE
fi fi
else else
echo "${LOGTIME} History:【${CONFIG_NAME}】 Update Faild" >> $LOG_FILE echo "${LOGTIME} Groups History:【${CONFIG_NAME}】 Update Faild" >> $LOG_FILE
fi fi
fi fi
rm -rf /tmp/openclash_history_* 2>/dev/null rm -rf /tmp/openclash_history_* 2>/dev/null

View File

@ -64,7 +64,7 @@ if [ -s "$HISTORY_PATH" ] && [ ! -z "$(pidof clash)" ]; then
fi fi
done >/dev/null 2>&1 done >/dev/null 2>&1
close_all_conection close_all_conection
echo "${LOGTIME} History:【${CONFIG_NAME}】 Restore Successful" >> $LOG_FILE echo "${LOGTIME} Groups History:【${CONFIG_NAME}】 Restore Successful" >> $LOG_FILE
else else
echo "${LOGTIME} History:【${CONFIG_NAME}】 Restore Faild" >> $LOG_FILE echo "${LOGTIME} Groups History:【${CONFIG_NAME}】 Restore Faild" >> $LOG_FILE
fi fi

View File

@ -65,17 +65,20 @@
echo "Ruby依赖异常无法校验配置文件请确认ruby依赖工作正常后重试" > $START_LOG echo "Ruby依赖异常无法校验配置文件请确认ruby依赖工作正常后重试" > $START_LOG
rm -rf /tmp/rules.yaml >/dev/null 2>&1 rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3 sleep 3
echo "" >$START_LOG
exit 0 exit 0
elif [ ! -f "/tmp/rules.yaml" ]; then elif [ ! -f "/tmp/rules.yaml" ]; then
echo "错误:$rule_name 规则文件格式校验失败,请稍后再试..." > $START_LOG echo "错误:$rule_name 规则文件格式校验失败,请稍后再试..." > $START_LOG
rm -rf /tmp/rules.yaml >/dev/null 2>&1 rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3 sleep 3
echo "" >$START_LOG
exit 0 exit 0
elif ! "$(ruby_read "/tmp/rules.yaml" ".key?('rules')")" ; then elif ! "$(ruby_read "/tmp/rules.yaml" ".key?('rules')")" ; then
echo "${LOGTIME} Error: Updated Others Rules 【$rule_name】 Has No Rules Field, Update Exit..." >> $LOG_FILE echo "${LOGTIME} Error: Updated Others Rules 【$rule_name】 Has No Rules Field, Update Exit..." >> $LOG_FILE
echo "错误:$rule_name 规则文件规则部分校验失败,请稍后再试..." > $START_LOG echo "错误:$rule_name 规则文件规则部分校验失败,请稍后再试..." > $START_LOG
rm -rf /tmp/rules.yaml >/dev/null 2>&1 rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3 sleep 3
echo "" >$START_LOG
exit 0 exit 0
#校验是否含有新策略组 #校验是否含有新策略组
elif ! "$(ruby -ryaml -E UTF-8 -e " elif ! "$(ruby -ryaml -E UTF-8 -e "
@ -89,6 +92,7 @@
echo "错误:$rule_name 规则文件含有未支持的新策略组更新停止请等待OpenClash版本更新适配..." > $START_LOG echo "错误:$rule_name 规则文件含有未支持的新策略组更新停止请等待OpenClash版本更新适配..." > $START_LOG
rm -rf /tmp/rules.yaml >/dev/null 2>&1 rm -rf /tmp/rules.yaml >/dev/null 2>&1
sleep 3 sleep 3
echo "" >$START_LOG
exit 0 exit 0
fi fi

View File

@ -45,6 +45,7 @@ rules:
- RULE-SET,Microsoft,Microsoft - RULE-SET,Microsoft,Microsoft
- RULE-SET,PROXY,Proxy - RULE-SET,PROXY,Proxy
- RULE-SET,Apple,Apple - RULE-SET,Apple,Apple
- RULE-SET,Scholar,Scholar
- RULE-SET,Domestic,Domestic - RULE-SET,Domestic,Domestic
- RULE-SET,Domestic IPs,Domestic - RULE-SET,Domestic IPs,Domestic
- RULE-SET,LAN,DIRECT - RULE-SET,LAN,DIRECT
@ -100,6 +101,7 @@ script:
"Microsoft": "Microsoft", "Microsoft": "Microsoft",
"PROXY": "Proxy", "PROXY": "Proxy",
"Apple": "Apple", "Apple": "Apple",
"Scholar": "Scholar",
"Domestic": "Domestic", "Domestic": "Domestic",
"Domestic IPs": "Domestic", "Domestic IPs": "Domestic",
"LAN": "DIRECT" "LAN": "DIRECT"
@ -407,6 +409,12 @@ rule-providers:
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Apple.yaml url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Apple.yaml
path: "./Rules/Apple" path: "./Rules/Apple"
interval: 86400 interval: 86400
Scholar:
type: http
behavior: classical
url: https://cdn.jsdelivr.net/gh/lhie1/Rules@master/Clash/Provider/Scholar.yaml
path: "./Rules/Scholar"
interval: 86400
Domestic IPs: Domestic IPs:
type: http type: http
behavior: ipcidr behavior: ipcidr

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,17 @@
#!/bin/sh #!/bin/sh
. /lib/functions.sh . /lib/functions.sh
. /usr/share/openclash/openclash_ps.sh
status=$(unify_ps_status "yml_groups_set.sh") set_lock() {
[ "$status" -gt "3" ] && exit 0 exec 887>"/tmp/lock/openclash_groups_set.lock" 2>/dev/null
flock -x 887 2>/dev/null
}
del_lock() {
flock -u 887 2>/dev/null
rm -rf "/tmp/lock/openclash_groups_set.lock"
}
set_lock
START_LOG="/tmp/openclash_start.log" START_LOG="/tmp/openclash_start.log"
GROUP_FILE="/tmp/yaml_groups.yaml" GROUP_FILE="/tmp/yaml_groups.yaml"
CFG_FILE="/etc/config/openclash" CFG_FILE="/etc/config/openclash"
@ -251,6 +258,7 @@ if [ "$create_config" = "0" ] || [ "$servers_if_update" = "1" ] || [ ! -z "$if_g
uci commit openclash uci commit openclash
sleep 5 sleep 5
echo "" >$START_LOG echo "" >$START_LOG
del_lock
exit 0 exit 0
else else
if [ -z "$if_game_group" ]; then if [ -z "$if_game_group" ]; then
@ -268,4 +276,5 @@ if [ "$create_config" = "0" ] || [ "$servers_if_update" = "1" ] || [ ! -z "$if_g
fi fi
if [ -z "$if_game_group" ]; then if [ -z "$if_game_group" ]; then
/usr/share/openclash/yml_proxys_set.sh /usr/share/openclash/yml_proxys_set.sh
fi fi
del_lock

View File

@ -790,16 +790,41 @@ cat >> "$SERVER_FILE" <<-EOF
- Proxy - Proxy
- DIRECT - DIRECT
- Domestic - Domestic
- name: Apple
type: select
proxies:
- DIRECT
- Proxy
- name: Microsoft - name: Microsoft
type: select type: select
proxies: proxies:
- DIRECT - DIRECT
- Proxy - Proxy
EOF
cat >> "$SERVER_FILE" <<-EOF
- name: Apple
type: select
proxies:
- DIRECT
- Proxy
EOF
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
if [ -f "/tmp/Proxy_Provider" ]; then
cat >> "$SERVER_FILE" <<-EOF
use:
EOF
fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Scholar
type: select
proxies:
- Proxy
- DIRECT
EOF
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
if [ -f "/tmp/Proxy_Provider" ]; then
cat >> "$SERVER_FILE" <<-EOF
use:
EOF
fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Netflix - name: Netflix
type: select type: select
proxies: proxies:
@ -959,6 +984,7 @@ ${uci_set}AsianTV="AsianTV"
${uci_set}Proxy="Proxy" ${uci_set}Proxy="Proxy"
${uci_set}Youtube="Youtube" ${uci_set}Youtube="Youtube"
${uci_set}Apple="Apple" ${uci_set}Apple="Apple"
${uci_set}Scholar="Scholar"
${uci_set}Microsoft="Microsoft" ${uci_set}Microsoft="Microsoft"
${uci_set}Netflix="Netflix" ${uci_set}Netflix="Netflix"
${uci_set}Disney="Disney" ${uci_set}Disney="Disney"
@ -979,6 +1005,8 @@ ${uci_set}Others="Others"
${UCI_DEL_LIST}="AsianTV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="AsianTV" >/dev/null 2>&1 ${UCI_DEL_LIST}="AsianTV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="AsianTV" >/dev/null 2>&1
${UCI_DEL_LIST}="GlobalTV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="GlobalTV" >/dev/null 2>&1 ${UCI_DEL_LIST}="GlobalTV" >/dev/null 2>&1 && ${UCI_ADD_LIST}="GlobalTV" >/dev/null 2>&1
${UCI_DEL_LIST}="Netflix" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Netflix" >/dev/null 2>&1 ${UCI_DEL_LIST}="Netflix" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Netflix" >/dev/null 2>&1
${UCI_DEL_LIST}="Apple" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Apple" >/dev/null 2>&1
${UCI_DEL_LIST}="Scholar" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Scholar" >/dev/null 2>&1
${UCI_DEL_LIST}="Disney" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Disney" >/dev/null 2>&1 ${UCI_DEL_LIST}="Disney" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Disney" >/dev/null 2>&1
${UCI_DEL_LIST}="Spotify" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Spotify" >/dev/null 2>&1 ${UCI_DEL_LIST}="Spotify" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Spotify" >/dev/null 2>&1
${UCI_DEL_LIST}="Steam" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Steam" >/dev/null 2>&1 ${UCI_DEL_LIST}="Steam" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Steam" >/dev/null 2>&1

View File

@ -136,6 +136,7 @@ yml_other_rules_get()
config_get "Proxy" "$section" "Proxy" "" config_get "Proxy" "$section" "Proxy" ""
config_get "Youtube" "$section" "Youtube" "" config_get "Youtube" "$section" "Youtube" ""
config_get "Apple" "$section" "Apple" "" config_get "Apple" "$section" "Apple" ""
config_get "Scholar" "$section" "Scholar" ""
config_get "Netflix" "$section" "Netflix" "" config_get "Netflix" "$section" "Netflix" ""
config_get "Disney" "$section" "Disney" "" config_get "Disney" "$section" "Disney" ""
config_get "Spotify" "$section" "Spotify" "" config_get "Spotify" "$section" "Spotify" ""
@ -180,6 +181,7 @@ if [ "$2" != "0" ]; then
|| [ -z "$(grep -F "$Proxy" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Proxy" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Youtube" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Youtube" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Apple" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Apple" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Scholar" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Netflix" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Netflix" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Disney" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Disney" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Spotify" /tmp/Proxy_Group)" ]\ || [ -z "$(grep -F "$Spotify" /tmp/Proxy_Group)" ]\
@ -228,6 +230,7 @@ if [ "$2" != "0" ]; then
.gsub(/,Proxy$/, ',$Proxy#d') .gsub(/,Proxy$/, ',$Proxy#d')
.gsub(/,YouTube$/, ',$Youtube#d') .gsub(/,YouTube$/, ',$Youtube#d')
.gsub(/,Apple$/, ',$Apple#d') .gsub(/,Apple$/, ',$Apple#d')
.gsub(/,Scholar$/, ',$Scholar#d')
.gsub(/,Netflix$/, ',$Netflix#d') .gsub(/,Netflix$/, ',$Netflix#d')
.gsub(/,Disney$/, ',$Disney#d') .gsub(/,Disney$/, ',$Disney#d')
.gsub(/,Spotify$/, ',$Spotify#d') .gsub(/,Spotify$/, ',$Spotify#d')
@ -246,6 +249,7 @@ if [ "$2" != "0" ]; then
.gsub!(/: \"Proxy\"/,': \"$Proxy#d\"') .gsub!(/: \"Proxy\"/,': \"$Proxy#d\"')
.gsub!(/: \"YouTube\"/,': \"$Youtube#d\"') .gsub!(/: \"YouTube\"/,': \"$Youtube#d\"')
.gsub!(/: \"Apple\"/,': \"$Apple#d\"') .gsub!(/: \"Apple\"/,': \"$Apple#d\"')
.gsub!(/: \"Scholar\"/,': \"$Scholar#d\"')
.gsub!(/: \"Netflix\"/,': \"$Netflix#d\"') .gsub!(/: \"Netflix\"/,': \"$Netflix#d\"')
.gsub!(/: \"Disney\"/,': \"$Disney#d\"') .gsub!(/: \"Disney\"/,': \"$Disney#d\"')
.gsub!(/: \"Spotify\"/,': \"$Spotify#d\"') .gsub!(/: \"Spotify\"/,': \"$Spotify#d\"')

View File

@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=shadowsocks-rust PKG_NAME:=shadowsocks-rust
PKG_VERSION:=1.9.2 PKG_VERSION:=1.9.2
PKG_RELEASE:=2 PKG_RELEASE:=1
PKG_SOURCE_HEADER:=shadowsocks-v$(PKG_VERSION) PKG_SOURCE_HEADER:=shadowsocks-v$(PKG_VERSION)
PKG_SOURCE_BODY:=unknown-linux-musl PKG_SOURCE_BODY:=unknown-linux-musl
@ -21,7 +21,7 @@ PKG_SOURCE_URL:=https://github.com/shell-script/openwrt-shadowsocks-rust/release
ifeq ($(ARCH),aarch64) ifeq ($(ARCH),aarch64)
PKG_SOURCE:=$(PKG_SOURCE_HEADER).aarch64-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER) PKG_SOURCE:=$(PKG_SOURCE_HEADER).aarch64-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
PKG_HASH:=8e461614154d0d395f4e704ea170a6dac67401d92fe75e57e59ee33370bf1db6 PKG_HASH:=318e0538386e52025448e7dc1e67b71bd399981e386ba0a54802ff3c13b25016
else ifeq ($(ARCH),arm) else ifeq ($(ARCH),arm)
# Referred to golang/golang-values.mk # Referred to golang/golang-values.mk
ARM_CPU_FEATURES:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE)))) ARM_CPU_FEATURES:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE))))

View File

@ -2,18 +2,18 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=183 PKG_VERSION:=183
PKG_RELEASE:=8 PKG_RELEASE:=9
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Xray CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Xray
@ -27,13 +27,13 @@ LUCI_DEPENDS:=+coreutils +coreutils-base64 +dns2socks +dnsmasq-full +ipset +ip-f
+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \ +PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-local \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-local \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust:shadowsocks-rust-sslocal \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-local \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-local \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-redir \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-ssr-server \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-ssr-server \
+PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs:simple-obfs \ +PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs:simple-obfs \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \ +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \ +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin:v2ray-plugin \ +PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin:v2ray-plugin \
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core +PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core
@ -52,16 +52,21 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
default n default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks
bool "Include Shadowsocks-libev" bool "Include Shadowsocks Libev"
default y default y
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust
bool "Include Shadowsocks Rust (AEAD cipher only)"
depends on aarch64||arm||i386||mips||mipsel||x86_64
default y if aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR
bool "Include ShadowsocksR-libev" bool "Include ShadowsocksR Libev"
default y default y
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
bool "Include ShadowsocksR Server" bool "Include ShadowsocksR Server"
default y if i386||x86_64||arm||aarch64 default y if aarch64||arm||i386||x86_64
config PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs config PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs
bool "Include Shadowsocks Simple Obfs Plugin" bool "Include Shadowsocks Simple Obfs Plugin"
@ -71,17 +76,13 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan
bool "Include Trojan" bool "Include Trojan"
default y if arm||mipsel default y if arm||mipsel
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
bool "Include V2ray"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin
bool "Include Shadowsocks V2ray Plugin" bool "Include Shadowsocks V2ray Plugin"
default n default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Xray config PACKAGE_$(PKG_NAME)_INCLUDE_Xray
bool "Include Xray" bool "Include Xray"
default y if i386||x86_64||arm||aarch64 default y if aarch64||arm||i386||x86_64
endef endef
define Package/$(PKG_NAME)/conffiles define Package/$(PKG_NAME)/conffiles

View File

@ -149,7 +149,7 @@ end
if is_finded("ssr-redir") then if is_finded("ssr-redir") then
o:value("ssr", translate("ShadowsocksR")) o:value("ssr", translate("ShadowsocksR"))
end end
if is_finded("ss-redir") then if is_finded("sslocal") or is_finded("ss-redir") then
o:value("ss", translate("Shadowsocks New Version")) o:value("ss", translate("Shadowsocks New Version"))
end end
if is_finded("trojan") then if is_finded("trojan") then
@ -256,7 +256,7 @@ o.rmempty = true
o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"}) o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"})
-- Shadowsocks Plugin -- Shadowsocks Plugin
o = s:option(ListValue, "plugin", translate("Obfs")) o = s:option(Value, "plugin", translate("Obfs"))
o:value("none", translate("None")) o:value("none", translate("None"))
if is_finded("obfs-local") then if is_finded("obfs-local") then
o:value("obfs-local", translate("simple-obfs")) o:value("obfs-local", translate("simple-obfs"))

View File

@ -339,7 +339,10 @@ start_udp() {
case "$type" in case "$type" in
ss | ssr) ss | ssr)
gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port
ln_start_bin $(first_type ${type}-redir) ${type}-redir -c $udp_config_file -U ss_program="$(first_type ${type}local ${type}-redir)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
ss_extra_arg="--protocol redir -u" || ss_extra_arg="-U"
ln_start_bin $ss_program ${type}-redir -c $udp_config_file $ss_extra_arg
echolog "UDP TPROXY Relay:$(get_name $type) Started!" echolog "UDP TPROXY Relay:$(get_name $type) Started!"
;; ;;
v2ray) v2ray)
@ -380,12 +383,14 @@ start_shunt() {
case "$type" in case "$type" in
ss | ssr) ss | ssr)
gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port
ln_start_bin $(first_type ${type}-redir) ${type}-redir -c $shunt_config_file ss_program="$(first_type ${type}local ${type}-redir)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && ss_extra_arg="--protocol redir"
ln_start_bin $ss_program ${type}-redir -c $shunt_config_file $ss_extra_arg
if [ -n "$tmp_local_port" ]; then if [ -n "$tmp_local_port" ]; then
local tmp_port=$tmp_local_port local tmp_port=$tmp_local_port
else else
local tmp_port=$tmp_shunt_local_port local tmp_port=$tmp_shunt_local_port
ln_start_bin $(first_type ${type}-local) ${type}-local -c $shunt_dns_config_file ln_start_bin $(first_type ${type}local ${type}-local) ${type}-local -c $shunt_dns_config_file
fi fi
ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_port 8.8.8.8:53 127.0.0.1:$tmp_shunt_dns_port -q ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_port 8.8.8.8:53 127.0.0.1:$tmp_shunt_dns_port -q
echolog "shunt:$(get_name $type) Started!" echolog "shunt:$(get_name $type) Started!"
@ -465,7 +470,10 @@ start_local() {
case "$type" in case "$type" in
ss | ssr) ss | ssr)
gen_config_file $LOCAL_SERVER $type 4 $local_port gen_config_file $LOCAL_SERVER $type 4 $local_port
ln_start_bin $(first_type ${type}-local) ${type}-local -c $local_config_file -u ss_program="$(first_type ${type}local ${type}-local)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
ss_extra_arg="-U" || ss_extra_arg="-u"
ln_start_bin $ss_program ${type}-local -c $local_config_file $ss_extra_arg
echolog "Global_Socks5:$(get_name $type) Started!" echolog "Global_Socks5:$(get_name $type) Started!"
;; ;;
v2ray) v2ray)
@ -525,8 +533,11 @@ Start_Run() {
case "$type" in case "$type" in
ss | ssr) ss | ssr)
gen_config_file $GLOBAL_SERVER $type 1 $tcp_port gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
ss_program="$(first_type ${type}local ${type}-redir)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
{ ss_extra_arg="--protocol redir"; case ${ARG_OTA} in '-u') ARG_OTA='-U';; '-U') ARG_OTA='-u';; esac; }
for i in $(seq 1 $threads); do for i in $(seq 1 $threads); do
ln_start_bin "$(first_type ${type}-redir)" ${type}-redir -c $tcp_config_file $ARG_OTA ln_start_bin "$ss_program" ${type}-redir -c $tcp_config_file $ARG_OTA $ss_extra_arg
done done
echolog "Main node:$(get_name $type) $threads Threads Started!" echolog "Main node:$(get_name $type) $threads Threads Started!"
;; ;;

File diff suppressed because it is too large Load Diff

View File

@ -4,16 +4,16 @@
# This is free software, licensed under the GNU General Public License v3. # This is free software, licensed under the GNU General Public License v3.
# #
# #
# to get the latest version & md5 checksum: # to get the latest version & md5 checksum:
# curl -L -s -k -H "Accept:text/plain" "http://router.uu.163.com/api/plugin?type=openwrt-$(UU_ARCH)" # curl -L -s -k -H "Accept:text/plain" "http://router.uu.163.com/api/plugin?type=openwrt-$(UU_ARCH)"
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=uugamebooster PKG_NAME:=uugamebooster
PKG_VERSION:=v2.7.2 PKG_VERSION:=v2.7.8
PKG_RELEASE:=5 PKG_RELEASE:=6
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -31,27 +31,27 @@ endef
ifeq ($(ARCH),x86_64) ifeq ($(ARCH),x86_64)
UU_ARCH:=x86_64 UU_ARCH:=x86_64
PKG_MD5SUM:=07bf06131528276e7d4b8e3992fa2e8d PKG_MD5SUM:=7964978383c6c1535a8a8799b96498d7
endif endif
ifeq ($(ARCH),mipsel) ifeq ($(ARCH),mipsel)
UU_ARCH:=mipsel UU_ARCH:=mipsel
PKG_MD5SUM:=3f11af92eb7abf2af2cce8102fea7499 PKG_MD5SUM:=e25531db253ae05e13367d98ab862e45
endif endif
ifeq ($(ARCH),mips) ifeq ($(ARCH),mips)
UU_ARCH:=mipsel UU_ARCH:=mipsel
PKG_MD5SUM:=3f11af92eb7abf2af2cce8102fea7499 PKG_MD5SUM:=e25531db253ae05e13367d98ab862e45
endif endif
ifeq ($(ARCH),arm) ifeq ($(ARCH),arm)
UU_ARCH:=arm UU_ARCH:=arm
PKG_MD5SUM:=5fce2b60df66ea8a8db4ddd55da3c6b4 PKG_MD5SUM:=5a308f12a9855841dab6c534453850aa
endif endif
ifeq ($(ARCH),aarch64) ifeq ($(ARCH),aarch64)
UU_ARCH:=aarch64 UU_ARCH:=aarch64
PKG_MD5SUM:=bc0e513cfce113c69b068e198e936100 PKG_MD5SUM:=f7d891a1c9eecb900a1981df47bf365f
endif endif
PKG_SOURCE_URL:=http://uu.gdl.netease.com/openwrt-$(UU_ARCH)/$(PKG_VERSION)/uu.tar.gz? PKG_SOURCE_URL:=http://uu.gdl.netease.com/openwrt-$(UU_ARCH)/$(PKG_VERSION)/uu.tar.gz?

View File

@ -25,7 +25,6 @@ PKG_USE_MIPS16:=0
PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/nls.mk include $(INCLUDE_DIR)/nls.mk
define Package/elfutils/Default define Package/elfutils/Default
@ -99,4 +98,3 @@ endef
$(eval $(call BuildPackage,libelf)) $(eval $(call BuildPackage,libelf))
$(eval $(call BuildPackage,libdw)) $(eval $(call BuildPackage,libdw))
$(eval $(call BuildPackage,libasm)) $(eval $(call BuildPackage,libasm))
$(eval $(call HostBuild))

View File

@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall PKG_NAME:=luci-app-passwall
PKG_VERSION:=4 PKG_VERSION:=4
PKG_RELEASE:=16 PKG_RELEASE:=17
PKG_DATE:=20210303 PKG_DATE:=20210314
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@ -21,6 +21,11 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks
bool "Include Shadowsocks" bool "Include Shadowsocks"
default y default y
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust
bool "Include Shadowsocks Rust (AEAD ciphers only)"
depends on aarch64||arm||i386||mips||mipsel||x86_64
default y if aarch64||x86_64
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server
bool "Include Shadowsocks Server" bool "Include Shadowsocks Server"
default y default y
@ -43,7 +48,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Plus
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_GO config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_GO
bool "Include Trojan_GO" bool "Include Trojan_GO"
default y if i386||x86_64||arm||aarch64 default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Brook config PACKAGE_$(PKG_NAME)_INCLUDE_Brook
bool "Include Brook" bool "Include Brook"
@ -92,6 +97,7 @@ define Package/$(PKG_NAME)
+pdnsd-alt \ +pdnsd-alt \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-local \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-local \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust:shadowsocks-rust-sslocal \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server:shadowsocks-libev-ss-server \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server:shadowsocks-libev-ss-server \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-redir \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-local \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-local \

View File

@ -292,7 +292,7 @@ function delete_select_nodes()
ucic:delete(appname, w) ucic:delete(appname, w)
end) end)
ucic:commit(appname) ucic:commit(appname)
luci.sys.call("/etc/init.d/" .. appname .. " restart") luci.sys.call("/etc/init.d/" .. appname .. " restart > /dev/null 2>&1 &")
end end
function check_port() function check_port()

View File

@ -55,13 +55,14 @@ function get_args(arg, myarg)
end end
function get_valid_nodes() function get_valid_nodes()
local nodes_ping = uci_get_type("global_other", "nodes_ping") or ""
local nodes = {} local nodes = {}
uci:foreach(appname, "nodes", function(e) uci:foreach(appname, "nodes", function(e)
e.id = e[".name"] e.id = e[".name"]
if e.type and e.remarks then if e.type and e.remarks then
if e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt") then if e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt") then
e.remarks_name = "%s[%s] " % {i18n.translatef(e.type .. e.protocol), e.remarks} e["remark"] = "%s[%s] " % {i18n.translatef(e.type .. e.protocol), e.remarks}
e.node_type = "special" e["node_type"] = "special"
nodes[#nodes + 1] = e nodes[#nodes + 1] = e
end end
if e.port and e.address then if e.port and e.address then
@ -81,9 +82,15 @@ function get_valid_nodes()
type2 = type2 .. " " .. protocol type2 = type2 .. " " .. protocol
end end
if datatypes.ip6addr(address) then address2 = "[" .. address .. "]" end if datatypes.ip6addr(address) then address2 = "[" .. address .. "]" end
e.remarks_name = "%s[%s] %s:%s" % {type2, e.remarks, address2, e.port} e["remark"] = "%s[%s]" % {type2, e.remarks}
if nodes_ping:find("info") then
e["remark"] = "%s[%s] %s:%s" % {type2, e.remarks, address2, e.port}
end
if e.use_kcp and e.use_kcp == "1" then if e.use_kcp and e.use_kcp == "1" then
e.remarks_name = "%s+%s[%s] %s" % {type2, "Kcptun", e.remarks, address2} e["remark"] = "%s+%s[%s]" % {type2, "Kcptun", e.remarks}
if nodes_ping:find("info") then
e["remark"] = "%s+%s[%s] %s" % {type2, "Kcptun", e.remarks, address2}
end
end end
e.node_type = "normal" e.node_type = "normal"
nodes[#nodes + 1] = e nodes[#nodes + 1] = e

View File

@ -24,7 +24,7 @@ o.default = "1"
o = s:option(DynamicList, "tcp_node", "TCP " .. translate("List of backup nodes")) o = s:option(DynamicList, "tcp_node", "TCP " .. translate("List of backup nodes"))
for k, v in pairs(nodes_table) do for k, v in pairs(nodes_table) do
if v.node_type == "normal" then if v.node_type == "normal" then
o:value(v.id, v.remarks_name) o:value(v.id, v["remark"])
end end
end end

View File

@ -20,7 +20,7 @@ uci:foreach(appname, "socks", function(s)
else else
for k, n in pairs(nodes_table) do for k, n in pairs(nodes_table) do
if (s.node == n.id) then if (s.node == n.id) then
remarks = n.remarks_name; break remarks = n["remark"]; break
end end
end end
end end
@ -125,7 +125,7 @@ if has_xray and #nodes_table > 0 then
o:value("_direct", translate("Direct Connection")) o:value("_direct", translate("Direct Connection"))
o:value("_blackhole", translate("Blackhole")) o:value("_blackhole", translate("Blackhole"))
for k1, v1 in pairs(normal_list) do for k1, v1 in pairs(normal_list) do
o:value(v1.id, v1.remarks_name) o:value(v1.id, v1["remark"])
end end
o.cfgvalue = function(self, section) o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil" return m:get(v.id, id) or "nil"
@ -141,7 +141,7 @@ if has_xray and #nodes_table > 0 then
o:value("_direct", translate("Direct Connection")) o:value("_direct", translate("Direct Connection"))
o:value("_blackhole", translate("Blackhole")) o:value("_blackhole", translate("Blackhole"))
for k1, v1 in pairs(normal_list) do for k1, v1 in pairs(normal_list) do
o:value(v1.id, v1.remarks_name) o:value(v1.id, v1["remark"])
end end
o.cfgvalue = function(self, section) o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil" return m:get(v.id, id) or "nil"
@ -155,7 +155,7 @@ if has_xray and #nodes_table > 0 then
o:depends("tcp_node", v.id) o:depends("tcp_node", v.id)
o:value("nil", translate("Close")) o:value("nil", translate("Close"))
for k1, v1 in pairs(normal_list) do for k1, v1 in pairs(normal_list) do
o:value(v1.id, v1.remarks_name) o:value(v1.id, v1["remark"])
end end
o.cfgvalue = function(self, section) o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil" return m:get(v.id, id) or "nil"
@ -370,14 +370,14 @@ if has_xray then
end end
for k, v in pairs(nodes_table) do for k, v in pairs(nodes_table) do
tcp_node:value(v.id, v.remarks_name) tcp_node:value(v.id, v["remark"])
udp_node:value(v.id, v.remarks_name) udp_node:value(v.id, v["remark"])
if v.type == "Socks" then if v.type == "Socks" then
if has_xray then if has_xray then
socks_node:value(v.id, v.remarks_name) socks_node:value(v.id, v["remark"])
end end
else else
socks_node:value(v.id, v.remarks_name) socks_node:value(v.id, v["remark"])
end end
end end

View File

@ -9,7 +9,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
nodes_table[#nodes_table + 1] = { nodes_table[#nodes_table + 1] = {
id = e[".name"], id = e[".name"],
obj = e, obj = e,
remarks = e.remarks_name remarks = e["remark"]
} }
end end
end end

View File

@ -72,7 +72,7 @@ type = s:option(ListValue, "type", translate("Type"))
if api.is_finded("ipt2socks") then if api.is_finded("ipt2socks") then
type:value("Socks", translate("Socks")) type:value("Socks", translate("Socks"))
end end
if api.is_finded("ss-redir") then if api.is_finded("sslocal") or api.is_finded("ss-redir") then
type:value("SS", translate("Shadowsocks")) type:value("SS", translate("Shadowsocks"))
end end
if api.is_finded("ssr-redir") then if api.is_finded("ssr-redir") then
@ -116,7 +116,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
if e.node_type == "normal" then if e.node_type == "normal" then
nodes_table[#nodes_table + 1] = { nodes_table[#nodes_table + 1] = {
id = e[".name"], id = e[".name"],
remarks = e.remarks_name remarks = e["remark"]
} }
end end
end end

View File

@ -7,15 +7,15 @@ m = Map(appname)
s = m:section(TypedSection, "global_other") s = m:section(TypedSection, "global_other")
s.anonymous = true s.anonymous = true
o = s:option(MultiValue, "nodes_ping", "Ping") o = s:option(MultiValue, "nodes_ping", " ")
o:value("auto_ping", translate("Auto Ping"), translate("This will automatically ping the node for latency")) o:value("auto_ping", translate("Auto Ping"), translate("This will automatically ping the node for latency"))
o:value("tcping", translate("Tcping"), translate("This will use tcping replace ping detection of node")) o:value("tcping", translate("Tcping"), translate("This will use tcping replace ping detection of node"))
o:value("info", translate("Show server address and port"), translate("Show server address and port"))
-- [[ Add the node via the link ]]-- -- [[ Add the node via the link ]]--
s:append(Template(appname .. "/node_list/link_add_node")) s:append(Template(appname .. "/node_list/link_add_node"))
local nodes_ping = m:get("@global_other[0]", "nodes_ping") or "" local nodes_ping = m:get("@global_other[0]", "nodes_ping") or ""
local nodes_display = m:get("@global_other[0]", "nodes_display") or ""
-- [[ Node List ]]-- -- [[ Node List ]]--
s = m:section(TypedSection, "nodes") s = m:section(TypedSection, "nodes")
@ -38,58 +38,58 @@ end
s.sortable = true s.sortable = true
-- 简洁模式 -- 简洁模式
if true then o = s:option(DummyValue, "add_mode", "")
o = s:option(DummyValue, "add_mode", "") o.cfgvalue = function(t, n)
o.cfgvalue = function(t, n) local v = Value.cfgvalue(t, n)
local v = Value.cfgvalue(t, n) if v and v ~= '' then
if v and v ~= '' then
local group = m:get(n, "group") or ""
if group ~= "" then
v = v .. " " .. group
end
return v
else
return ''
end
end
o = s:option(DummyValue, "remarks", translate("Remarks"))
o.rawhtml = true
o.cfgvalue = function(t, n)
local str = ""
local is_sub = m:get(n, "is_sub") or ""
local group = m:get(n, "group") or "" local group = m:get(n, "group") or ""
local remarks = m:get(n, "remarks") or "" if group ~= "" then
local type = m:get(n, "type") or "" v = v .. " " .. group
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.type' value='%s'/>", appname, n, type)
if type == "Xray" then
local protocol = m:get(n, "protocol")
if protocol == "_balancing" then
protocol = "负载均衡"
elseif protocol == "_shunt" then
protocol = "分流"
elseif protocol == "vmess" then
protocol = "VMess"
elseif protocol == "vless" then
protocol = "VLESS"
else
protocol = protocol:gsub("^%l",string.upper)
end
type = type .. " " .. protocol
end end
local address = m:get(n, "address") or "" return v
local port = m:get(n, "port") or "" else
str = str .. translate(type) .. "" .. remarks return ''
if address ~= "" and port ~= "" then end
end
o = s:option(DummyValue, "remarks", translate("Remarks"))
o.rawhtml = true
o.cfgvalue = function(t, n)
local str = ""
local is_sub = m:get(n, "is_sub") or ""
local group = m:get(n, "group") or ""
local remarks = m:get(n, "remarks") or ""
local type = m:get(n, "type") or ""
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.type' value='%s'/>", appname, n, type)
if type == "Xray" then
local protocol = m:get(n, "protocol")
if protocol == "_balancing" then
protocol = "负载均衡"
elseif protocol == "_shunt" then
protocol = "分流"
elseif protocol == "vmess" then
protocol = "VMess"
elseif protocol == "vless" then
protocol = "VLESS"
else
protocol = protocol:gsub("^%l",string.upper)
end
type = type .. " " .. protocol
end
local address = m:get(n, "address") or ""
local port = m:get(n, "port") or ""
str = str .. translate(type) .. "" .. remarks
if address ~= "" and port ~= "" then
if nodes_ping:find("info") then
if datatypes.ip6addr(address) then if datatypes.ip6addr(address) then
str = str .. string.format("[%s]:%s", address, port) str = str .. string.format("[%s]:%s", address, port)
else else
str = str .. string.format("%s:%s", address, port) str = str .. string.format("%s:%s", address, port)
end end
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.address' value='%s'/>", appname, n, address)
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.port' value='%s'/>", appname, n, port)
end end
return str str = str .. string.format("<input type='hidden' id='cbid.%s.%s.address' value='%s'/>", appname, n, address)
str = str .. string.format("<input type='hidden' id='cbid.%s.%s.port' value='%s'/>", appname, n, port)
end end
return str
end end
---- Ping ---- Ping

View File

@ -551,7 +551,7 @@ for k, e in ipairs(api.get_valid_nodes()) do
if e.node_type == "normal" and e.type == "Xray" then if e.node_type == "normal" and e.type == "Xray" then
nodes_table[#nodes_table + 1] = { nodes_table[#nodes_table + 1] = {
id = e[".name"], id = e[".name"],
remarks = e.remarks_name remarks = e["remark"]
} }
end end
end end

View File

@ -136,7 +136,7 @@ local api = require "luci.model.cbi.passwall.api.api"
<input class="cbi-button cbi-button-add" type="button" onclick="open_add_link_div()" value="<%:Add the node via the link%>" /> <input class="cbi-button cbi-button-add" type="button" onclick="open_add_link_div()" value="<%:Add the node via the link%>" />
<input class="cbi-button cbi-button-remove" type="button" onclick="clear_all_nodes()" value="<%:Clear all nodes%>" /> <input class="cbi-button cbi-button-remove" type="button" onclick="clear_all_nodes()" value="<%:Clear all nodes%>" />
<input class="cbi-button cbi-button-remove" type="button" onclick="delete_select_nodes()" value="<%:Delete select nodes%>" /> <input class="cbi-button cbi-button-remove" type="button" onclick="delete_select_nodes()" value="<%:Delete select nodes%>" />
<input class="cbi-button" type="button" onclick="select_all(this)" value="<%:Select all%>" /> <input class="cbi-button" type="button" onclick="checked_all_node(this)" value="<%:Select all%>" />
<input class="cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:Save & Apply%>" /> <input class="cbi-button cbi-button-apply" type="submit" name="cbi.apply" value="<%:Save & Apply%>" />
</div> </div>
</div> </div>

View File

@ -27,10 +27,6 @@ table td, .table .td {
box-shadow: darkgrey 10px 10px 30px 5px; box-shadow: darkgrey 10px 10px 30px 5px;
} }
._select {
background: #dad8d8 !important;
}
._now_use { ._now_use {
background: #94e1ff !important; background: #94e1ff !important;
} }
@ -125,75 +121,58 @@ table td, .table .td {
} }
} }
function select_node_div(btn, id) { function checked_all_node(btn) {
btn.value = "<%:DeSelect%>"; var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("nodes_select");
btn.setAttribute("onclick", "deselect_node_div(this, '" + id + "')");
var dom = document.getElementById("cbi-passwall-" + id);
if (dom) {
dom.classList.add("_select");
dom.setAttribute("nodes_id", id);
}
}
function deselect_node_div(btn, id) {
btn.value = "<%:Select%>";
btn.setAttribute("onclick", "select_node_div(this, '" + id + "')");
var dom = document.getElementById("cbi-passwall-" + id);
if (dom) {
dom.classList.remove("_select");
dom.removeAttribute("nodes_id");
}
}
function select_all(btn) {
var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("cbi-section-table-row");
if (doms && doms.length > 0) { if (doms && doms.length > 0) {
for (var i = 0 ; i < doms.length; i++) { for (var i = 0 ; i < doms.length; i++) {
var id = doms[i].id.replace("cbi-passwall-", ""); doms[i].checked = true;
var btn2 = document.getElementById("select_" + id);
select_node_div(btn2, id);
} }
btn.value = "<%:DeSelect all%>"; btn.value = "<%:DeSelect all%>";
btn.setAttribute("onclick", "deselect_all(this)"); btn.setAttribute("onclick", "dechecked_all_node(this)");
} }
} }
function deselect_all(btn) { function dechecked_all_node(btn) {
var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("cbi-section-table-row"); var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("nodes_select");
if (doms && doms.length > 0) { if (doms && doms.length > 0) {
for (var i = 0 ; i < doms.length; i++) { for (var i = 0 ; i < doms.length; i++) {
var id = doms[i].id.replace("cbi-passwall-", ""); doms[i].checked = false;
var btn2 = document.getElementById("select_" + id);
deselect_node_div(btn2, id);
} }
btn.value = "<%:Select all%>"; btn.value = "<%:Select all%>";
btn.setAttribute("onclick", "select_all(this)"); btn.setAttribute("onclick", "checked_all_node(this)");
} }
} }
function delete_select_nodes() { function delete_select_nodes() {
var doms = document.getElementsByClassName("_select"); var ids = [];
var doms = document.getElementById("cbi-passwall-nodes").getElementsByClassName("nodes_select");
if (doms && doms.length > 0) { if (doms && doms.length > 0) {
var ids = [];
for (var i = 0 ; i < doms.length; i++) { for (var i = 0 ; i < doms.length; i++) {
if (doms[i].getAttribute("nodes_id")) { if (doms[i].checked) {
ids.push(doms[i].getAttribute("nodes_id")) ids.push(doms[i].getAttribute("cbid"))
} }
} }
if (confirm('<%:Are you sure to delete select nodes?%>') == true){ if (ids.length > 0) {
XHR.get('<%=api.url("delete_select_nodes")%>', { if (confirm('<%:Are you sure to delete select nodes?%>') == true){
ids: ids.join() XHR.get('<%=api.url("delete_select_nodes")%>', {
}, ids: ids.join()
function(x, data) { },
if(x && x.status == 200) { function(x, data) {
window.location.href = '<%=api.url("node_list")%>'; if (x && x.status == 200) {
} for (var i = 0 ; i < ids.length; i++) {
else { var box = document.getElementById("cbi-passwall-" + ids[i]);
alert("<%:Error%>"); box.remove();
} }
}); //window.location.href = '<%=api.url("node_list")%>';
}
else {
alert("<%:Error%>");
}
});
}
} }
} else { }
if (ids.length <= 0) {
alert("<%:You no select nodes !%>"); alert("<%:You no select nodes !%>");
} }
} }
@ -404,10 +383,10 @@ table td, .table .td {
var id = onclick_str.substring(onclick_str.lastIndexOf('/') + 1, onclick_str.length - 1); var id = onclick_str.substring(onclick_str.lastIndexOf('/') + 1, onclick_str.length - 1);
var td = edit_btn[i].parentNode; var td = edit_btn[i].parentNode;
var new_div = ""; var new_div = "";
//添加"勾选"框
new_div += '<input class="cbi-input-checkbox nodes_select" type="checkbox" cbid="' + id + '" />&nbsp;&nbsp;';
//添加"置顶"按钮 //添加"置顶"按钮
new_div += '<input class="cbi-button" type="button" value="<%:To Top%>" onclick="_cbi_row_top(\'' + id + '\')"/>&nbsp;&nbsp;'; new_div += '<input class="cbi-button" type="button" value="<%:To Top%>" onclick="_cbi_row_top(\'' + id + '\')"/>&nbsp;&nbsp;';
//添加"选择"按钮
new_div += '<input class="cbi-button cbi-button-add" type="button" value="<%:Select%>" id="select_' + id + '" onclick="select_node_div(this, \'' + id + '\')"/>&nbsp;&nbsp;';
//添加"应用"按钮 //添加"应用"按钮
new_div += '<input class="cbi-button cbi-button-apply" type="button" value="<%:Use%>" id="apply_' + id + '" onclick="open_set_node_div(\'' + id + '\')"/>&nbsp;&nbsp;'; new_div += '<input class="cbi-button cbi-button-apply" type="button" value="<%:Use%>" id="apply_' + id + '" onclick="open_set_node_div(\'' + id + '\')"/>&nbsp;&nbsp;';
//添加"复制"按钮 //添加"复制"按钮

View File

@ -532,6 +532,9 @@ msgstr "选中后保存应用后即使用tcping替换ping检测节点"
msgid "Concise display nodes" msgid "Concise display nodes"
msgstr "简洁显示节点" msgstr "简洁显示节点"
msgid "Show server address and port"
msgstr "显示服务器地址和端口"
msgid "Apply" msgid "Apply"
msgstr "应用" msgstr "应用"

View File

@ -316,7 +316,7 @@ load_config() {
echolog "没有选择节点!" echolog "没有选择节点!"
NO_PROXY=1 NO_PROXY=1
} }
global=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "global") global=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "global")
returnhome=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "returnhome") returnhome=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "returnhome")
chnlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "chnroute") chnlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "chnroute")
@ -366,7 +366,7 @@ run_socks() {
else else
msg="某种原因,此 Socks 服务的相关配置已失联,启动中止!" msg="某种原因,此 Socks 服务的相关配置已失联,启动中止!"
fi fi
if [ "$type" == "xray" ] && ([ -n "$(config_n_get $node balancing_node)" ] || [ "$(config_n_get $node default_node)" != "_direct" -a "$(config_n_get $node default_node)" != "_blackhole" ]); then if [ "$type" == "xray" ] && ([ -n "$(config_n_get $node balancing_node)" ] || [ "$(config_n_get $node default_node)" != "_direct" -a "$(config_n_get $node default_node)" != "_blackhole" ]); then
unset msg unset msg
fi fi
@ -403,17 +403,20 @@ run_socks() {
local protocol=$(config_n_get $node protocol client) local protocol=$(config_n_get $node protocol client)
local brook_tls=$(config_n_get $node brook_tls 0) local brook_tls=$(config_n_get $node brook_tls 0)
[ "$protocol" == "wsclient" ] && { [ "$protocol" == "wsclient" ] && {
[ "$brook_tls" == "1" ] && server_host="wss://${server_host}" || server_host="ws://${server_host}" [ "$brook_tls" == "1" ] && server_host="wss://${server_host}" || server_host="ws://${server_host}"
} }
ln_start_bin "$(first_type $(config_t_get global_app brook_file) brook)" "brook_SOCKS_${flag}" $log_file "$protocol" --socks5 "$bind:$socks_port" -s "$server_host:$port" -p "$(config_n_get $node password)" ln_start_bin "$(first_type $(config_t_get global_app brook_file) brook)" "brook_SOCKS_${flag}" $log_file "$protocol" --socks5 "$bind:$socks_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
;; ;;
ss|ssr) ss|ssr)
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port > $config_file lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port > $config_file
ln_start_bin "$(first_type ${type}-local)" "${type}-local" $log_file -c "$config_file" -b "$bind" -u -v ss_program="$(first_type ${type}local ${type}-local)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
ss_extra_arg="-U" || ss_extra_arg="-u"
ln_start_bin "$ss_program" "${type}-local" $log_file -c "$config_file" -v $ss_extra_arg
;; ;;
esac esac
# socks to http # http to socks
[ "$type" != "xray" ] && [ "$type" != "socks" ] && [ "$http_port" != "0" ] && [ "$http_config_file" != "nil" ] && { [ "$type" != "xray" ] && [ "$type" != "socks" ] && [ "$http_port" != "0" ] && [ "$http_config_file" != "nil" ] && {
lua $API_GEN_XRAY_PROTO -local_proto http -local_address "0.0.0.0" -local_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file lua $API_GEN_XRAY_PROTO -local_proto http -local_address "0.0.0.0" -local_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file
echo lua $API_GEN_XRAY_PROTO -local_proto http -local_address "0.0.0.0" -local_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password echo lua $API_GEN_XRAY_PROTO -local_proto http -local_address "0.0.0.0" -local_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password
@ -448,7 +451,7 @@ run_redir() {
[ "$bind" != "127.0.0.1" ] && echolog "${REDIR_TYPE}节点:$remarks,节点:${server_host}:${port},监听端口:$local_port" [ "$bind" != "127.0.0.1" ] && echolog "${REDIR_TYPE}节点:$remarks,节点:${server_host}:${port},监听端口:$local_port"
} }
eval ${REDIR_TYPE}_NODE_PORT=$port eval ${REDIR_TYPE}_NODE_PORT=$port
case "$REDIR_TYPE" in case "$REDIR_TYPE" in
UDP) UDP)
case "$type" in case "$type" in
@ -488,7 +491,10 @@ run_redir() {
;; ;;
ss|ssr) ss|ssr)
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file
ln_start_bin "$(first_type ${type}-redir)" "${type}-redir" $log_file -c "$config_file" -U -v ss_program="$(first_type ${type}local ${type}-redir)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
ss_extra_arg="--protocol redir -u" || ss_extra_arg="-U"
ln_start_bin "$ss_program" "${type}-redir" $log_file -c "$config_file" -v $ss_extra_arg
;; ;;
esac esac
;; ;;
@ -557,7 +563,7 @@ run_redir() {
local protocol=$(config_n_get $node protocol client) local protocol=$(config_n_get $node protocol client)
local brook_tls=$(config_n_get $node brook_tls 0) local brook_tls=$(config_n_get $node brook_tls 0)
if [ "$protocol" == "wsclient" ]; then if [ "$protocol" == "wsclient" ]; then
[ "$brook_tls" == "1" ] && server_ip="wss://${server_ip}" || server_ip="ws://${server_ip}" [ "$brook_tls" == "1" ] && server_ip="wss://${server_ip}" || server_ip="ws://${server_ip}"
socks_port=$(get_new_port 2081 tcp) socks_port=$(get_new_port 2081 tcp)
ln_start_bin "$(first_type $(config_t_get global_app brook_file) brook)" "brook_tcp" $log_file wsclient --socks5 "127.0.0.1:$socks_port" -s "$server_ip:$port" -p "$(config_n_get $node password)" ln_start_bin "$(first_type $(config_t_get global_app brook_file) brook)" "brook_tcp" $log_file wsclient --socks5 "127.0.0.1:$socks_port" -s "$server_ip:$port" -p "$(config_n_get $node password)"
_socks_flag=1 _socks_flag=1
@ -574,14 +580,17 @@ run_redir() {
fi fi
;; ;;
ss|ssr) ss|ssr)
ss_program="$(first_type ${type}local ${type}-redir)"
[ "$(printf '%s' "$ss_program" | awk -F '/' '{print $NF}')" = "${type}local" ] && \
ss_extra_arg="--protocol redir"
if [ "$kcptun_use" == "1" ]; then if [ "$kcptun_use" == "1" ]; then
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port -server_host "127.0.0.1" -server_port $KCPTUN_REDIR_PORT > $config_file lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port -server_host "127.0.0.1" -server_port $KCPTUN_REDIR_PORT > $config_file
[ "$UDP_NODE" == "tcp" ] && echolog "Kcptun不支持UDP转发" [ "$UDP_NODE" == "tcp" ] && echolog "Kcptun不支持UDP转发"
else else
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file
[ "$UDP_NODE" == "tcp" ] && extra_param="-u" [ "$UDP_NODE" == "tcp" ] && ss_extra_arg="$ss_extra_arg -u"
fi fi
ln_start_bin "$(first_type ${type}-redir)" "${type}-redir" $log_file -c "$config_file" -v $extra_param ln_start_bin "$ss_program" "${type}-redir" $log_file -c "$config_file" -v $ss_extra_arg
;; ;;
esac esac
if [ -n "$_socks_flag" ]; then if [ -n "$_socks_flag" ]; then
@ -590,7 +599,7 @@ run_redir() {
ln_start_bin "$(first_type ipt2socks)" "ipt2socks_tcp" $log_file -l "$local_port" -b 0.0.0.0 -s "$_socks_address" -p "$_socks_port" -R -v $extra_param ln_start_bin "$(first_type ipt2socks)" "ipt2socks_tcp" $log_file -l "$local_port" -b 0.0.0.0 -s "$_socks_address" -p "$_socks_port" -R -v $extra_param
fi fi
unset _socks_flag _socks_address _socks_port _socks_username _socks_password unset _socks_flag _socks_address _socks_port _socks_username _socks_password
[ "$type" != "xray" ] && { [ "$type" != "xray" ] && {
[ "$tcp_node_socks" = "1" ] && { [ "$tcp_node_socks" = "1" ] && {
local port=$tcp_node_socks_port local port=$tcp_node_socks_port
@ -617,7 +626,7 @@ node_switch() {
local log_file=$TMP_PATH/${1}.log local log_file=$TMP_PATH/${1}.log
eval current_port=\$${1}_REDIR_PORT eval current_port=\$${1}_REDIR_PORT
local port=$(cat $TMP_PORT_PATH/${1}) local port=$(cat $TMP_PORT_PATH/${1})
local ids=$(uci show $CONFIG | grep "=socks" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}') local ids=$(uci show $CONFIG | grep "=socks" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}')
for id in $ids; do for id in $ids; do
[ "$(config_n_get $id enabled 0)" == "0" ] && continue [ "$(config_n_get $id enabled 0)" == "0" ] && continue
@ -635,10 +644,10 @@ node_switch() {
} }
break break
done done
run_redir $node "0.0.0.0" $port $config_file $1 $log_file run_redir $node "0.0.0.0" $port $config_file $1 $log_file
echo $node > $TMP_ID_PATH/${1} echo $node > $TMP_ID_PATH/${1}
[ "$1" = "TCP" ] && { [ "$1" = "TCP" ] && {
[ "$(config_t_get global udp_node nil)" = "tcp_" ] && { [ "$(config_t_get global udp_node nil)" = "tcp_" ] && {
top -bn1 | grep -E "$TMP_PATH" | grep -i "UDP" | grep -v "grep" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 top -bn1 | grep -E "$TMP_PATH" | grep -i "UDP" | grep -v "grep" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1
@ -646,7 +655,7 @@ node_switch() {
start_redir UDP start_redir UDP
} }
} }
#local node_net=$(echo $1 | tr 'A-Z' 'a-z') #local node_net=$(echo $1 | tr 'A-Z' 'a-z')
#uci set $CONFIG.@global[0].${node_net}_node=$node #uci set $CONFIG.@global[0].${node_net}_node=$node
#uci commit $CONFIG #uci commit $CONFIG
@ -759,13 +768,13 @@ start_crontab() {
echo "$t lua $APP_PATH/subscribe.lua start log > /dev/null 2>&1 &" >>/etc/crontabs/root echo "$t lua $APP_PATH/subscribe.lua start log > /dev/null 2>&1 &" >>/etc/crontabs/root
echolog "配置定时任务:自动更新节点订阅。" echolog "配置定时任务:自动更新节点订阅。"
fi fi
start_daemon=$(config_t_get global_delay start_daemon 0) start_daemon=$(config_t_get global_delay start_daemon 0)
[ "$start_daemon" = "1" ] && $APP_PATH/monitor.sh > /dev/null 2>&1 & [ "$start_daemon" = "1" ] && $APP_PATH/monitor.sh > /dev/null 2>&1 &
AUTO_SWITCH_ENABLE=$(config_t_get auto_switch enable 0) AUTO_SWITCH_ENABLE=$(config_t_get auto_switch enable 0)
[ "$AUTO_SWITCH_ENABLE" = "1" ] && $APP_PATH/test.sh > /dev/null 2>&1 & [ "$AUTO_SWITCH_ENABLE" = "1" ] && $APP_PATH/test.sh > /dev/null 2>&1 &
/etc/init.d/cron restart /etc/init.d/cron restart
} }
@ -779,15 +788,15 @@ start_dns() {
local pdnsd_forward other_port msg local pdnsd_forward other_port msg
dns_listen_port=${DNS_PORT} dns_listen_port=${DNS_PORT}
pdnsd_forward=${DNS_FORWARD} pdnsd_forward=${DNS_FORWARD}
china_ng_listen_port=$(expr $dns_listen_port + 1) china_ng_listen_port=$(expr $dns_listen_port + 1)
china_ng_listen="127.0.0.1#${china_ng_listen_port}" china_ng_listen="127.0.0.1#${china_ng_listen_port}"
china_ng_chn=$(echo -n $(echo "${LOCAL_DNS}" | sed "s/,/\n/g" | head -n2) | tr " " ",") china_ng_chn=$(echo -n $(echo "${LOCAL_DNS}" | sed "s/,/\n/g" | head -n2) | tr " " ",")
china_ng_gfw="127.0.0.1#${dns_listen_port}" china_ng_gfw="127.0.0.1#${dns_listen_port}"
[ -n "${returnhome}" ] && china_ng_chn="${china_ng_gfw}" && china_ng_gfw="${LOCAL_DNS}" [ -n "${returnhome}" ] && china_ng_chn="${china_ng_gfw}" && china_ng_gfw="${LOCAL_DNS}"
echolog "过滤服务配置:准备接管域名解析..." echolog "过滤服务配置:准备接管域名解析..."
case "$DNS_MODE" in case "$DNS_MODE" in
nonuse) nonuse)
echolog " - 不过滤DNS..." echolog " - 不过滤DNS..."
@ -816,7 +825,7 @@ start_dns() {
_doh_host=$(echo $_doh_host_port | awk -F ':' '{print $1}') _doh_host=$(echo $_doh_host_port | awk -F ':' '{print $1}')
_doh_port=$(echo $_doh_host_port | awk -F ':' '{print $2}') _doh_port=$(echo $_doh_host_port | awk -F ':' '{print $2}')
_doh_bootstrap=$(echo $up_trust_doh | cut -d ',' -sf 2-) _doh_bootstrap=$(echo $up_trust_doh | cut -d ',' -sf 2-)
up_trust_doh_dns=$(config_t_get global up_trust_doh_dns "tcp") up_trust_doh_dns=$(config_t_get global up_trust_doh_dns "tcp")
if [ "$up_trust_doh_dns" = "socks" ]; then if [ "$up_trust_doh_dns" = "socks" ]; then
socks_server=$(echo $(config_t_get global socks_server 127.0.0.1:9050) | sed "s/#/:/g") socks_server=$(echo $(config_t_get global socks_server 127.0.0.1:9050) | sed "s/#/:/g")
@ -858,7 +867,7 @@ start_dns() {
echolog " - 域名解析使用UDP协议自定义DNS$TUN_DNS)解析..." echolog " - 域名解析使用UDP协议自定义DNS$TUN_DNS)解析..."
;; ;;
esac esac
[ -n "$chnlist" ] && [ "$DNS_MODE" != "custom" ] && [ "$DNS_MODE" != "fake_ip" ] && { [ -n "$chnlist" ] && [ "$DNS_MODE" != "custom" ] && [ "$DNS_MODE" != "fake_ip" ] && {
[ -f "${RULES_PATH}/chnlist" ] && cp -a "${RULES_PATH}/chnlist" "${TMP_PATH}/chnlist" [ -f "${RULES_PATH}/chnlist" ] && cp -a "${RULES_PATH}/chnlist" "${TMP_PATH}/chnlist"
[ -n "$(first_type chinadns-ng)" ] && { [ -n "$(first_type chinadns-ng)" ] && {
@ -882,17 +891,21 @@ start_dns() {
china_ng_gfw="$(echo ${custom_dns} | sed 's/:/#/g')" china_ng_gfw="$(echo ${custom_dns} | sed 's/:/#/g')"
msg="自定义DNS" msg="自定义DNS"
fi fi
local chnlist_param="${TMP_PATH}/chnlist"
[ -f "${RULES_PATH}/direct_host" ] && {
cat "${RULES_PATH}/direct_host" >> "${chnlist_param}"
echolog " | - [$?](chinadns-ng) 域名白名单合并到中国域名表"
}
sed -n 's/^ipset=\/\.\?\([^/]*\).*$/\1/p' "${RULES_PATH}/gfwlist.conf" | sort -u > "${TMP_PATH}/gfwlist.txt" sed -n 's/^ipset=\/\.\?\([^/]*\).*$/\1/p' "${RULES_PATH}/gfwlist.conf" | sort -u > "${TMP_PATH}/gfwlist.txt"
[ -f "${RULES_PATH}/proxy_host" ] && { [ -f "${RULES_PATH}/proxy_host" ] && {
cat "${RULES_PATH}/proxy_host" >> "${TMP_PATH}/gfwlist.txt" && sort -u "${TMP_PATH}/gfwlist.txt" > "${TMP_PATH}/gfwlist2.txt" && mv -f "${TMP_PATH}/gfwlist2.txt" "${TMP_PATH}/gfwlist.txt" cat "${RULES_PATH}/proxy_host" >> "${TMP_PATH}/gfwlist.txt" && sort -u "${TMP_PATH}/gfwlist.txt" > "${TMP_PATH}/gfwlist2.txt" && mv -f "${TMP_PATH}/gfwlist2.txt" "${TMP_PATH}/gfwlist.txt"
local gfwlist_param="${TMP_PATH}/gfwlist.txt" local gfwlist_param="${TMP_PATH}/gfwlist.txt"
echolog " | - [$?](chinadns-ng) 代理域名表合并到防火墙域名表" echolog " | - [$?](chinadns-ng) 代理域名表合并到防火墙域名表"
for _host in $(cat ${RULES_PATH}/proxy_host); do
sed -i "/$_host/d" "${TMP_PATH}/chnlist"
done
}
local chnlist_param="${TMP_PATH}/chnlist"
[ -f "${RULES_PATH}/direct_host" ] && {
cat "${RULES_PATH}/direct_host" >> "${chnlist_param}"
echolog " | - [$?](chinadns-ng) 域名白名单合并到中国域名表"
} }
chnlist_param=${chnlist_param:+-m "${chnlist_param}" -M} chnlist_param=${chnlist_param:+-m "${chnlist_param}" -M}
ln_start_bin "$(first_type chinadns-ng)" chinadns-ng "${TMP_PATH}/chinadns-ng.log" -v -b 0.0.0.0 -l "${china_ng_listen_port}" ${china_ng_chn:+-c "${china_ng_chn}"} ${chnlist_param} ${china_ng_gfw:+-t "${china_ng_gfw}"} ${gfwlist_param:+-g "${gfwlist_param}"} -f ln_start_bin "$(first_type chinadns-ng)" chinadns-ng "${TMP_PATH}/chinadns-ng.log" -v -b 0.0.0.0 -l "${china_ng_listen_port}" ${china_ng_chn:+-c "${china_ng_chn}"} ${chnlist_param} ${china_ng_gfw:+-t "${china_ng_gfw}"} ${gfwlist_param:+-g "${gfwlist_param}"} -f
@ -900,7 +913,7 @@ start_dns() {
#[ -n "${global}${chnlist}" ] && [ -z "${returnhome}" ] && TUN_DNS="${china_ng_gfw}" #[ -n "${global}${chnlist}" ] && [ -z "${returnhome}" ] && TUN_DNS="${china_ng_gfw}"
} }
} }
[ "${use_udp_node_resolve_dns}" = "1" ] && echolog " * 要求代理 DNS 请求,如上游 DNS 非直连地址,确保 UDP 代理打开,并且已经正确转发!" [ "${use_udp_node_resolve_dns}" = "1" ] && echolog " * 要求代理 DNS 请求,如上游 DNS 非直连地址,确保 UDP 代理打开,并且已经正确转发!"
[ "${use_tcp_node_resolve_dns}" = "1" ] && echolog " * 请确认上游 DNS 支持 TCP 查询,如非直连地址,确保 TCP 代理打开,并且已经正确转发!" [ "${use_tcp_node_resolve_dns}" = "1" ] && echolog " * 请确认上游 DNS 支持 TCP 查询,如非直连地址,确保 TCP 代理打开,并且已经正确转发!"
} }
@ -919,7 +932,7 @@ add_dnsmasq() {
else else
#屏蔽列表 #屏蔽列表
sort -u "${RULES_PATH}/block_host" | gen_dnsmasq_fake_items "0.0.0.0" "${TMP_DNSMASQ_PATH}/00-block_host.conf" sort -u "${RULES_PATH}/block_host" | gen_dnsmasq_fake_items "0.0.0.0" "${TMP_DNSMASQ_PATH}/00-block_host.conf"
#始终用国内DNS解析节点域名 #始终用国内DNS解析节点域名
fwd_dns="${LOCAL_DNS}" fwd_dns="${LOCAL_DNS}"
servers=$(uci show "${CONFIG}" | grep ".address=" | cut -d "'" -f 2) servers=$(uci show "${CONFIG}" | grep ".address=" | cut -d "'" -f 2)
@ -932,19 +945,15 @@ add_dnsmasq() {
sort -u "${RULES_PATH}/direct_host" | gen_dnsmasq_items "whitelist,whitelist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/11-direct_host.conf" sort -u "${RULES_PATH}/direct_host" | gen_dnsmasq_items "whitelist,whitelist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/11-direct_host.conf"
echolog " - [$?]域名白名单(whitelist)${fwd_dns:-默认}" echolog " - [$?]域名白名单(whitelist)${fwd_dns:-默认}"
#始终使用远程DNS解析代理黑名单列表 if [ "$(config_t_get global_subscribe subscribe_proxy 0)" = "0" ]; then
if [ "${DNS_MODE}" = "fake_ip" ]; then #如果没有开启通过代理订阅
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/90-proxy_host.conf" fwd_dns="${LOCAL_DNS}"
for item in $(get_enabled_anonymous_secs "@subscribe_list"); do
host_from_url "$(config_n_get ${item} url)" | gen_dnsmasq_items "whitelist,whitelist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/12-subscribe.conf"
done
echolog " - [$?]节点订阅域名(whitelist)${fwd_dns:-默认}"
else else
fwd_dns="${TUN_DNS}" #如果开启了通过代理订阅
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
[ -n "$CHINADNS_NG" ] && unset fwd_dns
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_items "blacklist,blacklist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/90-proxy_host.conf"
echolog " - [$?]代理域名表(blacklist)${fwd_dns:-默认}"
fi
#如果开启了通过代理订阅
[ "$(config_t_get global_subscribe subscribe_proxy 0)" = "1" ] && {
fwd_dns="${TUN_DNS}" fwd_dns="${TUN_DNS}"
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}" [ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
for item in $(get_enabled_anonymous_secs "@subscribe_list"); do for item in $(get_enabled_anonymous_secs "@subscribe_list"); do
@ -955,8 +964,19 @@ add_dnsmasq() {
fi fi
done done
[ "${DNS_MODE}" != "fake_ip" ] && echolog " - [$?]节点订阅域名(blacklist)${fwd_dns:-默认}" [ "${DNS_MODE}" != "fake_ip" ] && echolog " - [$?]节点订阅域名(blacklist)${fwd_dns:-默认}"
} fi
#始终使用远程DNS解析代理黑名单列表
if [ "${DNS_MODE}" = "fake_ip" ]; then
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
else
fwd_dns="${TUN_DNS}"
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
[ -n "$CHINADNS_NG" ] && unset fwd_dns
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_items "blacklist,blacklist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/97-proxy_host.conf"
echolog " - [$?]代理域名表(blacklist)${fwd_dns:-默认}"
fi
#分流规则 #分流规则
[ "$(config_n_get $TCP_NODE protocol)" = "_shunt" ] && { [ "$(config_n_get $TCP_NODE protocol)" = "_shunt" ] && {
fwd_dns="${TUN_DNS}" fwd_dns="${TUN_DNS}"
@ -990,21 +1010,28 @@ add_dnsmasq() {
sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist,gfwlist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf" sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist,gfwlist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
echolog " - [$?]防火墙域名表(gfwlist)${fwd_dns:-默认}" echolog " - [$?]防火墙域名表(gfwlist)${fwd_dns:-默认}"
fi fi
# Not China List 模式
[ -n "${chnlist}" ] && {
fwd_dns="${LOCAL_DNS}"
[ -n "$CHINADNS_NG" ] && unset fwd_dns
sort -u "${TMP_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/19-chinalist_host.conf"
echolog " - [$?]中国域名表(chnroute)${fwd_dns:-默认}"
}
else else
#回国模式 #回国模式
if [ "${DNS_MODE}" = "fake_ip" ]; then if [ "${DNS_MODE}" = "fake_ip" ]; then
sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/10-chinalist_host.conf" sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_fake_items "11.1.1.1" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
else else
fwd_dns="${TUN_DNS}" fwd_dns="${TUN_DNS}"
sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/10-chinalist_host.conf" sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_items "chnroute,chnroute6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-chinalist_host.conf"
echolog " - [$?]中国域名表(chnroute)${fwd_dns:-默认}" echolog " - [$?]中国域名表(chnroute)${fwd_dns:-默认}"
fi fi
fi fi
fi fi
if [ "${DNS_MODE}" != "nouse" ]; then if [ "${DNS_MODE}" != "nouse" ]; then
echo "conf-dir=${TMP_DNSMASQ_PATH}" > "/var/dnsmasq.d/dnsmasq-${CONFIG}.conf" echo "conf-dir=${TMP_DNSMASQ_PATH}" > "/var/dnsmasq.d/dnsmasq-${CONFIG}.conf"
if [ -z "${CHINADNS_NG}" ] && [ "${IS_DEFAULT_DNS}" = "1" ]; then if [ -z "${CHINADNS_NG}" ] && [ "${IS_DEFAULT_DNS}" = "1" ]; then
echolog " - 不强制设置默认DNS" echolog " - 不强制设置默认DNS"
return return
@ -1015,12 +1042,12 @@ add_dnsmasq() {
[ -n "${chnlist}" ] && msg="中国列表以外" [ -n "${chnlist}" ] && msg="中国列表以外"
[ -n "${returnhome}" ] && msg="中国列表" [ -n "${returnhome}" ] && msg="中国列表"
[ -n "${global}" ] && msg="全局" [ -n "${global}" ] && msg="全局"
#默认交给Chinadns-ng处理 #默认交给Chinadns-ng处理
[ -n "$CHINADNS_NG" ] && { [ -n "$CHINADNS_NG" ] && {
servers="${china_ng_listen}" && msg="chinadns-ng" servers="${china_ng_listen}" && msg="chinadns-ng"
} }
cat <<-EOF >> "/var/dnsmasq.d/dnsmasq-${CONFIG}.conf" cat <<-EOF >> "/var/dnsmasq.d/dnsmasq-${CONFIG}.conf"
$(echo "${servers}" | sed 's/,/\n/g' | gen_dnsmasq_items) $(echo "${servers}" | sed 's/,/\n/g' | gen_dnsmasq_items)
all-servers all-servers
@ -1067,7 +1094,7 @@ gen_pdnsd_config() {
proc_limit = 2; proc_limit = 2;
procq_limit = 8; procq_limit = 8;
} }
EOF EOF
echolog " + [$?]Pdnsd (127.0.0.1:${listen_port})..." echolog " + [$?]Pdnsd (127.0.0.1:${listen_port})..."
@ -1223,7 +1250,7 @@ start_haproxy() {
local auth="" local auth=""
[ -n "$console_user" ] && [ -n "$console_password" ] && auth="stats auth $console_user:$console_password" [ -n "$console_user" ] && [ -n "$console_password" ] && auth="stats auth $console_user:$console_password"
cat <<-EOF >> "${haproxy_file}" cat <<-EOF >> "${haproxy_file}"
listen console listen console
bind 0.0.0.0:$console_port bind 0.0.0.0:$console_port
mode http mode http

View File

@ -24,7 +24,6 @@ FORCE_INDEX=2
ipt_n="iptables -t nat" ipt_n="iptables -t nat"
ipt_m="iptables -t mangle" ipt_m="iptables -t mangle"
ip6t_n="ip6tables -t nat"
ip6t_m="ip6tables -t mangle" ip6t_m="ip6tables -t mangle"
FWI=$(uci -q get firewall.passwall.path 2>/dev/null) FWI=$(uci -q get firewall.passwall.path 2>/dev/null)
@ -48,8 +47,10 @@ comment() {
} }
destroy_ipset() { destroy_ipset() {
#ipset -q -F $1 for i in "$@"; do
ipset -q -X $1 #ipset -q -F $i
ipset -q -X $i
done
} }
RULE_LAST_INDEX() { RULE_LAST_INDEX() {
@ -207,7 +208,7 @@ load_acl() {
fi fi
[ "$tcp_no_redir_ports" != "disable" ] && { [ "$tcp_no_redir_ports" != "disable" ] && {
$ipt_tmp -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -m multiport --dport $tcp_no_redir_ports -j RETURN $ipt_tmp -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -m multiport --dport $tcp_no_redir_ports -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -m multiport --dport $tcp_no_redir_ports -j RETURN $ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -m multiport --dport $tcp_no_redir_ports -j RETURN 2>/dev/null
msg2="${msg2}[$?]除${tcp_no_redir_ports}外的" msg2="${msg2}[$?]除${tcp_no_redir_ports}外的"
} }
msg2="${msg2}所有端口" msg2="${msg2}所有端口"
@ -217,15 +218,15 @@ load_acl() {
$ipt_tmp -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(get_redirect_ipt $tcp_proxy_mode $tcp_port $is_tproxy) $ipt_tmp -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(get_redirect_ipt $tcp_proxy_mode $tcp_port $is_tproxy)
if [ "$PROXY_IPV6" == "1" ]; then if [ "$PROXY_IPV6" == "1" ]; then
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST6) $(REDIRECT $tcp_port TPROXY) $ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST6) $(REDIRECT $tcp_port TPROXY) 2>/dev/null
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST6) $(REDIRECT $tcp_port TPROXY) $ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST6) $(REDIRECT $tcp_port TPROXY) 2>/dev/null
$ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(get_redirect_ip6t $tcp_proxy_mode $tcp_port TPROXY) $ip6t_m -A PSW $(comment "$remarks") -p tcp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $tcp_redir_ports "-m multiport --dport") $(get_redirect_ip6t $tcp_proxy_mode $tcp_port TPROXY) 2>/dev/null
fi fi
} }
echolog " - ${msg2}" echolog " - ${msg2}"
} }
$ipt_tmp -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -j RETURN $ipt_tmp -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -j RETURN $ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p tcp -j RETURN 2>/dev/null
[ "$udp_proxy_mode" != "disable" ] && { [ "$udp_proxy_mode" != "disable" ] && {
msg2="${msg}使用UDP节点 [$(get_action_chain_name $udp_proxy_mode)]" msg2="${msg}使用UDP节点 [$(get_action_chain_name $udp_proxy_mode)]"
@ -234,7 +235,7 @@ load_acl() {
msg2="${msg2}(TPROXY:${udp_port})代理" msg2="${msg2}(TPROXY:${udp_port})代理"
[ "$udp_no_redir_ports" != "disable" ] && { [ "$udp_no_redir_ports" != "disable" ] && {
$ipt_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -m multiport --dport $udp_no_redir_ports -j RETURN $ipt_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -m multiport --dport $udp_no_redir_ports -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -m multiport --dport $udp_no_redir_ports -j RETURN $ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -m multiport --dport $udp_no_redir_ports -j RETURN 2>/dev/null
msg2="${msg2}[$?]除${udp_no_redir_ports}外的" msg2="${msg2}[$?]除${udp_no_redir_ports}外的"
} }
msg2="${msg2}所有端口" msg2="${msg2}所有端口"
@ -244,15 +245,15 @@ load_acl() {
$ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(get_redirect_ipt $udp_proxy_mode $udp_port TPROXY) $ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(get_redirect_ipt $udp_proxy_mode $udp_port TPROXY)
if [ "$PROXY_IPV6" == "1" ]; then if [ "$PROXY_IPV6" == "1" ]; then
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST6) $(REDIRECT $udp_port TPROXY) $ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST6) $(REDIRECT $udp_port TPROXY) 2>/dev/null
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST6) $(REDIRECT $udp_port TPROXY) $ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST6) $(REDIRECT $udp_port TPROXY) 2>/dev/null
$ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(get_redirect_ip6t $udp_proxy_mode $udp_port TPROXY) $ip6t_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(get_redirect_ip6t $udp_proxy_mode $udp_port TPROXY) 2>/dev/null
fi fi
} }
echolog " - ${msg2}" echolog " - ${msg2}"
} }
$ipt_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -j RETURN $ipt_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -j RETURN
$ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -j RETURN $ip6t_m -A PSW $(comment "$remarks") $(factor $ip "-s") $(factor $mac "-m mac --mac-source") -p udp -j RETURN 2>/dev/null
done done
} }
@ -338,7 +339,7 @@ filter_haproxy() {
filter_vpsip() { filter_vpsip() {
uci show $CONFIG | grep ".address=" | cut -d "'" -f 2 | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | sed -e "/^$/d" | sed -e "s/^/add $IPSET_VPSIPLIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R uci show $CONFIG | grep ".address=" | cut -d "'" -f 2 | grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | sed -e "/^$/d" | sed -e "s/^/add $IPSET_VPSIPLIST &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
uci show $CONFIG | grep ".address=" | cut -d "'" -f 2 | grep -E "([[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){0,7}::[a-f0-9]{0,4}(:[a-f0-9]{1,4}){0,7}])" | sed -e "/^$/d" | sed -e "s/^/add $IPSET_VPSIPLIST6 &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R uci show $CONFIG | grep ".address=" | cut -d "'" -f 2 | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}" | sed -e "/^$/d" | sed -e "s/^/add $IPSET_VPSIPLIST6 &/g" | awk '{print $0} END{print "COMMIT"}' | ipset -! -R
echolog "加入所有节点到ipset[$IPSET_VPSIPLIST]直连完成" echolog "加入所有节点到ipset[$IPSET_VPSIPLIST]直连完成"
} }
@ -393,7 +394,7 @@ filter_node() {
dst_rule=" -j RETURN" dst_rule=" -j RETURN"
msg2="直连代理" msg2="直连代理"
} }
$_ipt -I PSW_OUTPUT $ADD_INDEX $(comment "${address}:${port}") -p $stream -d $address --dport $port $dst_rule 2>/dev/null $_ipt -w -I PSW_OUTPUT $ADD_INDEX $(comment "${address}:${port}") -p $stream -d $address --dport $port $dst_rule 2>/dev/null
else else
msg2="已配置过的节点," msg2="已配置过的节点,"
fi fi
@ -549,12 +550,21 @@ add_firewall_rule() {
# 过滤所有节点IP # 过滤所有节点IP
filter_vpsip > /dev/null 2>&1 & filter_vpsip > /dev/null 2>&1 &
filter_haproxy > /dev/null 2>&1 & filter_haproxy > /dev/null 2>&1 &
# 据说能提升性能?
$ipt_m -N PSW_DIVERT
$ipt_m -A PSW_DIVERT -j MARK --set-mark 1
$ipt_m -A PSW_DIVERT -j ACCEPT
$ipt_m -A PREROUTING -p tcp -m socket -j PSW_DIVERT
$ipt_n -N PSW $ipt_n -N PSW
$ipt_n -A PSW $(dst $IPSET_LANIPLIST) -j RETURN $ipt_n -A PSW $(dst $IPSET_LANIPLIST) -j RETURN
$ipt_n -A PSW $(dst $IPSET_VPSIPLIST) -j RETURN $ipt_n -A PSW $(dst $IPSET_VPSIPLIST) -j RETURN
$ipt_n -A PSW $(dst $IPSET_WHITELIST) -j RETURN $ipt_n -A PSW $(dst $IPSET_WHITELIST) -j RETURN
$ipt_n -A PSW -m mark --mark 0xff -j RETURN $ipt_n -A PSW -m mark --mark 0xff -j RETURN
local PR_INDEX=$(RULE_LAST_INDEX "$ipt_n" PREROUTING prerouting_rule)
PR_INDEX=$((PR_INDEX + 1))
$ipt_n -I PREROUTING $PR_INDEX -p tcp -j PSW
$ipt_n -N PSW_OUTPUT $ipt_n -N PSW_OUTPUT
$ipt_n -A PSW_OUTPUT $(dst $IPSET_LANIPLIST) -j RETURN $ipt_n -A PSW_OUTPUT $(dst $IPSET_LANIPLIST) -j RETURN
@ -568,6 +578,7 @@ add_firewall_rule() {
$ipt_m -A PSW $(dst $IPSET_WHITELIST) -j RETURN $ipt_m -A PSW $(dst $IPSET_WHITELIST) -j RETURN
$ipt_m -A PSW -m mark --mark 0xff -j RETURN $ipt_m -A PSW -m mark --mark 0xff -j RETURN
$ipt_m -A PSW $(dst $IPSET_BLOCKLIST) -j DROP $ipt_m -A PSW $(dst $IPSET_BLOCKLIST) -j DROP
$ipt_m -A PREROUTING -j PSW
$ipt_m -N PSW_OUTPUT $ipt_m -N PSW_OUTPUT
$ipt_m -A PSW_OUTPUT $(dst $IPSET_LANIPLIST) -j RETURN $ipt_m -A PSW_OUTPUT $(dst $IPSET_LANIPLIST) -j RETURN
@ -582,18 +593,20 @@ add_firewall_rule() {
local NODE_TYPE=$(echo $(config_n_get $TCP_NODE type) | tr 'A-Z' 'a-z') local NODE_TYPE=$(echo $(config_n_get $TCP_NODE type) | tr 'A-Z' 'a-z')
local ipv6_tproxy=$(config_t_get global_other ipv6_tproxy 0) local ipv6_tproxy=$(config_t_get global_other ipv6_tproxy 0)
if [ $NODE_TYPE == "xray" ] && [ $ipv6_tproxy == "1" ]; then if [ $ipv6_tproxy == "1" ]; then
PROXY_IPV6=1 if [ $NODE_TYPE == "xray" ]; then
echolog "节点类型:$NODE_TYPE开启实验性IPv6透明代理(TProxy)..." PROXY_IPV6=1
else echolog "节点类型:$NODE_TYPE开启实验性IPv6透明代理(TProxy)..."
[ $enble_ipv6=="1" ] && echolog "节点类型:$NODE_TYPE暂不支持IPv6透明代理(TProxy)..." else
echolog "节点类型:$NODE_TYPE暂不支持IPv6透明代理(TProxy)..."
fi
fi fi
#$ip6t_n -N PSW # 据说能提升性能?
#$ip6t_n -A PREROUTING -j PSW $ip6t_m -N PSW_DIVERT
$ip6t_m -A PSW_DIVERT -j MARK --set-mark 1
#$ip6t_n -N PSW_OUTPUT $ip6t_m -A PSW_DIVERT -j ACCEPT
#$ip6t_n -A OUTPUT -p tcp -j PSW_OUTPUT $ip6t_m -A PREROUTING -p tcp -m socket -j PSW_DIVERT
$ip6t_m -N PSW $ip6t_m -N PSW
$ip6t_m -A PSW $(dst $IPSET_LANIPLIST6) -j RETURN $ip6t_m -A PSW $(dst $IPSET_LANIPLIST6) -j RETURN
@ -664,24 +677,6 @@ add_firewall_rule() {
fi fi
fi fi
local PR_INDEX=$(RULE_LAST_INDEX "$ipt_n" PREROUTING ADBYBY)
if [ "$PR_INDEX" == "0" ]; then
PR_INDEX=$(RULE_LAST_INDEX "$ipt_n" PREROUTING prerouting_rule)
else
echolog "发现 adbyby 规则链adbyby 规则优先..."
fi
PR_INDEX=$((PR_INDEX + 1))
$ipt_n -I PREROUTING $PR_INDEX -p tcp -j PSW
echolog "使用链表 PREROUTING 排列索引${PR_INDEX}[$?]"
# if [ "$PROXY_IPV6" == "1" ]; then
# local msg="IPv6 配置不当,无法代理"
# $ip6t_n -A PSW -p tcp $(REDIRECT $TCP_REDIR_PORT)
# $ip6t_n -A PSW_OUTPUT -p tcp $(REDIRECT $TCP_REDIR_PORT)
# msg="${msg},转发 IPv6 TCP 流量到节点[$?]"
# echolog "$msg"
# fi
# 过滤Socks节点 # 过滤Socks节点
[ "$SOCKS_ENABLED" = "1" ] && { [ "$SOCKS_ENABLED" = "1" ] && {
local ids=$(uci show $CONFIG | grep "=socks" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}') local ids=$(uci show $CONFIG | grep "=socks" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}')
@ -759,8 +754,6 @@ add_firewall_rule() {
fi fi
fi fi
$ipt_m -A PREROUTING -j PSW
# 加载ACLS # 加载ACLS
load_acl load_acl
@ -770,35 +763,18 @@ add_firewall_rule() {
} }
del_firewall_rule() { del_firewall_rule() {
ib_nat_exist=$($ipt_n -nL PREROUTING | grep -c PSW) for ipt in "$ipt_n" "$ipt_m" "$ip6t_m"; do
if [ ! -z "$ib_nat_exist" ];then for chain in "PREROUTING" "OUTPUT"; do
until [ "$ib_nat_exist" = 0 ] for i in $(seq 1 $($ipt -nL $chain | grep -c PSW)); do
do local index=$($ipt --line-number -nL $chain | grep PSW | head -1 | awk '{print $1}')
$ipt_n -D PREROUTING -p tcp -j PSW 2>/dev/null $ipt -D $chain $index 2>/dev/null
$ipt_n -D OUTPUT -p tcp -j PSW_OUTPUT 2>/dev/null done
done
$ipt_m -D PREROUTING -j PSW 2>/dev/null for chain in "PSW" "PSW_OUTPUT" "PSW_DIVERT"; do
$ipt_m -D OUTPUT -p tcp -j PSW_OUTPUT 2>/dev/null $ipt -F $chain 2>/dev/null
$ipt_m -D OUTPUT -p udp -j PSW_OUTPUT 2>/dev/null $ipt -X $chain 2>/dev/null
done
#$ip6t_n -D PREROUTING -j PSW 2>/dev/null
#$ip6t_n -D OUTPUT -p tcp -j PSW_OUTPUT 2>/dev/null
$ip6t_m -D PREROUTING -j PSW 2>/dev/null
$ip6t_m -D OUTPUT -j PSW_OUTPUT 2>/dev/null
ib_nat_exist=$(expr $ib_nat_exist - 1)
done done
fi
$ipt_n -F PSW 2>/dev/null && $ipt_n -X PSW 2>/dev/null
$ipt_n -F PSW_OUTPUT 2>/dev/null && $ipt_n -X PSW_OUTPUT 2>/dev/null
$ipt_m -F PSW 2>/dev/null && $ipt_m -X PSW 2>/dev/null
$ipt_m -F PSW_OUTPUT 2>/dev/null && $ipt_m -X PSW_OUTPUT 2>/dev/null
#$ip6t_n -F PSW 2>/dev/null && $ip6t_n -X PSW 2>/dev/null
#$ip6t_n -F PSW_OUTPUT 2>/dev/null && $ip6t_n -X PSW_OUTPUT 2>/dev/null
$ip6t_m -F PSW 2>/dev/null && $ip6t_m -X PSW 2>/dev/null
$ip6t_m -F PSW_OUTPUT 2>/dev/null && $ip6t_m -X PSW_OUTPUT 2>/dev/null
ip rule del fwmark 1 lookup 100 2>/dev/null ip rule del fwmark 1 lookup 100 2>/dev/null
ip route del local 0.0.0.0/0 dev lo table 100 2>/dev/null ip route del local 0.0.0.0/0 dev lo table 100 2>/dev/null
@ -828,23 +804,8 @@ del_firewall_rule() {
} }
flush_ipset() { flush_ipset() {
destroy_ipset $IPSET_LANIPLIST destroy_ipset $IPSET_LANIPLIST $IPSET_VPSIPLIST $IPSET_SHUNTLIST $IPSET_GFW $IPSET_CHN $IPSET_BLACKLIST $IPSET_BLOCKLIST $IPSET_WHITELIST
destroy_ipset $IPSET_VPSIPLIST destroy_ipset $IPSET_LANIPLIST6 $IPSET_VPSIPLIST6 $IPSET_SHUNTLIST6 $IPSET_GFW6 $IPSET_CHN6 $IPSET_BLACKLIST6 $IPSET_BLOCKLIST6 $IPSET_WHITELIST6
destroy_ipset $IPSET_SHUNTLIST
destroy_ipset $IPSET_GFW
destroy_ipset $IPSET_CHN
destroy_ipset $IPSET_BLACKLIST
destroy_ipset $IPSET_BLOCKLIST
destroy_ipset $IPSET_WHITELIST
destroy_ipset $IPSET_LANIPLIST6
destroy_ipset $IPSET_VPSIPLIST6
destroy_ipset $IPSET_SHUNTLIST6
destroy_ipset $IPSET_GFW6
destroy_ipset $IPSET_CHN6
destroy_ipset $IPSET_BLACKLIST6
destroy_ipset $IPSET_BLOCKLIST6
destroy_ipset $IPSET_WHITELIST6
/etc/init.d/passwall reload /etc/init.d/passwall reload
} }

View File

@ -8,6 +8,7 @@ require 'luci.model.uci'
require 'luci.util' require 'luci.util'
require 'luci.jsonc' require 'luci.jsonc'
require 'luci.sys' require 'luci.sys'
local datatypes = require "luci.cbi.datatypes"
local api = require "luci.model.cbi.passwall.api.api" local api = require "luci.model.cbi.passwall.api.api"
local has_xray = api.is_finded("xray") local has_xray = api.is_finded("xray")
@ -731,7 +732,7 @@ local function update_node(manual)
log("更新失败,没有可用的节点信息") log("更新失败,没有可用的节点信息")
return return
end end
-- delet all for subscribe nodes -- delete all for subscribe nodes
ucic2:foreach(application, uciType, function(node) ucic2:foreach(application, uciType, function(node)
-- 如果是手动导入的节点就不参与删除 -- 如果是手动导入的节点就不参与删除
if manual == 0 and (node.is_sub or node.hashkey) and node.add_mode ~= '导入' then if manual == 0 and (node.is_sub or node.hashkey) and node.add_mode ~= '导入' then
@ -785,8 +786,8 @@ local function update_node(manual)
]]-- ]]--
ucic2:commit(application) ucic2:commit(application)
--luci.sys.call("/etc/init.d/" .. application .. " restart > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早
end end
luci.sys.call("/etc/init.d/" .. application .. " restart > /dev/null 2>&1 &")
end end
local function parse_link(raw, remark, manual) local function parse_link(raw, remark, manual)
@ -848,9 +849,7 @@ local function parse_link(raw, remark, manual)
if (not manual and is_filter_keyword(result.remarks)) or if (not manual and is_filter_keyword(result.remarks)) or
not result.address or not result.address or
result.remarks == "NULL" or result.remarks == "NULL" or
result.address:match("[^0-9a-zA-Z%-%_%.%s]") or -- 中文做地址的 也没有人拿中文域名搞就算中文域也有Puny Code SB 机场 (not datatypes.hostname(result.address) and not (datatypes.ipmask4(result.address) or datatypes.ipmask6(result.address)))
not result.address:find("%.") or -- 虽然没有.也算域,不过应该没有人会这样干吧
result.address:sub(#result.address) == "." -- 结尾是.
then then
log('丢弃过滤节点: ' .. result.type .. ' 节点, ' .. result.remarks) log('丢弃过滤节点: ' .. result.type .. ' 节点, ' .. result.remarks)
else else

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gre PKG_NAME:=gre
PKG_RELEASE:=12 PKG_RELEASE:=13
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

@ -291,8 +291,6 @@ proto_grev6tap_init_config() {
} }
[ -n "$INCLUDE_ONLY" ] || { [ -n "$INCLUDE_ONLY" ] || {
[ -f /lib/modules/$(uname -r)/gre.ko ] && add_protocol gre [ -d /sys/module/ip_gre ] && { add_protocol gre; add_protocol gretap; }
[ -f /lib/modules/$(uname -r)/gre.ko ] && add_protocol gretap [ -d /sys/module/ip6_gre ] && { add_protocol grev6; add_protocol grev6tap; }
[ -f /lib/modules/$(uname -r)/ip6_gre.ko ] && add_protocol grev6
[ -f /lib/modules/$(uname -r)/ip6_gre.ko ] && add_protocol grev6tap
} }

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=vti PKG_NAME:=vti
PKG_RELEASE:=3 PKG_RELEASE:=4
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

@ -149,6 +149,6 @@ proto_vti6_init_config() {
} }
[ -n "$INCLUDE_ONLY" ] || { [ -n "$INCLUDE_ONLY" ] || {
[ -f /lib/modules/$(uname -r)/ip_vti.ko ] && add_protocol vti [ -d /sys/module/ip_vti ] && add_protocol vti
[ -f /lib/modules/$(uname -r)/ip6_vti.ko ] && add_protocol vti6 [ -d /sys/module/ip6_vti ] && add_protocol vti6
} }

View File

@ -2,7 +2,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=xfrm PKG_NAME:=xfrm
PKG_RELEASE:=3 PKG_RELEASE:=4
PKG_LICENSE:=GPL-2.0 PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

@ -68,5 +68,5 @@ proto_xfrm_init_config() {
[ -n "$INCLUDE_ONLY" ] || { [ -n "$INCLUDE_ONLY" ] || {
[ -f /lib/modules/$(uname -r)/xfrm_interface.ko -o -d /sys/module/xfrm_interface ] && add_protocol xfrm [ -d /sys/module/xfrm_interface ] && add_protocol xfrm
} }

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=busybox PKG_NAME:=busybox
PKG_VERSION:=1.33.0 PKG_VERSION:=1.33.0
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_FLAGS:=essential PKG_FLAGS:=essential
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2

View File

@ -0,0 +1,40 @@
From 67cc582d4289c5de521d11b08307c8ab26ee1e28 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Sun, 3 Jan 2021 10:55:39 +0100
Subject: ash: make a strdup copy of $HISTFILE for line editing
Otherwise if $HISTFILE is unset or reassigned, bad things can happen.
function old new delta
ash_main 1210 1218 +8
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
shell/ash.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index f16d7fb6a..ecbfbf091 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -14499,7 +14499,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
if (sflag || minusc == NULL) {
#if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
- if (iflag) {
+ if (line_input_state) {
const char *hp = lookupvar("HISTFILE");
if (!hp) {
hp = lookupvar("HOME");
@@ -14513,7 +14513,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
}
}
if (hp)
- line_input_state->hist_file = hp;
+ line_input_state->hist_file = xstrdup(hp);
# if ENABLE_FEATURE_SH_HISTFILESIZE
hp = lookupvar("HISTFILESIZE");
line_input_state->max_history = size_from_HISTFILESIZE(hp);
--
cgit v1.2.1

View File

@ -0,0 +1,26 @@
From 89358a7131d3e75c74af834bb117b4fad7914983 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Tue, 2 Feb 2021 13:48:21 +0100
Subject: traceroute: fix option parsing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
networking/traceroute.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 3f1a9ab46..29f5e480b 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -896,7 +896,7 @@ traceroute_init(int op, char **argv)
op |= getopt32(argv, "^"
OPT_STRING
- "\0" "-1:x-x" /* minimum 1 arg */
+ "\0" "-1" /* minimum 1 arg */
, &tos_str, &device, &max_ttl_str, &port_str, &nprobes_str
, &source, &waittime_str, &pausemsecs_str, &first_ttl_str
);
--
cgit v1.2.1

View File

@ -28,7 +28,7 @@ tools-y += mklibs mm-macros mtd-utils mtools padjffs2 patch-image patchelf
tools-y += pkg-config quilt squashfskit4 sstrip ucl upx xxd zip zlib zstd tools-y += pkg-config quilt squashfskit4 sstrip ucl upx xxd zip zlib zstd
tools-$(BUILD_B43_TOOLS) += b43-tools tools-$(BUILD_B43_TOOLS) += b43-tools
tools-$(BUILD_ISL) += isl tools-$(BUILD_ISL) += isl
tools-$(BUILD_TOOLCHAIN) += expat gmp libelf mpc mpfr tools-$(BUILD_TOOLCHAIN) += expat gmp mpc mpfr
tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs
tools-$(CONFIG_TARGET_ath79) += lzma-old squashfs tools-$(CONFIG_TARGET_ath79) += lzma-old squashfs
tools-$(CONFIG_TARGET_mxs) += elftosb sdimage tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
@ -55,7 +55,6 @@ $(curdir)/flex/compile := $(curdir)/libtool/compile
$(curdir)/gengetopt/compile := $(curdir)/libtool/compile $(curdir)/gengetopt/compile := $(curdir)/libtool/compile
$(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/gmp/compile := $(curdir)/libtool/compile
$(curdir)/isl/compile := $(curdir)/gmp/compile $(curdir)/isl/compile := $(curdir)/gmp/compile
$(curdir)/libelf/compile := $(curdir)/libtool/compile
$(curdir)/libressl/compile := $(curdir)/pkg-config/compile $(curdir)/libressl/compile := $(curdir)/pkg-config/compile
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile $(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile

View File

@ -1,58 +0,0 @@
#
# Copyright (C) 2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libelf
PKG_VERSION:=0.8.13
PKG_HASH:=591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:= \
http://distfiles.gentoo.org/distfiles/ \
http://distcache.freebsd.org/ports-distfiles/
HOST_BUILD_PARALLEL:=1
HOST_FIXUP:=autoreconf
include $(INCLUDE_DIR)/host-build.mk
PKG_REMOVE_FILES :=
HOST_CONFIGURE_ARGS += \
--disable-shared \
--enable-elf64
define Host/Configure
(cd $(HOST_BUILD_DIR)/$(3); \
$(HOST_CONFIGURE_CMD) \
$(HOST_CONFIGURE_ARGS); \
)
endef
define Host/Compile
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/lib/ libelf.a
endef
define Host/Install
$(INSTALL_DIR) $(STAGING_DIR_HOST)/{lib/pkgconfig,include/libelf}
$(CP) $(HOST_BUILD_DIR)/lib/{elf_repl.h,gelf.h,libelf.h,nlist.h,sys_elf.h} \
$(STAGING_DIR_HOST)/include/libelf/
$(CP) $(HOST_BUILD_DIR)/lib/libelf.a $(STAGING_DIR_HOST)/lib/
$(CP) $(HOST_BUILD_DIR)/libelf.pc $(STAGING_DIR_HOST)/lib/pkgconfig/
endef
define Host/Clean
rm -rf $(STAGING_DIR_HOST)/include/libelf
rm -f $(STAGING_DIR_HOST)/lib/libelf.a
rm -f $(STAGING_DIR_HOST)/lib/pkgconfig/libelf.pc
$(call Host/Clean/Default)
endef
$(eval $(call HostBuild))

View File

@ -1,198 +0,0 @@
--- a/lib/elf_repl.h
+++ b/lib/elf_repl.h
@@ -45,7 +45,7 @@ typedef __libelf_u32_t Elf32_Word;
#define ELF32_FSZ_SWORD 4
#define ELF32_FSZ_WORD 4
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef __libelf_u64_t Elf64_Addr;
typedef __libelf_u16_t Elf64_Half;
@@ -93,7 +93,7 @@ typedef struct {
Elf32_Half e_shstrndx;
} Elf32_Ehdr;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
unsigned char e_ident[EI_NIDENT];
Elf64_Half e_type;
@@ -307,7 +307,7 @@ typedef struct {
Elf32_Word sh_entsize;
} Elf32_Shdr;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf64_Word sh_name;
Elf64_Word sh_type;
@@ -434,7 +434,7 @@ typedef struct {
Elf32_Half st_shndx;
} Elf32_Sym;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf64_Word st_name;
unsigned char st_info;
@@ -457,7 +457,7 @@ typedef struct {
#define ELF32_ST_TYPE(i) ((i)&0xf)
#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
-#if __LIBELF64
+#if defined(__LIBELF64)
#define ELF64_ST_BIND(i) ((i)>>4)
#define ELF64_ST_TYPE(i) ((i)&0xf)
#define ELF64_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
@@ -495,7 +495,7 @@ typedef struct {
* Macros for manipulating st_other
*/
#define ELF32_ST_VISIBILITY(o) ((o)&0x3)
-#if __LIBELF64
+#if defined(__LIBELF64)
#define ELF64_ST_VISIBILITY(o) ((o)&0x3)
#endif /* __LIBELF64 */
@@ -521,7 +521,7 @@ typedef struct {
Elf32_Sword r_addend;
} Elf32_Rela;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf64_Addr r_offset;
Elf64_Xword r_info;
@@ -541,7 +541,7 @@ typedef struct {
#define ELF32_R_TYPE(i) ((unsigned char)(i))
#define ELF32_R_INFO(s,t) (((s)<<8)+(unsigned char)(t))
-#if __LIBELF64
+#if defined(__LIBELF64)
#define ELF64_R_SYM(i) ((Elf64_Xword)(i)>>32)
#define ELF64_R_TYPE(i) ((i)&0xffffffffL)
#define ELF64_R_INFO(s,t) (((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
@@ -556,7 +556,7 @@ typedef struct {
Elf32_Word n_type; /* descriptor type */
} Elf32_Nhdr;
-#if __LIBELF64
+#if defined(__LIBELF64)
/* Solaris and GNU use this layout. Be compatible. */
/* XXX: Latest ELF specs say it's 64-bit!!! */
typedef struct {
@@ -587,7 +587,7 @@ typedef struct {
Elf32_Word p_align;
} Elf32_Phdr;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf64_Word p_type;
Elf64_Word p_flags;
@@ -654,7 +654,7 @@ typedef struct {
} d_un;
} Elf32_Dyn;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf64_Sxword d_tag;
union {
@@ -798,7 +798,7 @@ typedef struct {
Elf32_Half si_flags;
} Elf32_Syminfo;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf64_Half si_boundto;
Elf64_Half si_flags;
@@ -863,7 +863,7 @@ typedef struct {
typedef Elf32_Half Elf32_Versym;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf64_Half vd_version;
@@ -933,7 +933,7 @@ typedef Elf64_Half Elf64_Versym;
/*
* Move section
*/
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf32_Lword m_value;
@@ -973,7 +973,7 @@ typedef struct {
} c_un;
} Elf32_Cap;
-#if __LIBELF64
+#if defined(__LIBELF64)
typedef struct {
Elf64_Xword c_tag;
--- a/lib/gelf.h
+++ b/lib/gelf.h
@@ -22,15 +22,15 @@
#ifndef _GELF_H
#define _GELF_H
-#if __LIBELF_INTERNAL__
+#if defined(__LIBELF_INTERNAL__)
#include <libelf.h>
#else /* __LIBELF_INTERNAL__ */
#include <libelf/libelf.h>
#endif /* __LIBELF_INTERNAL__ */
-#if __LIBELF_NEED_LINK_H
+#if defined(__LIBELF_NEED_LINK_H)
#include <link.h>
-#elif __LIBELF_NEED_SYS_LINK_H
+#elif defined(__LIBELF_NEED_SYS_LINK_H)
#include <sys/link.h>
#endif /* __LIBELF_NEED_LINK_H */
@@ -71,7 +71,7 @@ typedef Elf64_Sym GElf_Sym;
/*
* Symbol versioning
*/
-#if __LIBELF_SYMBOL_VERSIONS
+#if defined(__LIBELF_SYMBOL_VERSIONS)
typedef Elf64_Verdef GElf_Verdef;
typedef Elf64_Verneed GElf_Verneed;
typedef Elf64_Verdaux GElf_Verdaux;
--- a/lib/libelf.h
+++ b/lib/libelf.h
@@ -25,7 +25,7 @@
#include <stddef.h> /* for size_t */
#include <sys/types.h>
-#if __LIBELF_INTERNAL__
+#if defined(__LIBELF_INTERNAL__)
#include <sys_elf.h>
#else /* __LIBELF_INTERNAL__ */
#include <libelf/sys_elf.h>
@@ -224,7 +224,7 @@ extern Elf_Data *elf32_xlatetom __P((Elf
*/
extern long elf32_checksum __P((Elf *__elf));
-#if __LIBELF64
+#if defined(__LIBELF64)
/*
* 64-bit ELF functions
* Not available on all platforms
--- a/lib/sys_elf.h.in
+++ b/lib/sys_elf.h.in
@@ -116,7 +116,7 @@ Foundation, Inc., 51 Franklin Street, Fi
# define ELF64_R_INFO(s,t) (((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
# endif /* ELF64_R_SYM */
-# if __LIBELF64_LINUX
+# if defined(__LIBELF64_LINUX)
typedef __libelf_u64_t Elf64_Addr;
typedef __libelf_u16_t Elf64_Half;
typedef __libelf_u64_t Elf64_Off;