From c8e35985022d93ab77b752ccfac6c681d9c37b53 Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:37:12 +0800 Subject: [PATCH] luci: fix Hysteria2/TUIC with sing-box --- luci-app-passwall/Makefile | 2 +- .../luasrc/passwall/util_sing-box.lua | 24 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 9ca14868c..a6be5c975 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=4.70-1 +PKG_VERSION:=4.70-2 PKG_RELEASE:= PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index eb57ba838..e34855517 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -302,7 +302,11 @@ function gen_outbound(flag, node, tag, proxy_table) udp_over_stream = false, zero_rtt_handshake = (node.tuic_zero_rtt_handshake == "1") and true or false, heartbeat = tonumber(node.tuic_heartbeat), - tls = tls, + tls = { + enabled = true, + server_name = node.tls_serverName, + insecure = (node.tls_allowInsecure == "1") and true or false, + }, } end @@ -315,7 +319,11 @@ function gen_outbound(flag, node, tag, proxy_table) password = node.hysteria2_obfs_password }, password = node.hysteria2_auth_password or nil, - tls = tls, + tls = { + enabled = true, + server_name = node.tls_serverName, + insecure = (node.tls_allowInsecure == "1") and true or false, + }, } end @@ -536,7 +544,11 @@ function gen_config_server(node) congestion_control = node.tuic_congestion_control or "cubic", zero_rtt_handshake = (node.tuic_zero_rtt_handshake == "1") and true or false, heartbeat = node.tuic_heartbeat .. "s", - tls = tls, + tls = { + enabled = true, + certificate_path = node.tls_certificateFile, + key_path = node.tls_keyFile, + }, } end @@ -555,7 +567,11 @@ function gen_config_server(node) } }, ignore_client_bandwidth = (node.hysteria2_ignore_client_bandwidth == "1") and true or false, - tls = tls, + tls = { + enabled = true, + certificate_path = node.tls_certificateFile, + key_path = node.tls_keyFile, + }, } end