mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-11 04:36:20 +00:00
update
This commit is contained in:
parent
0af630a481
commit
0925288f16
3 changed files with 156 additions and 160 deletions
|
@ -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"] = ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = '';
|
||||||
|
@ -472,12 +470,12 @@ class Wireguard {
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static generateKeypair(secretKey='') {
|
static generateKeypair(secretKey = '') {
|
||||||
var privateKey = secretKey.length>0 ? this.keyFromBase64(secretKey) : this.generatePrivateKey();
|
var privateKey = secretKey.length > 0 ? this.keyFromBase64(secretKey) : this.generatePrivateKey();
|
||||||
var publicKey = this.generatePublicKey(privateKey);
|
var publicKey = this.generatePublicKey(privateKey);
|
||||||
return {
|
return {
|
||||||
publicKey: this.keyToBase64(publicKey),
|
publicKey: this.keyToBase64(publicKey),
|
||||||
privateKey: secretKey.length>0 ? secretKey : this.keyToBase64(privateKey)
|
privateKey: secretKey.length > 0 ? secretKey : this.keyToBase64(privateKey)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue