為了解決部分網絡環境下 UDP 協議被運營商 QOS 限速或阻斷的問題,我們更新了專用的 WireGuard over WSS (WebSocket) 一鍵部署腳本。
本腳本將 WireGuard 流量偽裝成標準的 HTTPS (TCP) 流量,配合 wstunnel 隧道,實現更穩定、隱蔽的連接。
To address UDP throttling or blocking issues in certain network environments, we have released an updated WireGuard over WSS (WebSocket) one-click deployment script.
This script wraps WireGuard traffic into standard HTTPS (TCP) packets using wstunnel, ensuring a more stable and stealthy connection.
🚀 適用場景 / Usage Scenarios
-
網絡環境惡劣 (Bad Network Conditions):
-
運營商對 UDP 流量進行幹擾或阻斷,導致傳統 VPN 連接不穩。
-
ISP throttles or drops UDP packets, causing unstable VPN connections.
-
-
高隱蔽性需求 (Stealth Mode):
-
需要將流量偽裝成普通的網頁瀏覽 (WebSocket/TLS)。
-
Need to mask VPN traffic as regular web browsing (WebSocket/TLS).
-
🛠️ 使用方法 / How to Use
# 下載腳本
wget http://ex-files.leikwanhost.com/auto-wss-wg.sh
# 給予執行權限 / Grant execution permission
chmod +x auto-wss-wg.sh
# 運行 / Run
./auto-wss-wg.sh
2. 菜單選項說明 / Menu Options:
運行腳本後,您將看到以下三個選項。請按照順序操作: After running the script, you will see three options. Please follow the order below:
-
選項 1 (Mode A – 客戶端/內網):
-
在哪裡運行? 在利群主機VM上運行. 。
-
作用: 生成本機密鑰,獲取需要發送給服務端的信息。
-
Where to run? On your LeiKwan Host VMs.
-
Action: Generates keys and prepares info for the server.
-
-
選項 2 (Mode B – 服務端/雲端):
-
在哪裡運行? 在擁有公網 IP 的境外 VPS 或雲服務器上運行。
-
作用: 安裝服務端,配置 WSS 隧道,生成連接信息。
-
Where to run? On your Cloud VPS with a Public IP.
-
Action: Installs server components, configures WSS tunnel, provides connection info.
-
-
選項 3 (Mode C – 連接/完成):
-
在哪裡運行? 回到第一步的那台機器 (客戶端 A)。
-
作用: 填入服務端 (B) 提供的信息,啟動隧道。
-
Where to run? Back on the local machine (Client A).
-
Action: Input info provided by Server (B) and start the tunnel.
-
📝 簡易教程 / Quick Tutorial
-
[機器 A] 運行腳本,選擇 1 (Mode A)。記錄下生成的
Public Key和WireGuard IP。-
[Machine A] Run script, select 1. Note down the
Public KeyandWireGuard IP.
-
-
[機器 B] 運行腳本,選擇 2 (Mode B)。
-
粘貼機器 A 的信息。
-
設置端口 (或使用推薦的隨機端口)。
-
腳本運行完畢後,會顯示綠色的匯總信息 (Server IP, Public Key, Port 等)。請複製這些信息。
-
[Machine B] Run script, select 2. Paste info from Machine A. Copy the green summary info after completion.
-
-
[機器 A] 再次運行腳本,選擇 3 (Mode C)。
-
填入機器 B 剛剛生成的連接信息。
-
腳本將自動建立連接並進行 Ping 測試。
-
[Machine A] Run script again, select 3. Enter the connection info from Machine B. The tunnel will start automatically.
-
⚠️ 注意事項 / Notes
-
防火牆 (Firewall): 請確保服務端 (Mode B) 的防火牆/安全組已放行腳本中設置的 TCP 端口 (WSS Port)。
-
Ensure the TCP port (WSS Port) is open in the firewall/security group on the Server (Mode B).
-

