From 129ee3397d88597e9192a1bf7a89690f18fcbcaa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 22 Apr 2022 23:43:14 +0800 Subject: [PATCH] update 04-22 23:43:14 --- luci-app-passwall/Makefile | 2 +- .../model/cbi/passwall/client/other.lua | 45 +++++++++++-------- .../root/usr/share/passwall/iptables.sh | 6 ++- luci-app-passwall2/Makefile | 2 +- .../model/cbi/passwall2/api/gen_v2ray.lua | 21 +++++---- .../model/cbi/passwall2/client/other.lua | 42 +++++++++++------ luci-app-passwall2/po/zh-cn/passwall2.po | 6 +++ .../root/usr/share/passwall2/app.sh | 6 ++- .../root/usr/share/passwall2/iptables.sh | 2 + luci-app-socat/Makefile | 2 +- .../root/etc/init.d/{socat => luci_socat} | 0 .../root/etc/uci-defaults/luci-app-socat | 2 +- 12 files changed, 85 insertions(+), 51 deletions(-) rename luci-app-socat/root/etc/init.d/{socat => luci_socat} (100%) diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 2ec1d0459..c4ea5c424 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=4.53 -PKG_RELEASE:=7 +PKG_RELEASE:=8 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_Transparent_Proxy \ diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index 302051060..660d17478 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -1,6 +1,8 @@ local api = require "luci.model.cbi.passwall.api.api" local appname = api.appname local fs = api.fs +local has_v2ray = api.is_finded("v2ray") +local has_xray = api.is_finded("xray") m = Map(appname) @@ -128,25 +130,32 @@ o = s:option(Flag, "accept_icmpv6", translate("Hijacking ICMPv6 (IPv6 PING)")) o:depends("ipv6_tproxy", true) o.default = 0 -o = s:option(Flag, "sniffing", translate("Sniffing (V2Ray/Xray)"), translate("When using the V2ray/Xray shunt, must be enabled, otherwise the shunt will invalid.")) -o.default = 1 -o.rmempty = false +if has_v2ray or has_xray then + o = s:option(Flag, "sniffing", translate("Sniffing (V2Ray/Xray)"), translate("When using the V2ray/Xray shunt, must be enabled, otherwise the shunt will invalid.")) + o.default = 1 + o.rmempty = false -o = s:option(Flag, "route_only", translate("Sniffing Route Only (Xray)"), translate("When enabled, the server not will resolve the domain name again.")) -o.default = 0 -o:depends("sniffing", true) + if has_xray then + route_only = s:option(Flag, "route_only", translate("Sniffing Route Only (Xray)"), translate("When enabled, the server not will resolve the domain name again.")) + route_only.default = 0 + route_only:depends("sniffing", true) -o = s:option(Value, "buffer_size", translate("Buffer Size (Xray)"), translate("Buffer size for every connection (kB)")) -o.rmempty = true -o.datatype = "uinteger" - -local domains_excluded = string.format("/usr/share/%s/rules/domains_excluded", appname) -o = s:option(TextValue, "no_sniffing_hosts", translate("No Sniffing Lists"), translate("Hosts added into No Sniffing Lists will not resolve again on server (Xray only).")) -o.rows = 15 -o.wrap = "off" -o.cfgvalue = function(self, section) return fs.readfile(domains_excluded) or "" end -o.write = function(self, section, value) fs.writefile(domains_excluded, value:gsub("\r\n", "\n")) end -o.remove = function(self, section, value) fs.writefile(domains_excluded, "") end -o:depends({sniffing = true, route_only = false}) + local domains_excluded = string.format("/usr/share/%s/rules/domains_excluded", appname) + o = s:option(TextValue, "no_sniffing_hosts", translate("No Sniffing Lists"), translate("Hosts added into No Sniffing Lists will not resolve again on server (Xray only).")) + o.rows = 15 + o.wrap = "off" + o.cfgvalue = function(self, section) return fs.readfile(domains_excluded) or "" end + o.write = function(self, section, value) fs.writefile(domains_excluded, value:gsub("\r\n", "\n")) end + o.remove = function(self, section, value) + if route_only:formvalue(section) == "0" then + fs.writefile(domains_excluded, "") + end + end + o:depends({sniffing = true, route_only = false}) + o = s:option(Value, "buffer_size", translate("Buffer Size (Xray)"), translate("Buffer size for every connection (kB)")) + o.rmempty = true + o.datatype = "uinteger" + end +end return m diff --git a/luci-app-passwall/root/usr/share/passwall/iptables.sh b/luci-app-passwall/root/usr/share/passwall/iptables.sh index 05e53c627..45d0b0607 100755 --- a/luci-app-passwall/root/usr/share/passwall/iptables.sh +++ b/luci-app-passwall/root/usr/share/passwall/iptables.sh @@ -1182,14 +1182,16 @@ add_firewall_rule() { } fi + $ipt_m -A PSW -p udp --dport 53 -j RETURN + $ip6t_m -A PSW -p udp --dport 53 -j RETURN # 加载ACLS load_acl # dns_hijack "force" [ -n "${is_tproxy}" -o -n "${udp_flag}" ] && { - sysctl -w net.bridge.bridge-nf-call-iptables=0 2>/dev/null - [ "$PROXY_IPV6" == "1" ] && sysctl -w net.bridge.bridge-nf-call-ip6tables=0 2>/dev/null + sysctl -w net.bridge.bridge-nf-call-iptables=0 >/dev/null 2>&1 + [ "$PROXY_IPV6" == "1" ] && sysctl -w net.bridge.bridge-nf-call-ip6tables=0 >/dev/null 2>&1 } echolog "防火墙规则加载完成!" } diff --git a/luci-app-passwall2/Makefile b/luci-app-passwall2/Makefile index 47f558d4a..b64286963 100644 --- a/luci-app-passwall2/Makefile +++ b/luci-app-passwall2/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 PKG_VERSION:=1.3 -PKG_RELEASE:=18 +PKG_RELEASE:=20 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_Transparent_Proxy \ diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/api/gen_v2ray.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/api/gen_v2ray.lua index 0f8d36cda..f5f161ea5 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/api/gen_v2ray.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/api/gen_v2ray.lua @@ -8,6 +8,7 @@ local tcp_proxy_way = var["-tcp_proxy_way"] local redir_port = var["-redir_port"] local sniffing = var["-sniffing"] local route_only = var["-route_only"] +local buffer_size = var["-buffer_size"] local local_socks_address = var["-local_socks_address"] or "0.0.0.0" local local_socks_port = var["-local_socks_port"] local local_socks_username = var["-local_socks_username"] @@ -790,25 +791,23 @@ if inbounds or outbounds then -- 路由 routing = routing, -- 本地策略 - --[[ policy = { levels = { [0] = { - handshake = 4, - connIdle = 300, - uplinkOnly = 2, - downlinkOnly = 5, - bufferSize = 10240, + -- handshake = 4, + -- connIdle = 300, + -- uplinkOnly = 2, + -- downlinkOnly = 5, + bufferSize = buffer_size and tonumber(buffer_size) or nil, statsUserUplink = false, statsUserDownlink = false } }, - system = { - statsInboundUplink = false, - statsInboundDownlink = false - } + -- system = { + -- statsInboundUplink = false, + -- statsInboundDownlink = false + -- } } - ]]-- } table.insert(outbounds, { protocol = "freedom", diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/other.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/other.lua index 9c5946bd9..534034716 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/other.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/other.lua @@ -1,6 +1,8 @@ local api = require "luci.model.cbi.passwall2.api.api" local appname = api.appname local fs = api.fs +local has_v2ray = api.is_finded("v2ray") +local has_xray = api.is_finded("xray") m = Map(appname) @@ -114,21 +116,33 @@ o = s:option(Flag, "accept_icmpv6", translate("Hijacking ICMPv6 (IPv6 PING)")) o:depends("ipv6_tproxy", true) o.default = 0 -o = s:option(Flag, "sniffing", translate("Sniffing (V2Ray/Xray)"), translate("When using the V2ray/Xray shunt, must be enabled, otherwise the shunt will invalid.")) -o.default = 1 -o.rmempty = false +if has_v2ray or has_xray then + o = s:option(Flag, "sniffing", translate("Sniffing (V2Ray/Xray)"), translate("When using the V2ray/Xray shunt, must be enabled, otherwise the shunt will invalid.")) + o.default = 1 + o.rmempty = false -o = s:option(Flag, "route_only", translate("Sniffing Route Only (Xray)"), translate("When enabled, the server not will resolve the domain name again.")) -o.default = 0 -o:depends("sniffing", true) + if has_xray then + route_only = s:option(Flag, "route_only", translate("Sniffing Route Only (Xray)"), translate("When enabled, the server not will resolve the domain name again.")) + route_only.default = 0 + route_only:depends("sniffing", true) -local domains_excluded = string.format("/usr/share/%s/domains_excluded", appname) -o = s:option(TextValue, "no_sniffing_hosts", translate("No Sniffing Lists"), translate("Hosts added into No Sniffing Lists will not resolve again on server (Xray only).")) -o.rows = 15 -o.wrap = "off" -o.cfgvalue = function(self, section) return fs.readfile(domains_excluded) or "" end -o.write = function(self, section, value) fs.writefile(domains_excluded, value:gsub("\r\n", "\n")) end -o.remove = function(self, section, value) fs.writefile(domains_excluded, "") end -o:depends({sniffing = true, route_only = false}) + local domains_excluded = string.format("/usr/share/%s/domains_excluded", appname) + o = s:option(TextValue, "no_sniffing_hosts", translate("No Sniffing Lists"), translate("Hosts added into No Sniffing Lists will not resolve again on server (Xray only).")) + o.rows = 15 + o.wrap = "off" + o.cfgvalue = function(self, section) return fs.readfile(domains_excluded) or "" end + o.write = function(self, section, value) fs.writefile(domains_excluded, value:gsub("\r\n", "\n")) end + o.remove = function(self, section, value) + if route_only:formvalue(section) == "0" then + fs.writefile(domains_excluded, "") + end + end + o:depends({sniffing = true, route_only = false}) + + o = s:option(Value, "buffer_size", translate("Buffer Size (Xray)"), translate("Buffer size for every connection (kB)")) + o.rmempty = true + o.datatype = "uinteger" + end +end return m diff --git a/luci-app-passwall2/po/zh-cn/passwall2.po b/luci-app-passwall2/po/zh-cn/passwall2.po index 36ff69118..3bd3d1ec2 100644 --- a/luci-app-passwall2/po/zh-cn/passwall2.po +++ b/luci-app-passwall2/po/zh-cn/passwall2.po @@ -1143,3 +1143,9 @@ msgstr "不进行流量嗅探的域名列表" msgid "Hosts added into No Sniffing Lists will not resolve again on server (Xray only)." msgstr "加入的域名不会再次在服务器解析(仅适用于Xray)。" + +msgid "Buffer Size (Xray)" +msgstr "缓冲区大小(Xray)" + +msgid "Buffer size for every connection (kB)" +msgstr "每一个连接的缓冲区大小(kB)" diff --git a/luci-app-passwall2/root/usr/share/passwall2/app.sh b/luci-app-passwall2/root/usr/share/passwall2/app.sh index 35fd27377..038a2ec1d 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -300,6 +300,8 @@ run_v2ray() { local route_only=$(config_t_get global_forwarding route_only 0) [ "${route_only}" = "1" ] && _extra_param="${_extra_param} -route_only 1" } + local buffer_size=$(config_t_get global_forwarding buffer_size) + [ -n "${buffer_size}" ] && _extra_param="${_extra_param} -buffer_size ${buffer_size}" [ "$direct_dns_protocol" = "auto" ] && { direct_dns_protocol="udp" direct_dns_udp_server=${AUTO_DNS} @@ -749,8 +751,8 @@ start() { run_global source $APP_PATH/iptables.sh start source $APP_PATH/helper_dnsmasq.sh logic_restart - sysctl -w net.bridge.bridge-nf-call-iptables=0 2>/dev/null - [ "$PROXY_IPV6" == "1" ] && sysctl -w net.bridge.bridge-nf-call-ip6tables=0 2>/dev/null + sysctl -w net.bridge.bridge-nf-call-iptables=0 >/dev/null 2>&1 + [ "$PROXY_IPV6" == "1" ] && sysctl -w net.bridge.bridge-nf-call-ip6tables=0 >/dev/null 2>&1 fi } start_crontab diff --git a/luci-app-passwall2/root/usr/share/passwall2/iptables.sh b/luci-app-passwall2/root/usr/share/passwall2/iptables.sh index 13eda0071..ca7f67a60 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/iptables.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/iptables.sh @@ -816,6 +816,8 @@ add_firewall_rule() { fi fi + $ipt_m -A PSW2 -p udp --dport 53 -j RETURN + $ip6t_m -A PSW2 -p udp --dport 53 -j RETURN # 加载ACLS load_acl diff --git a/luci-app-socat/Makefile b/luci-app-socat/Makefile index 7d23d9eb2..1840ceccb 100644 --- a/luci-app-socat/Makefile +++ b/luci-app-socat/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-socat PKG_VERSION:=20200824 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_MAINTAINER:=Lienol diff --git a/luci-app-socat/root/etc/init.d/socat b/luci-app-socat/root/etc/init.d/luci_socat similarity index 100% rename from luci-app-socat/root/etc/init.d/socat rename to luci-app-socat/root/etc/init.d/luci_socat diff --git a/luci-app-socat/root/etc/uci-defaults/luci-app-socat b/luci-app-socat/root/etc/uci-defaults/luci-app-socat index 431f8756c..d5af4abb5 100755 --- a/luci-app-socat/root/etc/uci-defaults/luci-app-socat +++ b/luci-app-socat/root/etc/uci-defaults/luci-app-socat @@ -11,7 +11,7 @@ EOF uci -q batch <<-EOF >/dev/null delete ucitrack.@socat[-1] add ucitrack socat - set ucitrack.@socat[-1].init=socat + set ucitrack.@socat[-1].init=luci_socat commit ucitrack EOF