Procházet zdrojové kódy

[sub] random reality params

Co-Authored-By: Alireza Ahmadi <[email protected]>
MHSanaei před 1 rokem
rodič
revize
3af55cc5b4

+ 7 - 14
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 {

+ 2 - 2
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'">

+ 1 - 1
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>

+ 3 - 3
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 -->