luci-app-passwall: sync with upstream source
This commit is contained in:
parent
f14b57538d
commit
5304a3ab2f
@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=3.3
|
||||
PKG_RELEASE:=25-20200114
|
||||
PKG_RELEASE:=26-20200115
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ local trojan = {
|
||||
tcp = {
|
||||
no_delay = true,
|
||||
keep_alive = true,
|
||||
reuse_port = false,
|
||||
reuse_port = false,
|
||||
fast_open = (node.tcp_fast_open == "true") and true or false,
|
||||
fast_open_qlen = 20
|
||||
}
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
local d = require "luci.dispatcher"
|
||||
local ipkg = require("luci.model.ipkg")
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
|
||||
local appname = "passwall"
|
||||
|
||||
local function get_customed_path(e)
|
||||
return luci.model.cbi.passwall.api.api.uci_get_type("global_app", e .. "_file")
|
||||
return api.uci_get_type("global_app", e .. "_file")
|
||||
end
|
||||
|
||||
local function is_finded(e)
|
||||
|
||||
@ -67,7 +67,7 @@ o:value("1:65535", translate("All"))
|
||||
o:value("53", "53")
|
||||
|
||||
---- Multi SS/SSR Process Option
|
||||
--[[ o = s:option(Value, "process", translate("Multi Process Option"),
|
||||
o = s:option(Value, "process", translate("Multi Process Option"),
|
||||
translate("you can start SS/SSR with multiple process"))
|
||||
o.default = "0"
|
||||
o.rmempty = false
|
||||
@ -76,7 +76,6 @@ o:value("1", translate("1 Process"))
|
||||
o:value("2", "2 " .. translate("Process"))
|
||||
o:value("3", "3 " .. translate("Process"))
|
||||
o:value("4", "4 " .. translate("Process"))
|
||||
--]]
|
||||
|
||||
-- [[ Proxy Settings ]]--
|
||||
s = m:section(TypedSection, "global_proxy", translate("Proxy Settings"))
|
||||
|
||||
@ -186,29 +186,29 @@ local status_show_ip111 = api.uci_get_type("global_other", "status_show_ip111",
|
||||
<% for i = 1, tcp_node_num, 1 do %>
|
||||
var tcp_node<%=i%>_status = document.getElementById('_tcp_node<%=i%>_status');
|
||||
if(tcp_node<%=i%>_status)
|
||||
tcp_node<%=i%>_status.innerHTML = json.tcp_node<%=i%>_status ? '<font color=green><%:RUNNING%> ✓</font>' : '<font color=red><%:NOT RUNNING%> X</font>';
|
||||
tcp_node<%=i%>_status.innerHTML = json.tcp_node<%=i%>_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if udp_node_num and tonumber(udp_node_num) >= 1 then %>
|
||||
<% for i = 1, udp_node_num, 1 do %>
|
||||
var udp_node<%=i%>_status = document.getElementById('_udp_node<%=i%>_status');
|
||||
if(udp_node<%=i%>_status)
|
||||
udp_node<%=i%>_status.innerHTML = json.udp_node<%=i%>_status ? '<font color=green><%:RUNNING%> ✓</font>' : '<font color=red><%:NOT RUNNING%> X</font>';
|
||||
udp_node<%=i%>_status.innerHTML = json.udp_node<%=i%>_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if socks5_node_num and tonumber(socks5_node_num) >= 1 then %>
|
||||
<% for i = 1, socks5_node_num, 1 do %>
|
||||
var socks5_node<%=i%>_status = document.getElementById('_socks5_node<%=i%>_status');
|
||||
if(socks5_node<%=i%>_status)
|
||||
socks5_node<%=i%>_status.innerHTML = json.socks5_node<%=i%>_status ? '<font color=green><%:RUNNING%> ✓</font>' : '<font color=red><%:NOT RUNNING%> X</font>';
|
||||
socks5_node<%=i%>_status.innerHTML = json.socks5_node<%=i%>_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
<% end %>
|
||||
<% end %>
|
||||
if(dns_mode_status)
|
||||
dns_mode_status.innerHTML = json.dns_mode_status ? '<font color=green><%:RUNNING%> ✓</font>' : '<font color=red><%:NOT RUNNING%> X</font>';
|
||||
dns_mode_status.innerHTML = json.dns_mode_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
if(haproxy_status)
|
||||
haproxy_status.innerHTML = json.haproxy_status ? '<font color=green><%:RUNNING%> ✓</font>' : '<font color=red><%:NOT RUNNING%> X</font>';
|
||||
haproxy_status.innerHTML = json.haproxy_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
if(kcptun_status)
|
||||
kcptun_status.innerHTML = json.kcptun_status ? '<font color=green><%:RUNNING%> ✓</font>' : '<font color=red><%:NOT RUNNING%> X</font>';
|
||||
kcptun_status.innerHTML = json.kcptun_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -227,10 +227,10 @@ msgid "Need Socks5 server"
|
||||
msgstr "需要Socks5"
|
||||
|
||||
msgid "Multi Process Option"
|
||||
msgstr "多进程并发转发"
|
||||
msgstr "多进程并发"
|
||||
|
||||
msgid "you can start SS/SSR with multiple process"
|
||||
msgstr "当使用SS/SSR时可使用多个进程并发转发"
|
||||
msgstr "当使用SS/SSR时可使用多进程并发"
|
||||
|
||||
msgid "Process"
|
||||
msgstr "进程"
|
||||
|
||||
@ -727,7 +727,7 @@ start_dns() {
|
||||
other_port=$(expr $DNS_PORT + 1)
|
||||
cat $RULE_PATH/gfwlist.conf | sort | uniq | sed -e '/127.0.0.1/d' | sed 's/ipset=\/.//g' | sed 's/\/gfwlist//g' > $CONFIG_PATH/gfwlist_chinadns_ng.txt
|
||||
[ -f "$CONFIG_PATH/gfwlist_chinadns_ng.txt" ] && local gfwlist_param="-g $CONFIG_PATH/gfwlist_chinadns_ng.txt"
|
||||
[ -f "$RULE_PATH/chnlist" ] && local chnlist_param="-m $RULE_PATH/chnlist -M"
|
||||
[ -f "$RULE_PATH/chnlist" ] && local chnlist_param="-m $RULE_PATH/chnlist"
|
||||
|
||||
up_trust_chinadns_ng_dns=$(config_t_get global up_trust_chinadns_ng_dns "8.8.4.4,8.8.8.8")
|
||||
if [ "$up_trust_chinadns_ng_dns" == "dns2socks" ]; then
|
||||
@ -772,33 +772,27 @@ add_dnsmasq() {
|
||||
subscribe_proxy=$(config_t_get global_subscribe subscribe_proxy 0)
|
||||
[ "$subscribe_proxy" -eq 1 ] && {
|
||||
config_foreach set_subscribe_proxy "subscribe_list"
|
||||
restdns=1
|
||||
}
|
||||
|
||||
if [ ! -f "$TMP_DNSMASQ_PATH/gfwlist.conf" -a "$DNS_MODE" != "nonuse" ]; then
|
||||
ln -s $RULE_PATH/gfwlist.conf $TMP_DNSMASQ_PATH/gfwlist.conf
|
||||
restdns=1
|
||||
fi
|
||||
|
||||
if [ ! -f "$TMP_DNSMASQ_PATH/blacklist_host.conf" -a "$DNS_MODE" != "nonuse" ]; then
|
||||
cat $RULE_PATH/blacklist_host | awk '{print "server=/."$1"/127.0.0.1#'$DNS_PORT'\nipset=/."$1"/blacklist"}' >>$TMP_DNSMASQ_PATH/blacklist_host.conf
|
||||
restdns=1
|
||||
fi
|
||||
|
||||
if [ ! -f "$TMP_DNSMASQ_PATH/whitelist_host.conf" ]; then
|
||||
cat $RULE_PATH/whitelist_host | sed "s/^/ipset=&\/./g" | sed "s/$/\/&whitelist/g" | sort | awk '{if ($0!=line) print;line=$0}' >$TMP_DNSMASQ_PATH/whitelist_host.conf
|
||||
restdns=1
|
||||
fi
|
||||
|
||||
if [ ! -f "$TMP_DNSMASQ_PATH/router.conf" -a "$DNS_MODE" != "nonuse" ]; then
|
||||
cat $RULE_PATH/router | awk '{print "server=/."$1"/127.0.0.1#'$DNS_PORT'\nipset=/."$1"/router"}' >>$TMP_DNSMASQ_PATH/router.conf
|
||||
restdns=1
|
||||
fi
|
||||
|
||||
userconf=$(grep -c "" $RULE_PATH/user.conf)
|
||||
if [ "$userconf" -gt 0 ]; then
|
||||
ln -s $RULE_PATH/user.conf $TMP_DNSMASQ_PATH/user.conf
|
||||
restdns=1
|
||||
fi
|
||||
|
||||
backhome=$(config_t_get global proxy_mode gfwlist)
|
||||
@ -806,27 +800,26 @@ add_dnsmasq() {
|
||||
rm -rf $TMP_DNSMASQ_PATH/gfwlist.conf
|
||||
rm -rf $TMP_DNSMASQ_PATH/blacklist_host.conf
|
||||
rm -rf $TMP_DNSMASQ_PATH/whitelist_host.conf
|
||||
restdns=1
|
||||
fi
|
||||
|
||||
echo "" > /etc/dnsmasq.conf
|
||||
server="server=127.0.0.1#$DNS_PORT"
|
||||
local china_dns1=$(echo $UP_CHINA_DNS | awk -F "," '{print $1}')
|
||||
local china_dns2=$(echo $UP_CHINA_DNS | awk -F "," '{print $2}')
|
||||
[ -n "$china_dns1" ] && server="server=$china_dns1"
|
||||
[ -n "$china_dns2" ] && server="${server}\n${server_2}"
|
||||
[ "$DNS_MODE" != "chinadns-ng" ] && {
|
||||
local china_dns1=$(echo $UP_CHINA_DNS | awk -F "," '{print $1}')
|
||||
local china_dns2=$(echo $UP_CHINA_DNS | awk -F "," '{print $2}')
|
||||
[ -n "$china_dns1" ] && server="server=$china_dns1"
|
||||
[ -n "$china_dns2" ] && server="${server}\n${server_2}"
|
||||
server="${server}\nno-resolv"
|
||||
}
|
||||
cat <<-EOF > /var/dnsmasq.d/dnsmasq-$CONFIG.conf
|
||||
$(echo -e $server)
|
||||
all-servers
|
||||
no-poll
|
||||
no-resolv
|
||||
conf-dir=$TMP_DNSMASQ_PATH
|
||||
EOF
|
||||
cp -rf /var/dnsmasq.d/dnsmasq-$CONFIG.conf $DNSMASQ_PATH/dnsmasq-$CONFIG.conf
|
||||
if [ "$restdns" == 1 ]; then
|
||||
echolog "dnsmasq:生成配置文件并重启服务。"
|
||||
/etc/init.d/dnsmasq restart 2>/dev/null
|
||||
fi
|
||||
echolog "dnsmasq:生成配置文件并重启服务。"
|
||||
/etc/init.d/dnsmasq restart 2>/dev/null
|
||||
}
|
||||
|
||||
gen_redsocks_config() {
|
||||
|
||||
@ -302,25 +302,25 @@ add_firewall_rule() {
|
||||
if [ "$TCP_NODE_TYPE" == "brook" ]; then
|
||||
$iptables_mangle -A PSW_ACL -p tcp -m socket -j MARK --set-mark 1
|
||||
|
||||
# $iptables_mangle -A PSW$k -p tcp $(get_dst_list $IPSET_BLACKLIST) -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
# $iptables_mangle -A PSW$k -p tcp $(get_dst_list $IPSET_BLACKLIST) -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
# 全局模式
|
||||
$iptables_mangle -A PSW_GLO$k -p tcp -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# GFWLIST模式
|
||||
$iptables_mangle -A PSW_GFW$k -p tcp $(get_dst_list $IPSET_GFW) -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_GFW$k -p tcp $(get_dst_list $IPSET_GFW) -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# 大陆白名单模式
|
||||
$iptables_mangle -A PSW_CHN$k -p tcp $(get_dst_list $IPSET_CHN) -j RETURN
|
||||
$iptables_mangle -A PSW_CHN$k -p tcp -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_CHN$k -p tcp -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# 回国模式
|
||||
$iptables_mangle -A PSW_HOME$k -p tcp $(get_dst_list $IPSET_CHN) -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_HOME$k -p tcp $(get_dst_list $IPSET_CHN) -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# 游戏模式
|
||||
$iptables_mangle -A PSW_GAME$k -p tcp $(get_dst_list $IPSET_CHN) -j RETURN
|
||||
|
||||
# 用于本机流量转发,默认只走router
|
||||
$iptables_mangle -A PSW -s $lan_ip -p tcp $(get_dst_list $IPSET_ROUTER) -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW -s $lan_ip -p tcp $(get_dst_list $IPSET_ROUTER) -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
$iptables_mangle -A OUTPUT -p tcp -m multiport --dport $TCP_REDIR_PORTS $(get_dst_list $IPSET_ROUTER) $iptables_comment -j MARK --set-mark 1
|
||||
else
|
||||
# 全局模式
|
||||
@ -434,31 +434,30 @@ add_firewall_rule() {
|
||||
[ -n "$UDP_NODE_IP" -a -n "$UDP_NODE_PORT" ] && $iptables_mangle -A PSW -p udp -d $UDP_NODE_IP -m multiport --dports $UDP_NODE_PORT -j RETURN
|
||||
[ "$UDP_NODE_TYPE" == "brook" ] && $iptables_mangle -A PSW_ACL -p udp -m socket -j MARK --set-mark 1
|
||||
# 全局模式
|
||||
$iptables_mangle -A PSW_GLO$k -p udp -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_GLO$k -p udp -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# GFWLIST模式
|
||||
$iptables_mangle -A PSW_GFW$k -p udp $(get_dst_list $IPSET_ROUTER) -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_GFW$k -p udp $(get_dst_list $IPSET_GFW) -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_GFW$k -p udp $(get_dst_list $IPSET_ROUTER) -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
$iptables_mangle -A PSW_GFW$k -p udp $(get_dst_list $IPSET_GFW) -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# 大陆白名单模式
|
||||
$iptables_mangle -A PSW_CHN$k -p udp $(get_dst_list $IPSET_CHN) -j RETURN
|
||||
$iptables_mangle -A PSW_CHN$k -p udp -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_CHN$k -p udp -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# 回国模式
|
||||
$iptables_mangle -A PSW_HOME$k -p udp $(get_dst_list $IPSET_CHN) -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_HOME$k -p udp $(get_dst_list $IPSET_CHN) -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# 游戏模式
|
||||
$iptables_mangle -A PSW_GAME$k -p udp $(get_dst_list $IPSET_CHN) -j RETURN
|
||||
$iptables_mangle -A PSW_GAME$k -p udp -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A PSW_GAME$k -p udp -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
|
||||
# 用于本机流量转发,默认只走router
|
||||
#$iptables_mangle -I OUTPUT -j PSW
|
||||
$iptables_mangle -A OUTPUT -p udp $(get_dst_list $IPSET_LANIPLIST) $iptables_comment -j RETURN
|
||||
[ "$use_udp_node_resolve_dns" == 1 -a -n "$DNS_FORWARD" ] && {
|
||||
for dns in $DNS_FORWARD
|
||||
do
|
||||
$iptables_mangle -A OUTPUT -p udp -d $dns -m multiport --dport 1:65535 $iptables_comment -j MARK --set-mark 1
|
||||
$iptables_mangle -I PSW 2 -p udp -d $dns -m multiport --dport 1:65535 $iptables_comment -j TPROXY --on-port $local_port --tproxy-mark 0x1/0x1
|
||||
$iptables_mangle -A OUTPUT -p udp -d $dns $iptables_comment -j MARK --set-mark 1
|
||||
$iptables_mangle -I PSW 2 -p udp -d $dns $iptables_comment -j TPROXY --tproxy-mark 0x1/0x1 --on-port $local_port
|
||||
done
|
||||
}
|
||||
$iptables_mangle -A OUTPUT -p udp $(get_dst_list $IPSET_VPSIPLIST) $iptables_comment -j RETURN
|
||||
|
||||
Loading…
Reference in New Issue
Block a user