Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2024-03-11 13:04:15 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2024-03-11 13:22:06 +0300
commit3af55cc5b499994924be25fa54a851de2ed05d90 (patch)
treee53dfea00190445c0fd27fce5c9bf072114d20ba
parentac5d8af4f92529de1f048ecef1424b28686ecb39 (diff)
[sub] random reality params
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
-rw-r--r--sub/subService.go21
-rw-r--r--web/html/xui/form/outbound.html4
-rw-r--r--web/html/xui/form/stream/stream_httpupgrade.html2
-rw-r--r--web/html/xui/form/stream/stream_settings.html6
4 files changed, 13 insertions, 20 deletions
diff --git a/sub/subService.go b/sub/subService.go
index 97473159..0ed1d454 100644
--- a/sub/subService.go
+++ b/sub/subService.go
@@ -11,6 +11,7 @@ import (
"x-ui/database/model"
"x-ui/logger"
"x-ui/util/common"
+ "x-ui/util/random"
"x-ui/web/service"
"x-ui/xray"
@@ -402,25 +403,21 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
if realitySetting != nil {
if sniValue, ok := searchKey(realitySetting, "serverNames"); ok {
sNames, _ := sniValue.([]interface{})
- params["sni"], _ = sNames[0].(string)
+ params["sni"] = sNames[random.Num(len(sNames))].(string)
}
if pbkValue, ok := searchKey(realitySettings, "publicKey"); ok {
params["pbk"], _ = pbkValue.(string)
}
if sidValue, ok := searchKey(realitySetting, "shortIds"); ok {
shortIds, _ := sidValue.([]interface{})
- params["sid"], _ = shortIds[0].(string)
+ params["sid"] = shortIds[random.Num(len(shortIds))].(string)
}
if fpValue, ok := searchKey(realitySettings, "fingerprint"); ok {
if fp, ok := fpValue.(string); ok && len(fp) > 0 {
params["fp"] = fp
}
}
- if spxValue, ok := searchKey(realitySettings, "spiderX"); ok {
- if spx, ok := spxValue.(string); ok && len(spx) > 0 {
- params["spx"] = spx
- }
- }
+ params["spx"] = "/" + random.Seq(15)
}
if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 {
@@ -619,25 +616,21 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
if realitySetting != nil {
if sniValue, ok := searchKey(realitySetting, "serverNames"); ok {
sNames, _ := sniValue.([]interface{})
- params["sni"], _ = sNames[0].(string)
+ params["sni"] = sNames[random.Num(len(sNames))].(string)
}
if pbkValue, ok := searchKey(realitySettings, "publicKey"); ok {
params["pbk"], _ = pbkValue.(string)
}
if sidValue, ok := searchKey(realitySetting, "shortIds"); ok {
shortIds, _ := sidValue.([]interface{})
- params["sid"], _ = shortIds[0].(string)
+ params["sid"] = shortIds[random.Num(len(shortIds))].(string)
}
if fpValue, ok := searchKey(realitySettings, "fingerprint"); ok {
if fp, ok := fpValue.(string); ok && len(fp) > 0 {
params["fp"] = fp
}
}
- if spxValue, ok := searchKey(realitySettings, "spiderX"); ok {
- if spx, ok := spxValue.(string); ok && len(spx) > 0 {
- params["spx"] = spx
- }
- }
+ params["spx"] = "/" + random.Seq(15)
}
if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 {
diff --git a/web/html/xui/form/outbound.html b/web/html/xui/form/outbound.html
index 2f2a5215..e3d6a560 100644
--- a/web/html/xui/form/outbound.html
+++ b/web/html/xui/form/outbound.html
@@ -219,11 +219,11 @@
:dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option value="tcp">TCP</a-select-option>
<a-select-option value="kcp">mKCP</a-select-option>
- <a-select-option value="ws">WS</a-select-option>
+ <a-select-option value="ws">WebSocket</a-select-option>
<a-select-option value="http">H2</a-select-option>
<a-select-option value="quic">QUIC</a-select-option>
<a-select-option value="grpc">gRPC</a-select-option>
- <a-select-option value="httpupgrade">HttpUpgrade</a-select-option>
+ <a-select-option value="httpupgrade">HTTPUpgrade</a-select-option>
</a-select>
</a-form-item>
<template v-if="outbound.stream.network === 'tcp'">
diff --git a/web/html/xui/form/stream/stream_httpupgrade.html b/web/html/xui/form/stream/stream_httpupgrade.html
index 73f10b07..15c02aeb 100644
--- a/web/html/xui/form/stream/stream_httpupgrade.html
+++ b/web/html/xui/form/stream/stream_httpupgrade.html
@@ -1,4 +1,4 @@
-{{define "form/streamHTTPUPGRADE"}}
+{{define "form/streamHTTPUpgrade"}}
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
<a-form-item label="PROXY Protocol">
<a-switch v-model="inbound.stream.httpupgrade.acceptProxyProtocol"></a-switch>
diff --git a/web/html/xui/form/stream/stream_settings.html b/web/html/xui/form/stream/stream_settings.html
index a3cb0362..0d1eaa23 100644
--- a/web/html/xui/form/stream/stream_settings.html
+++ b/web/html/xui/form/stream/stream_settings.html
@@ -6,11 +6,11 @@
:dropdown-class-name="themeSwitcher.currentTheme">
<a-select-option value="tcp">TCP</a-select-option>
<a-select-option value="kcp">mKCP</a-select-option>
- <a-select-option value="ws">WS</a-select-option>
+ <a-select-option value="ws">WebSocket</a-select-option>
<a-select-option value="http">H2</a-select-option>
<a-select-option value="quic">QUIC</a-select-option>
<a-select-option value="grpc">gRPC</a-select-option>
- <a-select-option value="httpupgrade">HttpUpgrade</a-select-option>
+ <a-select-option value="httpupgrade">HTTPUpgrade</a-select-option>
</a-select>
</a-form-item>
</a-form>
@@ -47,7 +47,7 @@
<!-- httpupgrade -->
<template v-if="inbound.stream.network === 'httpupgrade'">
- {{template "form/streamHTTPUPGRADE"}}
+ {{template "form/streamHTTPUpgrade"}}
</template>
<!-- sockopt -->