diff --git a/luci-app-ssr-plus/Makefile b/luci-app-ssr-plus/Makefile index 0c9056e83..5432cd512 100644 --- a/luci-app-ssr-plus/Makefile +++ b/luci-app-ssr-plus/Makefile @@ -2,10 +2,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=186 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \ + CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \ @@ -28,6 +29,7 @@ LUCI_DEPENDS:= \ +ip-full +iptables +iptables-mod-tproxy +lua +libuci-lua +microsocks +tcping \ +resolveip +shadowsocksr-libev-ssr-check +uclient-fetch \ +PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria:hysteria \ +PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \ +PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \ +PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \ @@ -52,6 +54,10 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun bool "Include Kcptun" default n +config PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria + bool "Include Hysteria" + default n + config PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks bool "Include ipt2socks" default n diff --git a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua index 8ceb48ceb..ce90e3b0d 100644 --- a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua +++ b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua @@ -157,6 +157,9 @@ end if is_finded("naive") then o:value("naiveproxy", translate("NaiveProxy")) end +if is_finded("hysteria") then + o:value("hysteria", translate("Hysteria")) +end if is_finded("ipt2socks") then o:value("socks5", translate("Socks5")) end @@ -197,6 +200,7 @@ o:depends("type", "ss") o:depends("type", "v2ray") o:depends("type", "trojan") o:depends("type", "naiveproxy") +o:depends("type", "hysteria") o:depends("type", "socks5") o = s:option(Value, "server_port", translate("Server Port")) @@ -207,6 +211,7 @@ o:depends("type", "ss") o:depends("type", "v2ray") o:depends("type", "trojan") o:depends("type", "naiveproxy") +o:depends("type", "hysteria") o:depends("type", "socks5") o = s:option(Flag, "auth_enable", translate("Enable Authentication")) @@ -290,7 +295,7 @@ end o.rmempty = true o:depends("type", "ssr") -o = s:option(Value, "protocol_param", translate("Protocol param(optional)")) +o = s:option(Value, "protocol_param", translate("Protocol param (optional)")) o:depends("type", "ssr") o = s:option(ListValue, "obfs", translate("Obfs")) @@ -300,9 +305,44 @@ end o.rmempty = true o:depends("type", "ssr") -o = s:option(Value, "obfs_param", translate("Obfs param(optional)")) +o = s:option(Value, "obfs_param", translate("Obfs param (optional)")) o:depends("type", "ssr") +-- [[ Hysteria ]]-- +o = s:option(ListValue, "hysteria_protocol", translate("Protocol")) +o:depends("type", "hysteria") +o:value("udp", translate("udp")) +o:value("wechat-video", translate("wechat-video")) +o:value("faketcp", translate("faketcp")) +o.default = "udp" +o.rmempty = true + +o = s:option(ListValue, "auth_type", translate("Authentication type")) +o:depends("type", "hysteria") +o:value("0", translate("disabled")) +o:value("1", translate("base64")) +o:value("2", translate("string")) +o.rmempty = true + +o = s:option(Value, "auth_payload", translate("Authentication payload")) +o:depends({type = "hysteria", auth_type = "1"}) +o:depends({type = "hysteria", auth_type = "2"}) +o.rmempty = true + +o = s:option(Value, "recv_window", translate("QUIC connection receive window")) +o.datatype = "uinteger" +o:depends("type", "hysteria") +o.rmempty = true + +o = s:option(Value, "recv_window_conn", translate("QUIC stream receive window")) +o.datatype = "uinteger" +o:depends("type", "hysteria") +o.rmempty = true + +o = s:option(Flag, "disable_mtu_discovery", translate("Disable Path MTU discovery")) +o:depends("type", "hysteria") +o.rmempty = true + -- VmessId o = s:option(Value, "vmess_id", translate("Vmess/VLESS ID (UUID)")) o.rmempty = true @@ -471,12 +511,14 @@ o.rmempty = true o = s:option(Value, "uplink_capacity", translate("Uplink Capacity")) o.datatype = "uinteger" o:depends("transport", "kcp") +o:depends("type", "hysteria") o.default = 5 o.rmempty = true o = s:option(Value, "downlink_capacity", translate("Downlink Capacity")) o.datatype = "uinteger" o:depends("transport", "kcp") +o:depends("type", "hysteria") o.default = 20 o.rmempty = true @@ -494,6 +536,7 @@ o.rmempty = true o = s:option(Value, "seed", translate("Obfuscate password (optional)")) o:depends({v2ray_protocol = "vless", transport = "kcp"}) +o:depends("type", "hysteria") o.rmempty = true o = s:option(Flag, "congestion", translate("Congestion")) @@ -570,6 +613,11 @@ o = s:option(Value, "tls_host", translate("TLS Host")) o.datatype = "hostname" o:depends("tls", true) o:depends("xtls", true) +o:depends("type", "hysteria") +o.rmempty = true + +o = s:option(Value, "quic_tls_alpn", translate("QUIC TLS ALPN")) +o:depends("type", "hysteria") o.rmempty = true -- [[ allowInsecure ]]-- @@ -577,6 +625,7 @@ o = s:option(Flag, "insecure", translate("allowInsecure")) o.rmempty = false o:depends("tls", true) o:depends("xtls", true) +o:depends("type", "hysteria") o.description = translate("If true, allowss insecure connection at TLS client, e.g., TLS server uses unverifiable certificates.") -- [[ Mux ]]-- @@ -600,6 +649,7 @@ o:depends("type", "naiveproxy") o = s:option(Flag, "certificate", translate("Self-signed Certificate")) o.rmempty = true o.default = "0" +o:depends({type = "hysteria", insecure = false}) o:depends({type = "trojan", tls = true, insecure = false}) o:depends({type = "v2ray", v2ray_protocol = "vmess", tls = true, insecure = false}) o:depends({type = "v2ray", v2ray_protocol = "vless", tls = true, insecure = false}) diff --git a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po b/luci-app-ssr-plus/po/zh-cn/ssr-plus.po index ddda4126a..678dc78ff 100644 --- a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po +++ b/luci-app-ssr-plus/po/zh-cn/ssr-plus.po @@ -79,6 +79,9 @@ msgstr "传输协议" msgid "Protocol" msgstr "传输协议" +msgid "TLS Host" +msgstr "TLS 主机名" + msgid "allowInsecure" msgstr "允许不安全连接" @@ -88,15 +91,30 @@ msgstr "最大并发连接数" msgid "If true, allowss insecure connection at TLS client, e.g., TLS server uses unverifiable certificates." msgstr "是否允许不安全连接。当选择时,将不会检查远端主机所提供的 TLS 证书的有效性。" -msgid "Protocol param(optional)" +msgid "Protocol param (optional)" msgstr "传输协议参数(可选)" msgid "Obfs" msgstr "混淆插件" -msgid "Obfs param(optional)" +msgid "Obfs param (optional)" msgstr "混淆参数(可选)" +msgid "Authentication type" +msgstr "验证类型" + +msgid "Authentication payload" +msgstr "验证载荷" + +msgid "QUIC connection receive window" +msgstr "QUIC 连接接收窗口" + +msgid "QUIC stream receive window" +msgstr "QUIC 流接收窗口" + +msgid "Disable Path MTU discovery" +msgstr "禁用 MTU 探测" + msgid "Enable Tunnel(DNS)" msgstr "启用隧道(DNS)转发" diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 3d80807b2..a08bdbae6 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -297,6 +297,9 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5 ;; esac ;; + hysteria) + lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 $5 >$config_file + ;; socks5) /usr/share/shadowsocksr/genred2config.sh $config_file $2 $mode $4 \ "$(uci_get_by_name $1 server)" \ @@ -338,6 +341,11 @@ start_udp() { redir_udp=0 ARG_UDP="" ;; + hysteria) + gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port + ln_start_bin $(first_type hysteria) hysteria client --config $udp_config_file + echolog "UDP TPROXY Relay:$($(first_type "hysteria") --version | awk '{print $1,$3}') Started!" + ;; socks5) # if [ "$(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0)" == "1" ]; then # local auth="-a $(uci_get_by_name $UDP_RELAY_SERVER username) -k $(uci_get_by_name $UDP_RELAY_SERVER password)" @@ -403,6 +411,18 @@ start_shunt() { echolog "shunt:$($(first_type "naive") --version 2>&1 | head -1) Started!" redir_udp=0 ;; + hysteria) + if [ -n "$tmp_local_port" ]; then + local tmp_port=$tmp_local_port + gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port + else + local tmp_port=$tmp_shunt_local_port + gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port $tmp_port + fi + ln_start_bin $(first_type hysteria) hysteria client --config $shunt_config_file + 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:$($(first_type hysteria) --version | awk '{print $1,$3}') Started!" + ;; # socks5) # if [ "$(uci_get_by_name $SHUNT_SERVER auth_enable 0)" == "1" ]; then # local auth="-a $(uci_get_by_name $SHUNT_SERVER username) -k $(uci_get_by_name $SHUNT_SERVER password)" @@ -464,6 +484,13 @@ start_local() { ln_start_bin $(first_type naive) naive --config $local_config_file echolog "Global_Socks5:$($(first_type $type) --version | head -1) Started!" ;; + hysteria) + if [ "$_local" == "2" ]; then + gen_config_file $LOCAL_SERVER $type 4 0 $local_port + ln_start_bin $(first_type hysteria) hysteria client --config $local_config_file + echolog "Global_Socks5:$($(first_type hysteria) --version | awk '{print $1,$3}') Started!" + fi + ;; *) [ -e /proc/sys/net/ipv6 ] && local listenip='-i ::' ln_start_bin $(first_type microsocks) microsocks $listenip -p $local_port tcp-udp-ssr-local @@ -527,6 +554,11 @@ Start_Run() { ln_start_bin $(first_type naive) naive $tcp_config_file echolog "Main node:$($(first_type naive) --version 2>&1 | head -1) , $threads Threads Started!" ;; + hysteria) + gen_config_file $GLOBAL_SERVER $type 1 $tcp_port $socks_port + ln_start_bin $(first_type hysteria) hysteria client --config $tcp_config_file + echolog "Main node:$($(first_type hysteria) --version | awk '{print $1,$3}') Started!" + ;; socks5) if [ "$(uci_get_by_name $GLOBAL_SERVER auth_enable 0)" == "1" ]; then local auth="-a $(uci_get_by_name $GLOBAL_SERVER username) -k $(uci_get_by_name $GLOBAL_SERVER password)" diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua index 131187b53..03869a844 100755 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua @@ -265,6 +265,35 @@ local ss = { fast_open = (server.fast_open == "1") and true or false, reuse_port = true } +local hysteria = { + server = server.server .. ":" .. server.server_port, + protocol = server.hysteria_protocol, + up_mbps = tonumber(server.uplink_capacity), + down_mbps = tonumber(server.downlink_capacity), + socks5 = (proto:find("tcp") and tonumber(socks_port) and tonumber(socks_port) ~= "0") and { + listen = "0.0.0.0:" .. tonumber(socks_port), + timeout = 300, + disable_udp = false + } or nil, + redirect_tcp = (proto:find("tcp") and local_port ~= "0") and { + listen = "0.0.0.0:" .. tonumber(local_port), + timeout = 300 + } or nil, + tproxy_udp = (proto:find("udp") and local_port ~= "0") and { + listen = "0.0.0.0:" .. tonumber(local_port), + timeout = 60 + } or nil, + obfs = server.seed, + auth = (server.auth_type == "1") and server.auth_payload or nil, + auth_str = (server.auth_type == "2") and server.auth_payload or nil, + alpn = server.quic_tls_alpn, + server_name = server.tls_host, + insecure = (server.insecure == "1") and true or false, + ca = (server.certificate) and server.certpath or nil, + recv_window_conn = server.recv_window_conn, + recv_window = server.recv_window, + disable_mtu_discovery = (server.disable_mtu_discovery == "1") and true or false +} local config = {} function config:new(o) o = o or {} @@ -298,6 +327,9 @@ function config:handleIndex(index) end, naiveproxy = function() print(json.stringify(naiveproxy, 1)) + end, + hysteria = function() + print(json.stringify(hysteria, 1)) end } if switch[index] then