From ad464a0ca3d143a74679f86aa7bb0fbffab9db1c Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 16 Nov 2019 08:31:55 +0800 Subject: [PATCH] luci-app-passwall: update --- package/jsda/openwrt-redsocks2/README.md | 46 -- .../openwrt-redsocks2/files/redsocks2.config | 9 - .../openwrt-redsocks2/files/redsocks2.init | 78 --- .../files/redsocks2.template | 17 - package/lienol/luci-app-passwall/Makefile | 18 +- .../luasrc/controller/passwall.lua | 76 ++- .../api/gen_trojan_client_config_file.lua | 11 +- .../luasrc/model/cbi/passwall/global.lua | 26 +- .../luasrc/model/cbi/passwall/other.lua | 35 +- .../model/cbi/passwall/serverconfig.lua | 407 ++++++++------- .../luasrc/view/passwall/global/status.htm | 97 ++-- .../view/passwall/server_list/apply.htm | 24 +- .../view/passwall/server_list/server_list.htm | 6 +- .../luci-app-passwall/po/zh-cn/passwall.po | 14 +- .../root/etc/config/passwall | 11 +- .../root/etc/init.d/passwall | 0 .../root/etc/uci-defaults/luci-app-passwall | 0 .../root/usr/share/passwall/app.sh | 488 ++++++++++-------- .../root/usr/share/passwall/iptables.sh | 63 +-- .../root/usr/share/passwall/monitor.sh | 104 ++-- .../root/usr/share/passwall/rule_update.sh | 0 .../root/usr/share/passwall/subscription.sh | 6 +- .../root/usr/share/passwall/test.sh | 8 +- .../redsocks2}/Makefile | 33 +- .../lienol/redsocks2/files/redsocks2.template | 28 + 25 files changed, 864 insertions(+), 741 deletions(-) delete mode 100644 package/jsda/openwrt-redsocks2/README.md delete mode 100755 package/jsda/openwrt-redsocks2/files/redsocks2.config delete mode 100755 package/jsda/openwrt-redsocks2/files/redsocks2.init delete mode 100755 package/jsda/openwrt-redsocks2/files/redsocks2.template mode change 100755 => 100644 package/lienol/luci-app-passwall/root/etc/init.d/passwall mode change 100755 => 100644 package/lienol/luci-app-passwall/root/etc/uci-defaults/luci-app-passwall mode change 100755 => 100644 package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh mode change 100755 => 100644 package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh mode change 100755 => 100644 package/lienol/luci-app-passwall/root/usr/share/passwall/monitor.sh mode change 100755 => 100644 package/lienol/luci-app-passwall/root/usr/share/passwall/rule_update.sh mode change 100755 => 100644 package/lienol/luci-app-passwall/root/usr/share/passwall/subscription.sh mode change 100755 => 100644 package/lienol/luci-app-passwall/root/usr/share/passwall/test.sh rename package/{jsda/openwrt-redsocks2 => lienol/redsocks2}/Makefile (61%) create mode 100644 package/lienol/redsocks2/files/redsocks2.template diff --git a/package/jsda/openwrt-redsocks2/README.md b/package/jsda/openwrt-redsocks2/README.md deleted file mode 100644 index 32dbb9a3f2..0000000000 --- a/package/jsda/openwrt-redsocks2/README.md +++ /dev/null @@ -1,46 +0,0 @@ -RedSocks2 for OpenWrt -=== - -简介 ---- - - 本项目是 [RedSocks2][1] 在 OpenWrt 上的移植 - 当前版本: 0.60-2 - [预编译 IPK 下载][2] - -编译 ---- - - - 从 OpenWrt 的 [SDK][S] 编译 - - ```bash - # 以 ar71xx 平台为例 - tar xjf OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2 - cd OpenWrt-SDK-ar71xx-* - # 获取 Makefile - git clone https://github.com/aa65535/openwrt-redsocks2.git package/redsocks2 - # 选择要编译的包 Network -> redsocks2 - make menuconfig - # 开始编译 - make package/redsocks2/compile V=99 - ``` - ----------- - - Name | Description - -------------------------|----------------------------------- - [openwrt-chinadns][5] | ChinaDNS-C for OpenWrt - [openwrt-dnsmasq][6] | Dnsmasq Patch & Makefile for OpenWrt - [openwrt-shadowsocks][7] | Shadowsocks-libev for OpenWrt - [openwrt-shadowvpn][8] | ShadowVPN for OpenWrt - [openwrt-dist-luci][L] | LuCI Applications for OpenWrt-dist - - - [1]: https://github.com/semigodking/redsocks - [2]: http://sourceforge.net/projects/openwrt-dist/files/redsocks2/ - [5]: https://github.com/aa65535/openwrt-chinadns - [6]: https://github.com/aa65535/openwrt-dnsmasq - [7]: https://github.com/shadowsocks/openwrt-shadowsocks - [8]: https://github.com/aa65535/openwrt-shadowvpn - [S]: http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk - [L]: https://github.com/aa65535/openwrt-dist-luci diff --git a/package/jsda/openwrt-redsocks2/files/redsocks2.config b/package/jsda/openwrt-redsocks2/files/redsocks2.config deleted file mode 100755 index 9534ed66ef..0000000000 --- a/package/jsda/openwrt-redsocks2/files/redsocks2.config +++ /dev/null @@ -1,9 +0,0 @@ - -config redsocks2 - option enable '1' - option local_port '12345' - option proxy_type 'socks5' - option proxy_ip '127.0.0.1' - option proxy_port '1080' - option auto_proxy '1' - option timeout '5' diff --git a/package/jsda/openwrt-redsocks2/files/redsocks2.init b/package/jsda/openwrt-redsocks2/files/redsocks2.init deleted file mode 100755 index 1240504db3..0000000000 --- a/package/jsda/openwrt-redsocks2/files/redsocks2.init +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=90 -STOP=15 - -SERVICE_USE_PID=1 -SERVICE_WRITE_PID=1 -SERVICE_DAEMONIZE=1 - -CONFIG=/var/etc/redsocks2.conf -TPL=/etc/redsocks2/config.template - -get_args() { - config_get_bool enable $1 enable - config_get local_port $1 local_port - config_get proxy_type $1 proxy_type - config_get proxy_ip $1 proxy_ip - config_get proxy_port $1 proxy_port - config_get_bool auto_proxy $1 auto_proxy - config_get timeout $1 timeout -} - -start_redsocks2() { - mkdir -p $(dirname $CONFIG) - sed -e "s#|LOCAL_PORT|#$local_port#" \ - -e "s#|PROXY_TYPE|#$proxy_type#" \ - -e "s#|PROXY_IP|#$proxy_ip#" \ - -e "s#|PROXY_PORT|#$proxy_port#" \ - -e "s#|AUTO_PROXY|#$auto_proxy#" \ - -e "s#|TIMEOUT|#${timeout:-5}#" \ - $TPL >$CONFIG - service_start /usr/bin/redsocks2 -c $CONFIG || exit 1 - - iptables-restore -n <<-EOF - *nat - :REDSOCKS2 - [0:0] - -A REDSOCKS2 -d $proxy_ip -j RETURN - -A REDSOCKS2 -d 0.0.0.0/8 -j RETURN - -A REDSOCKS2 -d 10.0.0.0/8 -j RETURN - -A REDSOCKS2 -d 100.64.0.0/10 -j RETURN - -A REDSOCKS2 -d 127.0.0.0/8 -j RETURN - -A REDSOCKS2 -d 169.254.0.0/16 -j RETURN - -A REDSOCKS2 -d 172.16.0.0/12 -j RETURN - -A REDSOCKS2 -d 192.0.0.0/24 -j RETURN - -A REDSOCKS2 -d 192.0.2.0/24 -j RETURN - -A REDSOCKS2 -d 192.88.99.0/24 -j RETURN - -A REDSOCKS2 -d 192.168.0.0/16 -j RETURN - -A REDSOCKS2 -d 198.18.0.0/15 -j RETURN - -A REDSOCKS2 -d 198.51.100.0/24 -j RETURN - -A REDSOCKS2 -d 203.0.113.0/24 -j RETURN - -A REDSOCKS2 -d 224.0.0.0/4 -j RETURN - -A REDSOCKS2 -d 240.0.0.0/4 -j RETURN - -A REDSOCKS2 -d 255.255.255.255 -j RETURN - -A REDSOCKS2 -p tcp -j REDIRECT --to-ports $local_port - -A zone_lan_prerouting -p tcp -j REDSOCKS2 - COMMIT -EOF -} - -boot() { - until iptables-save -t nat | grep -q "^:zone_lan_prerouting"; do - sleep 1 - done - start -} - -start() { - config_load redsocks2 - config_foreach get_args redsocks2 - [ "$enable" = 1 ] && start_redsocks2 -} - -stop() { - service_stop /usr/bin/redsocks2 - iptables -t nat -D zone_lan_prerouting -p tcp -j REDSOCKS2 2>/dev/null - iptables -t nat -F REDSOCKS2 2>/dev/null && \ - iptables -t nat -X REDSOCKS2 -} diff --git a/package/jsda/openwrt-redsocks2/files/redsocks2.template b/package/jsda/openwrt-redsocks2/files/redsocks2.template deleted file mode 100755 index 9d9cc68a50..0000000000 --- a/package/jsda/openwrt-redsocks2/files/redsocks2.template +++ /dev/null @@ -1,17 +0,0 @@ -base { - log_debug = off; - log_info = off; - log = "file:/dev/null"; - daemon = off; - redirector = iptables; -} - -redsocks { - local_ip = 0.0.0.0; - local_port = |LOCAL_PORT|; - ip = |PROXY_IP|; - port = |PROXY_PORT|; - type = |PROXY_TYPE|; - autoproxy = |AUTO_PROXY|; - timeout = |TIMEOUT|; -} diff --git a/package/lienol/luci-app-passwall/Makefile b/package/lienol/luci-app-passwall/Makefile index 15c3cd92a2..b3b375da79 100644 --- a/package/lienol/luci-app-passwall/Makefile +++ b/package/lienol/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=2.0 -PKG_RELEASE:=90-20191103 +PKG_RELEASE:=99-20191114 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PO2LMO:=./po2lmo @@ -16,6 +16,10 @@ include $(INCLUDE_DIR)/package.mk define Package/$(PKG_NAME)/config menu "Configuration" + +config PACKAGE_$(PKG_NAME)_INCLUDE_redsocks2 + bool "Include RedSocks2" + default y config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks bool "Include Shadowsocks Redir (ss-redir)" @@ -35,6 +39,10 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_socks config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray bool "Include V2ray" + default y + +config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan + bool "Include Trojan" default n config PACKAGE_$(PKG_NAME)_INCLUDE_Brook @@ -47,7 +55,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_kcptun config PACKAGE_$(PKG_NAME)_INCLUDE_haproxy bool "Include haproxy" - default y + default n config PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS bool "Include ChinaDNS" @@ -69,17 +77,19 @@ endmenu endef define Package/$(PKG_NAME) - CATEGORY:=LuCI + CATEGORY:=LuCI for Lienol SUBMENU:=3. Applications - TITLE:=LuCI support for PassWall(fanqiang) By Lienol + TITLE:=LuCI support for PassWall By Lienol PKGARCH:=all DEPENDS:=+curl +libcurl +libmbedtls +ca-bundle +ca-certificates +resolveip +iptables-mod-tproxy +kmod-ipt-tproxy +iptables-mod-ipopt +kmod-ipt-ipopt +ip +ipset +coreutils +coreutils-base64 +coreutils-nohup +luci-lib-jsonc +unzip \ +dnsmasq-full \ + +PACKAGE_$(PKG_NAME)_INCLUDE_redsocks2:redsocks2 \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-alt \ +PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_socks:shadowsocks-libev-ss-local \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_socks:shadowsocksr-libev-ssr-local \ +PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan +redsocks2 \ +PACKAGE_$(PKG_NAME)_INCLUDE_Brook:brook \ +PACKAGE_$(PKG_NAME)_INCLUDE_kcptun:kcptun-client \ +PACKAGE_$(PKG_NAME)_INCLUDE_haproxy:haproxy \ diff --git a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua index c89dcdf492..83d24c4572 100644 --- a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua +++ b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua @@ -21,8 +21,8 @@ function index() _("Basic Settings"), 1).dependent = true entry({"admin", "vpn", "passwall", "server_list"}, cbi("passwall/server_list"), _("Server List"), 2).dependent = true - entry({"admin", "vpn", "passwall", "auto_switch"}, - cbi("passwall/auto_switch"), _("Auto Switch"), 3).leaf = true + -- entry({"admin", "vpn", "passwall", "auto_switch"}, + -- cbi("passwall/auto_switch"), _("Auto Switch"), 3).leaf = true entry({"admin", "vpn", "passwall", "other"}, cbi("passwall/other"), _("Other Settings"), 94).leaf = true if nixio.fs.access("/usr/sbin/haproxy") then @@ -106,27 +106,8 @@ end function clear_log() luci.sys.call("echo '' > /var/log/passwall.log") end function server_status() - local tcp_redir_port = luci.sys.exec( - "echo -n `uci get " .. appname .. - ".@global_proxy[0].tcp_redir_port`") - local udp_redir_port = luci.sys.exec( - "echo -n `uci get " .. appname .. - ".@global_proxy[0].udp_redir_port`") -- local dns_mode = luci.sys.exec("echo -n `uci get " .. appname .. ".@global[0].dns_mode`") local e = {} - e.tcp_redir_status = luci.sys.call("ps -w | grep -v grep | grep -i -E '" .. - appname .. - "/TCP|brook tproxy -l 0.0.0.0:" .. - tcp_redir_port .. "' >/dev/null") == - 0 - e.udp_redir_status = luci.sys.call("ps -w | grep -v grep | grep -i -E '" .. - appname .. - "/UDP|brook tproxy -l 0.0.0.0:" .. - udp_redir_port .. "' >/dev/null") == - 0 - e.socks5_proxy_status = luci.sys.call( - "ps -w | grep -v grep | grep -i -E '" .. appname .. - "/SOCKS5|brook client' >/dev/null") == 0 e.dns_mode_status = luci.sys.call("netstat -apn | grep 7913 >/dev/null") == 0 e.haproxy_status = luci.sys.call( @@ -135,6 +116,48 @@ function server_status() e.kcptun_status = luci.sys.call( "ps -w | grep -v grep | grep -i 'log /var/etc/" .. appname .. "/kcptun' >/dev/null") == 0 + + local tcp_redir_server_num = luci.sys.exec( + "echo -n `uci get %s.@global_other[0].tcp_redir_server_num`" % + appname) + for i = 1, tcp_redir_server_num, 1 do + local listen_port = luci.sys.exec( + string.format( + "[ -f '/var/etc/passwall/port/TCP_%s' ] && echo -n `cat /var/etc/passwall/port/TCP_%s`", + i, i)) + e["tcp_redir_server%s_status" % i] = + luci.sys.call(string.format( + "ps -w | grep -v grep | grep -i -E '%s/TCP_%s|brook tproxy -l 0.0.0.0:%s' >/dev/null", + appname, i, listen_port)) == 0 + end + + local udp_redir_server_num = luci.sys.exec( + "echo -n `uci get %s.@global_other[0].udp_redir_server_num`" % + appname) + for i = 1, udp_redir_server_num, 1 do + local listen_port = luci.sys.exec( + string.format( + "[ -f '/var/etc/passwall/port/UDP_%s' ] && echo -n `cat /var/etc/passwall/port/UDP_%s`", + i, i)) + e["udp_redir_server%s_status" % i] = + luci.sys.call(string.format( + "ps -w | grep -v grep | grep -i -E '%s/UDP_%s|brook tproxy -l 0.0.0.0:%s' >/dev/null", + appname, i, listen_port)) == 0 + end + + local socks5_proxy_server_num = luci.sys.exec( + "echo -n `uci get %s.@global_other[0].socks5_proxy_server_num`" % + appname) + for i = 1, socks5_proxy_server_num, 1 do + local listen_port = luci.sys.exec( + string.format( + "[ -f '/var/etc/passwall/port/Socks5_%s' ] && echo -n `cat /var/etc/passwall/port/Socks5_%s`", + i, i)) + e["socks5_proxy_server%s_status" % i] = + luci.sys.call(string.format( + "ps -w | grep -v grep | grep -i -E '%s/Socks5_%s|brook client -l 0.0.0.0:%s' >/dev/null", + appname, i, listen_port)) == 0 + end luci.http.prepare_content("application/json") luci.http.write_json(e) end @@ -177,15 +200,22 @@ end function set_server() local e = {} local protocol = luci.http.formvalue("protocol") + local number = luci.http.formvalue("number") local section = luci.http.formvalue("section") if protocol == "tcp" then luci.sys.call( - "uci set passwall.@global[0].tcp_redir_server=" .. section .. + "uci set passwall.@global[0].tcp_redir_server" .. number .. "=" .. + section .. " && uci commit passwall && /etc/init.d/passwall restart") elseif protocol == "udp" then luci.sys.call( - "uci set passwall.@global[0].udp_redir_server=" .. section .. + "uci set passwall.@global[0].udp_redir_server" .. number .. "=" .. + section .. " && uci commit passwall && /etc/init.d/passwall restart") + elseif protocol == "socks5" then + luci.sys.call("uci set passwall.@global[0].socks5_proxy_server" .. + number .. "=" .. section .. + " && uci commit passwall && /etc/init.d/passwall restart") end luci.http.prepare_content("application/json") luci.http.write_json(e) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua index 2987f5bb43..b0e644dc5a 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/gen_trojan_client_config_file.lua @@ -1,15 +1,14 @@ local ucursor = require"luci.model.uci".cursor() local json = require "luci.jsonc" local server_section = arg[1] -local proto = arg[2] -local redir_port = arg[3] -local socks5_proxy_port = arg[4] +local run_type = arg[2] +local proxy_port = arg[3] local server = ucursor:get_all("passwall", server_section) local trojan = { - run_type = "client", + run_type = run_type, local_addr = "0.0.0.0", - local_port = socks5_proxy_port, + local_port = proxy_port, remote_addr = server.server, remote_port = tonumber(server.server_port), password = {server.password}, @@ -28,7 +27,7 @@ local trojan = { tcp = { no_delay = true, keep_alive = true, - fast_open = false, + fast_open = (server.fast_open == "true") and true or false, fast_open_qlen = 20 } } diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua index 3c67054542..5678eaa808 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/global.lua @@ -43,7 +43,7 @@ s.anonymous = true s.addremove = false ---- TCP Redir Server -o = s:option(ListValue, "tcp_redir_server", translate("TCP Redir Server"), +o = s:option(ListValue, "tcp_redir_server1", translate("TCP Redir Server"), translate("For used to surf the Internet.")) o:value("nil", translate("Close")) for _, key in pairs(key_table) do o:value(key, n[key]) end @@ -61,7 +61,7 @@ end ---- UDP Redir Server if has_udp_relay() then - o = s:option(ListValue, "udp_redir_server", translate("UDP Redir Server"), + o = s:option(ListValue, "udp_redir_server1", translate("UDP Redir Server"), translate("For Game Mode or DNS resolution and more.") .. translate("The selected server will not use Kcptun.")) o:value("nil", translate("Close")) @@ -81,22 +81,32 @@ if has_udp_relay() then end ---- Socks5 Proxy Server -o = s:option(ListValue, "socks5_proxy_server", translate("Socks5 Proxy Server"), +o = s:option(ListValue, "socks5_proxy_server1", + translate("Socks5 Proxy Server"), translate("The client can use the router's Socks5 proxy")) o:value("nil", translate("Close")) for _, key in pairs(key_table) do o:value(key, n[key]) end +local socks5_proxy_server_num = uci:get(appname, "@global_other[0]", + "socks5_proxy_server_num") +if socks5_proxy_server_num and tonumber(socks5_proxy_server_num) >= 2 then + for i = 2, socks5_proxy_server_num, 1 do + o = s:option(ListValue, "socks5_proxy_server" .. i, + translate("Socks5 Proxy Server") .. " " .. i) + o:value("nil", translate("Close")) + for _, key in pairs(key_table) do o:value(key, n[key]) end + end +end + ---- DNS Forward Mode o = s:option(ListValue, "dns_mode", translate("DNS Forward Mode")) o.rmempty = false o:reset_values() -if is_installed("ChinaDNS") or is_finded("chinadns") then +if is_installed("openwrt_chinadns") or is_finded("chinadns") then o:value("chinadns", "ChinaDNS") end -if (is_installed("dns2socks") or is_finded("dns2socks")) and - (is_finded("ss-local") or is_finded("ssr-local")) then - o:value("dns2socks", - "dns2socks " .. translate("Only SS/R servers are supported")) +if is_installed("dns2socks") or is_finded("dns2socks") then + o:value("dns2socks", "dns2socks " .. translate("Need Socks5 server")) end if is_installed("pcap-dnsproxy") or is_finded("Pcap_DNSProxy") then o:value("Pcap_DNSProxy", "Pcap_DNSProxy") diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/other.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/other.lua index 91f294b599..7eab45ec6e 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/other.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/other.lua @@ -168,19 +168,20 @@ s.addremove = false ---- TCP Redir Port o = s:option(Value, "tcp_redir_port", translate("TCP Redir Port")) o.datatype = "port" -o.default = 1031 +o.default = 1041 o.rmempty = true ---- UDP Redir Port o = s:option(Value, "udp_redir_port", translate("UDP Redir Port")) o.datatype = "port" -o.default = 1032 +o.default = 1051 o.rmempty = true ---- Socks5 Proxy Port -o = s:option(Value, "socks5_port", translate("Socks5 Proxy Port")) +o = s:option(Value, "socks5_proxy_port", translate("Socks5 Proxy Port")) o.datatype = "port" -o.default = 1033 +o.default = 1061 +o.rmempty = true ---- Kcptun Port o = s:option(Value, "kcptun_port", translate("Kcptun Port")) @@ -200,8 +201,10 @@ s.addremove = false ---- TCP Servers Number Option o = s:option(ListValue, "tcp_redir_server_num", - translate("TCP Redir Server Number"), translate( - "You can only set up a maximum of 3 servers for the time being")) + translate("TCP Redir Server Number"), + translatef( + "You can only set up a maximum of %s servers for the time being", + "3")) o.default = "1" o.rmempty = false o:value("1") @@ -210,14 +213,30 @@ o:value("3") ---- UDP Servers Number Option o = s:option(ListValue, "udp_redir_server_num", - translate("UDP Redir Server Number"), translate( - "You can only set up a maximum of 3 servers for the time being")) + translate("UDP Redir Server Number"), + translatef( + "You can only set up a maximum of %s servers for the time being", + "3")) o.default = "1" o.rmempty = false o:value("1") o:value("2") o:value("3") +---- Socks5 Servers Number Option +o = s:option(ListValue, "socks5_proxy_server_num", + translate("Socks5 Proxy Server Number"), + translatef( + "You can only set up a maximum of %s servers for the time being", + "5")) +o.default = "1" +o.rmempty = false +o:value("1") +o:value("2") +o:value("3") +o:value("4") +o:value("5") + ---- Hide Menu o = s:option(Button, "hide", translate("Hide Menu"), translate( "After the hidden to the display, type in the address bar enter the admin/vpn/passwall/show, such as: http://192.168.1.1/cgi-bin/luci/admin/vpn/passwall/show")) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/serverconfig.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/serverconfig.lua index fd45573cbf..f50b7887d0 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/serverconfig.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/serverconfig.lua @@ -10,7 +10,7 @@ end local function is_installed(e) return ipkg.installed(e) end -local ss_encrypt_method = { +local ss_encrypt_method_list = { "rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "salsa20", "chacha20", @@ -19,7 +19,7 @@ local ss_encrypt_method = { "xchacha20-ietf-poly1305" } -local ssr_encrypt_method = { +local ssr_encrypt_method_list = { "none", "table", "rc2-cfb", "rc4", "rc4-md5", "rc4-md5-6", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", @@ -27,20 +27,20 @@ local ssr_encrypt_method = { "chacha20-ietf" } -local ssr_protocol = { +local ssr_protocol_list = { "origin", "verify_simple", "verify_deflate", "verify_sha1", "auth_simple", "auth_sha1", "auth_sha1_v2", "auth_sha1_v4", "auth_aes128_md5", "auth_aes128_sha1", "auth_chain_a", "auth_chain_b", "auth_chain_c", "auth_chain_d", "auth_chain_e", "auth_chain_f" } -local ssr_obfs = { +local ssr_obfs_list = { "plain", "http_simple", "http_post", "random_head", "tls_simple", "tls1.0_session_auth", "tls1.2_ticket_auth" } -local v2ray_security = {"none", "auto", "aes-128-gcm", "chacha20-poly1305"} +local v2ray_security_list = {"none", "auto", "aes-128-gcm", "chacha20-poly1305"} -local v2ray_header_type = { +local v2ray_header_type_list = { "none", "srtp", "utp", "wechat-video", "dtls", "wireguard" } @@ -53,252 +53,307 @@ s = m:section(NamedSection, arg[1], "servers", "") s.addremove = false s.dynamic = false -o = s:option(Value, "remarks", translate("Node Remarks")) -o.default = translate("Node Remarks") -o.rmempty = false +remarks = s:option(Value, "remarks", translate("Node Remarks")) +remarks.default = translate("Node Remarks") +remarks.rmempty = false -serverType = s:option(ListValue, "server_type", translate("Server Type")) +server_type = s:option(ListValue, "server_type", translate("Server Type")) +if is_installed("redsocks2") or is_finded("redsocks2") then + server_type:value("Socks5", translate("Socks5 Server")) +end if is_finded("ss-redir") then - serverType:value("SS", translate("Shadowsocks Server")) + server_type:value("SS", translate("Shadowsocks Server")) end if is_finded("ssr-redir") then - serverType:value("SSR", translate("ShadowsocksR Server")) + server_type:value("SSR", translate("ShadowsocksR Server")) end if is_installed("v2ray") then - serverType:value("V2ray", translate("V2ray Server")) + server_type:value("V2ray", translate("V2ray Server")) end if is_installed("brook") or is_finded("brook") then - serverType:value("Brook", translate("Brook Server")) + server_type:value("Brook", translate("Brook Server")) end if is_installed("trojan") or is_finded("trojan") then - serverType:value("Trojan", translate("Trojan Server")) + server_type:value("Trojan", translate("Trojan Server")) end -o = s:option(ListValue, "v2ray_protocol", translate("V2ray Protocol")) -o:value("vmess", translate("Vmess")) -o:depends("server_type", "V2ray") +v2ray_protocol = s:option(ListValue, "v2ray_protocol", + translate("V2ray Protocol")) +v2ray_protocol:value("vmess", translate("Vmess")) +v2ray_protocol:depends("server_type", "V2ray") -o.rmempty = false -o = s:option(Value, "server", translate("Server Address (Support Domain Name)")) -o.rmempty = false +server = s:option(Value, "server", + translate("Server Address (Support Domain Name)")) +server.rmempty = false -o = s:option(Flag, "use_ipv6", translate("Use IPv6")) -o.default = 0 +use_ipv6 = s:option(Flag, "use_ipv6", translate("Use IPv6")) +use_ipv6.default = 0 -o = s:option(Value, "server_port", translate("Server Port")) -o.datatype = "port" -o.rmempty = false +server_port = s:option(Value, "server_port", translate("Server Port")) +server_port.datatype = "port" +server_port.rmempty = false -o = s:option(Value, "password", translate("Password")) -o.password = true -o.rmempty = false -o:depends("server_type", "SS") -o:depends("server_type", "SSR") -o:depends("server_type", "Brook") -o:depends("server_type", "Trojan") +username = s:option(Value, "username", translate("Username")) +username:depends("server_type", "Socks5") -o = s:option(ListValue, "ss_encrypt_method", translate("Encrypt Method")) -for a, t in ipairs(ss_encrypt_method) do o:value(t) end -o:depends("server_type", "SS") +password = s:option(Value, "password", translate("Password")) +password.password = true +password:depends("server_type", "Socks5") +password:depends("server_type", "SS") +password:depends("server_type", "SSR") +password:depends("server_type", "Brook") +password:depends("server_type", "Trojan") -o = s:option(ListValue, "ssr_encrypt_method", translate("Encrypt Method")) -for a, t in ipairs(ssr_encrypt_method) do o:value(t) end -o:depends("server_type", "SSR") +ss_encrypt_method = s:option(ListValue, "ss_encrypt_method", + translate("Encrypt Method")) +for a, t in ipairs(ss_encrypt_method_list) do ss_encrypt_method:value(t) end +ss_encrypt_method:depends("server_type", "SS") -o = s:option(ListValue, "v2ray_security", translate("Encrypt Method")) -for a, t in ipairs(v2ray_security) do o:value(t) end -o:depends("server_type", "V2ray") +ssr_encrypt_method = s:option(ListValue, "ssr_encrypt_method", + translate("Encrypt Method")) +for a, t in ipairs(ssr_encrypt_method_list) do ssr_encrypt_method:value(t) end +ssr_encrypt_method:depends("server_type", "SSR") -o = s:option(ListValue, "protocol", translate("Protocol")) -for a, t in ipairs(ssr_protocol) do o:value(t) end -o:depends("server_type", "SSR") +v2ray_security = s:option(ListValue, "v2ray_security", + translate("Encrypt Method")) +for a, t in ipairs(v2ray_security_list) do v2ray_security:value(t) end +v2ray_security:depends("server_type", "V2ray") -o = s:option(Value, "protocol_param", translate("Protocol_param")) -o:depends("server_type", "SSR") +protocol = s:option(ListValue, "protocol", translate("Protocol")) +for a, t in ipairs(ssr_protocol_list) do protocol:value(t) end +protocol:depends("server_type", "SSR") -o = s:option(ListValue, "obfs", translate("Obfs")) -for a, t in ipairs(ssr_obfs) do o:value(t) end -o:depends("server_type", "SSR") +protocol_param = s:option(Value, "protocol_param", translate("Protocol_param")) +protocol_param:depends("server_type", "SSR") -o = s:option(Value, "obfs_param", translate("Obfs_param")) -o:depends("server_type", "SSR") +obfs = s:option(ListValue, "obfs", translate("Obfs")) +for a, t in ipairs(ssr_obfs_list) do obfs:value(t) end +obfs:depends("server_type", "SSR") -o = s:option(Value, "timeout", translate("Connection Timeout")) -o.datatype = "uinteger" -o.default = 300 -o.rmempty = false -o:depends("server_type", "SS") -o:depends("server_type", "SSR") +obfs_param = s:option(Value, "obfs_param", translate("Obfs_param")) +obfs_param:depends("server_type", "SSR") -o = s:option(ListValue, "fast_open", translate("Fast_open")) -o:value("false") -o:value("true") -o.rmempty = false -o:depends("server_type", "SS") -o:depends("server_type", "SSR") +timeout = s:option(Value, "timeout", translate("Connection Timeout")) +timeout.datatype = "uinteger" +timeout.default = 300 +timeout:depends("server_type", "SS") +timeout:depends("server_type", "SSR") -o = s:option(Flag, "use_kcp", translate("Use Kcptun"), - "" .. translate( - "Please confirm whether the Kcptun is installed. If not, please go to Rule Update download installation.") .. - "") -o.default = 0 -o:depends("server_type", "SS") -o:depends("server_type", "SSR") -o:depends("server_type", "Brook") +fast_open = s:option(ListValue, "fast_open", translate("Fast_open")) +fast_open:value("false") +fast_open:value("true") +fast_open:depends("server_type", "SS") +fast_open:depends("server_type", "SSR") +fast_open:depends("server_type", "Trojan") -o = s:option(Value, "kcp_server", translate("Kcptun Server")) -o.placeholder = translate("Default:Current Server") -o:depends("use_kcp", "1") +use_kcp = s:option(Flag, "use_kcp", translate("Use Kcptun"), + "" .. translate( + "Please confirm whether the Kcptun is installed. If not, please go to Rule Update download installation.") .. + "") +use_kcp.default = 0 +use_kcp:depends("server_type", "SS") +use_kcp:depends("server_type", "SSR") +use_kcp:depends("server_type", "Brook") -o = s:option(Flag, "kcp_use_ipv6", translate("Use IPv6")) -o.default = 0 -o:depends("use_kcp", "1") +kcp_server = s:option(Value, "kcp_server", translate("Kcptun Server")) +kcp_server.placeholder = translate("Default:Current Server") +kcp_server:depends("use_kcp", "1") -o = s:option(Value, "kcp_port", translate("Kcptun Port")) -o.datatype = "port" -o:depends("use_kcp", "1") +kcp_use_ipv6 = s:option(Flag, "kcp_use_ipv6", translate("Use IPv6")) +kcp_use_ipv6.default = 0 +kcp_use_ipv6:depends("use_kcp", "1") -o = s:option(TextValue, "kcp_opts", translate("Kcptun Config"), translate( - "--crypt aes192 --key abc123 --mtu 1350 --sndwnd 128 --rcvwnd 1024 --mode fast")) -o.placeholder = +kcp_port = s:option(Value, "kcp_port", translate("Kcptun Port")) +kcp_port.datatype = "port" +kcp_port:depends("use_kcp", "1") + +kcp_opts = s:option(TextValue, "kcp_opts", translate("Kcptun Config"), + translate( + "--crypt aes192 --key abc123 --mtu 1350 --sndwnd 128 --rcvwnd 1024 --mode fast")) +kcp_opts.placeholder = "--crypt aes192 --key abc123 --mtu 1350 --sndwnd 128 --rcvwnd 1024 --mode fast" -o:depends("use_kcp", "1") +kcp_opts:depends("use_kcp", "1") -o = s:option(Value, "v2ray_VMess_id", translate("ID")) -o.password = true -o.rmempty = false -o:depends("v2ray_protocol", "vmess") +v2ray_VMess_id = s:option(Value, "v2ray_VMess_id", translate("ID")) +v2ray_VMess_id.password = true +v2ray_VMess_id:depends("v2ray_protocol", "vmess") -o = s:option(Value, "v2ray_VMess_alterId", translate("Alter ID")) -o.rmempty = false -o:depends("v2ray_protocol", "vmess") +v2ray_VMess_alterId = s:option(Value, "v2ray_VMess_alterId", + translate("Alter ID")) +v2ray_VMess_alterId:depends("v2ray_protocol", "vmess") -o = s:option(Value, "v2ray_VMess_level", translate("User Level")) -o.default = 1 -o:depends("server_type", "V2ray") +v2ray_VMess_level = + s:option(Value, "v2ray_VMess_level", translate("User Level")) +v2ray_VMess_level.default = 1 +v2ray_VMess_level:depends("server_type", "V2ray") -o = s:option(ListValue, "v2ray_stream_security", - translate("Transport Layer Encryption"), translate( - 'Whether or not transport layer encryption is enabled, the supported options are "none" for unencrypted (default) and "TLS" for using TLS.')) -o:value("none", "none") -o:value("tls", "tls") -o:depends("server_type", "V2ray") +v2ray_stream_security = s:option(ListValue, "v2ray_stream_security", + translate("Transport Layer Encryption"), + translate( + 'Whether or not transport layer encryption is enabled, the supported options are "none" for unencrypted (default) and "TLS" for using TLS.')) +v2ray_stream_security:value("none", "none") +v2ray_stream_security:value("tls", "tls") +v2ray_stream_security:depends("server_type", "V2ray") -- [[ TLS部分 ]] -- -o = s:option(Value, "tls_serverName", translate("Domain")) -o:depends("v2ray_stream_security", "tls") +tls_serverName = s:option(Value, "tls_serverName", translate("Domain")) +tls_serverName:depends("v2ray_stream_security", "tls") -o = s:option(Flag, "tls_allowInsecure", translate("allowInsecure"), translate( - "Whether unsafe connections are allowed. When checked, V2Ray does not check the validity of the TLS certificate provided by the remote host.")) -o.default = "0" -o.rmempty = false -o:depends("v2ray_stream_security", "tls") +tls_allowInsecure = s:option(Flag, "tls_allowInsecure", + translate("allowInsecure"), translate( + "Whether unsafe connections are allowed. When checked, V2Ray does not check the validity of the TLS certificate provided by the remote host.")) +tls_allowInsecure.default = "0" +tls_allowInsecure.rmempty = false +tls_allowInsecure:depends("v2ray_stream_security", "tls") -o = s:option(ListValue, "v2ray_transport", translate("Transport")) -o:value("tcp", "TCP") -o:value("mkcp", "mKCP") -o:value("ws", "WebSocket") -o:value("h2", "HTTP/2") -o:value("ds", "DomainSocket") -o:value("quic", "QUIC") -o:depends("server_type", "V2ray") +v2ray_transport = s:option(ListValue, "v2ray_transport", translate("Transport")) +v2ray_transport:value("tcp", "TCP") +v2ray_transport:value("mkcp", "mKCP") +v2ray_transport:value("ws", "WebSocket") +v2ray_transport:value("h2", "HTTP/2") +v2ray_transport:value("ds", "DomainSocket") +v2ray_transport:value("quic", "QUIC") +v2ray_transport:depends("server_type", "V2ray") -- [[ TCP部分 ]]-- -- TCP伪装 -o = s:option(ListValue, "v2ray_tcp_guise", translate("Camouflage Type")) -o:depends("v2ray_transport", "tcp") -o:value("none", "none") -o:value("http", "http") +v2ray_tcp_guise = s:option(ListValue, "v2ray_tcp_guise", + translate("Camouflage Type")) +v2ray_tcp_guise:depends("v2ray_transport", "tcp") +v2ray_tcp_guise:value("none", "none") +v2ray_tcp_guise:value("http", "http") -- HTTP域名 -o = s:option(DynamicList, "v2ray_tcp_guise_http_host", translate("HTTP Host")) -o:depends("v2ray_tcp_guise", "http") +v2ray_tcp_guise_http_host = s:option(DynamicList, "v2ray_tcp_guise_http_host", + translate("HTTP Host")) +v2ray_tcp_guise_http_host:depends("v2ray_tcp_guise", "http") -- HTTP路径 -o = s:option(DynamicList, "v2ray_tcp_guise_http_path", translate("HTTP Path")) -o:depends("v2ray_tcp_guise", "http") +v2ray_tcp_guise_http_path = s:option(DynamicList, "v2ray_tcp_guise_http_path", + translate("HTTP Path")) +v2ray_tcp_guise_http_path:depends("v2ray_tcp_guise", "http") -- [[ mKCP部分 ]]-- -o = s:option(ListValue, "v2ray_mkcp_guise", translate("Camouflage Type"), - translate( - '
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) -for a, t in ipairs(v2ray_header_type) do o:value(t) end -o:depends("v2ray_transport", "mkcp") +v2ray_mkcp_guise = s:option(ListValue, "v2ray_mkcp_guise", + translate("Camouflage Type"), translate( + '
none: default, no masquerade, data sent is packets with no characteristics.
srtp: disguised as an SRTP packet, it will be recognized as video call data (such as FaceTime).
utp: packets disguised as uTP will be recognized as bittorrent downloaded data.
wechat-video: packets disguised as WeChat video calls.
dtls: disguised as DTLS 1.2 packet.
wireguard: disguised as a WireGuard packet. (not really WireGuard protocol)')) +for a, t in ipairs(v2ray_header_type_list) do v2ray_mkcp_guise:value(t) end +v2ray_mkcp_guise:depends("v2ray_transport", "mkcp") -o = s:option(Value, "v2ray_mkcp_mtu", translate("KCP MTU")) -o:depends("v2ray_transport", "mkcp") +v2ray_mkcp_mtu = s:option(Value, "v2ray_mkcp_mtu", translate("KCP MTU")) +v2ray_mkcp_mtu:depends("v2ray_transport", "mkcp") -o = s:option(Value, "v2ray_mkcp_tti", translate("KCP TTI")) -o:depends("v2ray_transport", "mkcp") +v2ray_mkcp_tti = s:option(Value, "v2ray_mkcp_tti", translate("KCP TTI")) +v2ray_mkcp_tti:depends("v2ray_transport", "mkcp") -o = - s:option(Value, "v2ray_mkcp_uplinkCapacity", translate("KCP uplinkCapacity")) -o:depends("v2ray_transport", "mkcp") +v2ray_mkcp_uplinkCapacity = s:option(Value, "v2ray_mkcp_uplinkCapacity", + translate("KCP uplinkCapacity")) +v2ray_mkcp_uplinkCapacity:depends("v2ray_transport", "mkcp") -o = s:option(Value, "v2ray_mkcp_downlinkCapacity", - translate("KCP downlinkCapacity")) -o:depends("v2ray_transport", "mkcp") +v2ray_mkcp_downlinkCapacity = s:option(Value, "v2ray_mkcp_downlinkCapacity", + translate("KCP downlinkCapacity")) +v2ray_mkcp_downlinkCapacity:depends("v2ray_transport", "mkcp") -o = s:option(Flag, "v2ray_mkcp_congestion", translate("KCP Congestion")) -o:depends("v2ray_transport", "mkcp") +v2ray_mkcp_congestion = s:option(Flag, "v2ray_mkcp_congestion", + translate("KCP Congestion")) +v2ray_mkcp_congestion:depends("v2ray_transport", "mkcp") -o = - s:option(Value, "v2ray_mkcp_readBufferSize", translate("KCP readBufferSize")) -o:depends("v2ray_transport", "mkcp") +v2ray_mkcp_readBufferSize = s:option(Value, "v2ray_mkcp_readBufferSize", + translate("KCP readBufferSize")) +v2ray_mkcp_readBufferSize:depends("v2ray_transport", "mkcp") -o = s:option(Value, "v2ray_mkcp_writeBufferSize", - translate("KCP writeBufferSize")) -o:depends("v2ray_transport", "mkcp") +v2ray_mkcp_writeBufferSize = s:option(Value, "v2ray_mkcp_writeBufferSize", + translate("KCP writeBufferSize")) +v2ray_mkcp_writeBufferSize:depends("v2ray_transport", "mkcp") -- [[ WebSocket部分 ]]-- -o = s:option(Value, "v2ray_ws_host", translate("WebSocket Host")) -o:depends("v2ray_transport", "ws") +v2ray_ws_host = s:option(Value, "v2ray_ws_host", translate("WebSocket Host")) +v2ray_ws_host:depends("v2ray_transport", "ws") -o = s:option(Value, "v2ray_ws_path", translate("WebSocket Path")) -o:depends("v2ray_transport", "ws") +v2ray_ws_path = s:option(Value, "v2ray_ws_path", translate("WebSocket Path")) +v2ray_ws_path:depends("v2ray_transport", "ws") -- [[ HTTP/2部分 ]]-- -o = s:option(DynamicList, "v2ray_h2_host", translate("HTTP/2 Host")) -o:depends("v2ray_transport", "h2") +v2ray_h2_host = s:option(DynamicList, "v2ray_h2_host", translate("HTTP/2 Host")) +v2ray_h2_host:depends("v2ray_transport", "h2") -o = s:option(Value, "v2ray_h2_path", translate("HTTP/2 Path")) -o:depends("v2ray_transport", "h2") +v2ray_h2_path = s:option(Value, "v2ray_h2_path", translate("HTTP/2 Path")) +v2ray_h2_path:depends("v2ray_transport", "h2") -- [[ DomainSocket部分 ]]-- -o = s:option(Value, "v2ray_ds_path", "Path", translate( - "A legal file path. This file must not exist before running V2Ray.")) -o:depends("v2ray_transport", "ds") +v2ray_ds_path = s:option(Value, "v2ray_ds_path", "Path", translate( + "A legal file path. This file must not exist before running V2Ray.")) +v2ray_ds_path:depends("v2ray_transport", "ds") -- [[ QUIC部分 ]]-- -o = s:option(ListValue, "v2ray_quic_security", translate("Encrypt Method")) -o:value("none") -o:value("aes-128-gcm") -o:value("chacha20-poly1305") -o:depends("v2ray_transport", "quic") +v2ray_quic_security = s:option(ListValue, "v2ray_quic_security", + translate("Encrypt Method")) +v2ray_quic_security:value("none") +v2ray_quic_security:value("aes-128-gcm") +v2ray_quic_security:value("chacha20-poly1305") +v2ray_quic_security:depends("v2ray_transport", "quic") -o = s:option(Value, "v2ray_quic_key", - translate("Encrypt Method") .. translate("Key")) -o:depends("v2ray_transport", "quic") +v2ray_quic_key = s:option(Value, "v2ray_quic_key", + translate("Encrypt Method") .. translate("Key")) +v2ray_quic_key:depends("v2ray_transport", "quic") -o = s:option(ListValue, "v2ray_quic_guise", translate("Camouflage Type")) -for a, t in ipairs(v2ray_header_type) do o:value(t) end -o:depends("v2ray_transport", "quic") +v2ray_quic_guise = s:option(ListValue, "v2ray_quic_guise", + translate("Camouflage Type")) +for a, t in ipairs(v2ray_header_type_list) do v2ray_quic_guise:value(t) end +v2ray_quic_guise:depends("v2ray_transport", "quic") -- [[ 其它 ]]-- -o = s:option(Flag, "v2ray_mux", translate("Mux")) -o:depends("server_type", "V2ray") +v2ray_mux = s:option(Flag, "v2ray_mux", translate("Mux")) +v2ray_mux:depends("server_type", "V2ray") -o = s:option(Value, "v2ray_mux_concurrency", translate("Mux Concurrency")) -o.default = 8 -o:depends("v2ray_mux", "1") +v2ray_mux_concurrency = s:option(Value, "v2ray_mux_concurrency", + translate("Mux Concurrency")) +v2ray_mux_concurrency.default = 8 +v2ray_mux_concurrency:depends("v2ray_mux", "1") --- o = s:option(Flag, "v2ray_insecure", translate("allowInsecure")) --- o:depends("server_type", "V2ray") +-- v2ray_insecure = s:option(Flag, "v2ray_insecure", translate("allowInsecure")) +-- v2ray_insecure:depends("server_type", "V2ray") + +function rmempty_restore() + password.rmempty = true + timeout.rmempty = true + fast_open.rmempty = true + v2ray_protocol.rmempty = true + v2ray_VMess_id.rmempty = true + v2ray_VMess_alterId.rmempty = true +end + +server_type.validate = function(self, value) + rmempty_restore() + if value == "SS" then + password.rmempty = false + timeout.rmempty = false + fast_open.rmempty = false + elseif value == "SSR" then + password.rmempty = false + timeout.rmempty = false + fast_open.rmempty = false + elseif value == "V2ray" then + v2ray_protocol.rmempty = false + v2ray_VMess_id.rmempty = false + v2ray_VMess_alterId.rmempty = false + elseif value == "Brook" then + password.rmempty = false + elseif value == "Trojan" then + password.rmempty = false + fast_open.rmempty = false + end + return value +end + +v2ray_transport.validate = function(self, value) + return value +end return m diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status.htm index bd8bc64533..25a10410fd 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/global/status.htm @@ -12,6 +12,10 @@ end local function has_udp_relay() return luci.sys.call("lsmod | grep TPROXY >/dev/null") == 0 end + +local tcp_redir_server_num = luci.sys.exec("echo -n `uci get passwall.@global_other[0].tcp_redir_server_num`") +local udp_redir_server_num = luci.sys.exec("echo -n `uci get passwall.@global_other[0].udp_redir_server_num`") +local socks5_proxy_num = luci.sys.exec("echo -n `uci get passwall.@global_other[0].socks5_proxy_server_num`") -%>