This commit is contained in:
mhsanaei 2024-09-02 12:00:25 +02:00
parent 0af630a481
commit 0925288f16
3 changed files with 156 additions and 160 deletions

View file

@ -268,13 +268,13 @@ func (s *SubJsonService) realityData(rData map[string]interface{}) map[string]in
rltyData["spiderX"] = "/" + random.Seq(15) rltyData["spiderX"] = "/" + random.Seq(15)
shortIds, ok := rData["shortIds"].([]interface{}) shortIds, ok := rData["shortIds"].([]interface{})
if ok && len(shortIds) > 0 { if ok && len(shortIds) > 0 {
rltyData["shortId"] = shortIds[random.Num(len(shortIds))].(string) rltyData["shortId"] = shortIds
} else { } else {
rltyData["shortId"] = "" rltyData["shortId"] = ""
} }
serverNames, ok := rData["serverNames"].([]interface{}) serverNames, ok := rData["serverNames"].([]interface{})
if ok && len(serverNames) > 0 { if ok && len(serverNames) > 0 {
rltyData["serverName"] = serverNames[random.Num(len(serverNames))].(string) rltyData["serverName"] = serverNames
} else { } else {
rltyData["serverName"] = "" rltyData["serverName"] = ""
} }

View file

@ -921,13 +921,11 @@ class RealityStreamSettings extends XrayCommonClass {
this.show = show; this.show = show;
this.xver = xver; this.xver = xver;
this.dest = dest; this.dest = dest;
/** @type {string} */
this.serverNames = Array.isArray(serverNames) ? serverNames.join(",") : serverNames; this.serverNames = Array.isArray(serverNames) ? serverNames.join(",") : serverNames;
this.privateKey = privateKey; this.privateKey = privateKey;
this.minClient = minClient; this.minClient = minClient;
this.maxClient = maxClient; this.maxClient = maxClient;
this.maxTimediff = maxTimediff; this.maxTimediff = maxTimediff;
/** @type {string} */
this.shortIds = Array.isArray(shortIds) ? shortIds.join(",") : shortIds; this.shortIds = Array.isArray(shortIds) ? shortIds.join(",") : shortIds;
this.settings = settings; this.settings = settings;
} }

View file

@ -99,7 +99,6 @@ class RandomUtil {
return str; return str;
} }
/** @return {string} */
static randomShortIds() { static randomShortIds() {
const lengths = [2, 4, 6, 8, 10, 12, 14, 16]; const lengths = [2, 4, 6, 8, 10, 12, 14, 16];
for (let i = lengths.length - 1; i > 0; i--) { for (let i = lengths.length - 1; i > 0; i--) {
@ -107,7 +106,6 @@ class RandomUtil {
[lengths[i], lengths[j]] = [lengths[j], lengths[i]]; [lengths[i], lengths[j]] = [lengths[j], lengths[i]];
} }
/** @type {string[]} */
let shortIds = []; let shortIds = [];
for (let length of lengths) { for (let length of lengths) {
let shortId = ''; let shortId = '';