@@ -154,8 +154,10 @@ show_links() {
154
154
local uuid_vmess=" $( read_json /usr/local/etc/v2ray/05_inbounds.json ' .inbounds[1].settings.clients[0].id' ) "
155
155
local path_vmess=" $( read_json /usr/local/etc/v2ray/05_inbounds.json ' .inbounds[1].streamSettings.wsSettings.path' ) "
156
156
local passwd_trojan=" $( read_json /etc/trojan-go/config.json ' .password[0]' ) "
157
+ local path_trojan=" $( read_json /etc/trojan-go/config.json ' .websocket.path' ) "
157
158
158
159
colorEcho ${YELLOW} " =============================="
160
+
159
161
echo " VLESS"
160
162
printf " %s:443 %s\n\n" " ${sni} " " ${uuid_vless} "
161
163
@@ -171,6 +173,11 @@ show_links() {
171
173
echo " Trojan"
172
174
local uri_trojan=" ${passwd_trojan} @${sni} :443?peer=${sni} &sni=${sni} #` urlEncode " ${sni} (Trojan)" ` "
173
175
printf " %s\n" " trojan://${uri_trojan} "
176
+
177
+ echo " Trojan-Go"
178
+ local uri_trojango=" ${passwd_trojan} @${cf_node} :443?peer=${sni} &sni=${sni} &type=ws&host=${sni} &path=` urlEncode " ${path_trojan} " ` #` urlEncode " ${sni} (Trojan-Go)" ` "
179
+ printf " %s\n" " trojan-go://${uri_trojango} "
180
+
174
181
colorEcho ${YELLOW} " =============================="
175
182
}
176
183
@@ -257,6 +264,7 @@ set_v2ray() {
257
264
# $3: path for vmess+ws
258
265
# $4: sni
259
266
# $5: url of cf node
267
+ # $6: path for trojan-go+ws
260
268
${sudoCmd} cat > " /usr/local/etc/v2ray/05_inbounds.json" << -EOF
261
269
{
262
270
"inbounds": [
@@ -279,6 +287,11 @@ set_v2ray() {
279
287
"path": "$3 ",
280
288
"dest": 3566,
281
289
"xver": 1
290
+ },
291
+ {
292
+ "path": "$6 ",
293
+ "dest": 3567,
294
+ "xver": 1
282
295
}
283
296
]
284
297
},
335
348
}
336
349
337
350
set_trojan () {
351
+ # $1: password
352
+ # $2: ws path
353
+ # $3: sni
338
354
${sudoCmd} cat > " /etc/trojan-go/config.json" << -EOF
339
355
{
340
356
"run_type": "server",
@@ -350,6 +366,11 @@ set_trojan() {
350
366
"enabled": true,
351
367
"type": "plaintext"
352
368
},
369
+ "websocket": {
370
+ "enabled": true,
371
+ "path": "$2 ",
372
+ "host": "$3 "
373
+ },
353
374
"router": {
354
375
"enabled": false
355
376
}
@@ -468,6 +489,9 @@ fix_cert() {
468
489
get_cert " ${V2_DOMAIN} "
469
490
470
491
write_json /usr/local/etc/v2ray/05_inbounds.json " .inbounds[0].tag" " \" ${V2_DOMAIN} \" "
492
+ write_json /etc/trojan-go/config.json " .websocket.host" " \" ${V2_DOMAIN} \" "
493
+
494
+ ${sudoCmd} systemctl restart trojan-go
471
495
472
496
if [ -f " /root/.acme.sh/${V2_DOMAIN} _ecc/fullchain.cer" ]; then
473
497
colorEcho ${GREEN} " 安装 VLESS (TLS) + VMess (WSS) + Trojan-Go 成功!"
@@ -515,9 +539,10 @@ install_v2ray() {
515
539
local path_vmess=" /$( cat ' /proc/sys/kernel/random/uuid' | sed -e ' s/-//g' | tr ' [:upper:]' ' [:lower:]' | head -c 12) "
516
540
local cf_node=" $( curl -s https://raw.githubusercontent.com/phlinhng/v2ray-tcp-tls-web/${branch} /custom/cf_node) "
517
541
local passwd_trojan=" $( cat ' /proc/sys/kernel/random/uuid' | sed -e ' s/-//g' | tr ' [:upper:]' ' [:lower:]' | head -c 12) "
542
+ local path_trojan=" /$( cat ' /proc/sys/kernel/random/uuid' | sed -e ' s/-//g' | tr ' [:upper:]' ' [:lower:]' | head -c 12) "
518
543
519
- set_v2ray " ${uuid_vless} " " ${uuid_vmess} " " ${path_vmess} " " ${V2_DOMAIN} " " ${cf_node} "
520
- set_trojan " ${passwd_trojan} "
544
+ set_v2ray " ${uuid_vless} " " ${uuid_vmess} " " ${path_vmess} " " ${V2_DOMAIN} " " ${cf_node} " " ${path_trojan} "
545
+ set_trojan " ${passwd_trojan} " " ${path_trojan} " " ${V2_DOMAIN} "
521
546
522
547
${sudoCmd} mkdir -p /etc/ssl/v2ray
523
548
0 commit comments