This commit is contained in:
心隨緣動 2025-09-10 16:35:49 +08:00 committed by GitHub
parent 314391689e
commit 510642f34f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,7 +3,7 @@ const Protocols = {
VLESS: 'vless', VLESS: 'vless',
TROJAN: 'trojan', TROJAN: 'trojan',
SHADOWSOCKS: 'shadowsocks', SHADOWSOCKS: 'shadowsocks',
DOKODEMO: 'dokodemo-door', TUNNEL: 'tunnel',
SOCKS: 'socks', SOCKS: 'socks',
HTTP: 'http', HTTP: 'http',
WIREGUARD: 'wireguard', WIREGUARD: 'wireguard',
@ -743,7 +743,7 @@ class RealityStreamSettings extends XrayCommonClass {
constructor( constructor(
show = false, show = false,
xver = 0, xver = 0,
dest = 'tesla.com:443', target = 'tesla.com:443',
serverNames = 'tesla.com,www.tesla.com', serverNames = 'tesla.com,www.tesla.com',
privateKey = '', privateKey = '',
minClientVer = '', minClientVer = '',
@ -756,7 +756,7 @@ class RealityStreamSettings extends XrayCommonClass {
super(); super();
this.show = show; this.show = show;
this.xver = xver; this.xver = xver;
this.dest = dest; this.target = target;
this.serverNames = Array.isArray(serverNames) ? serverNames.join(",") : serverNames; this.serverNames = Array.isArray(serverNames) ? serverNames.join(",") : serverNames;
this.privateKey = privateKey; this.privateKey = privateKey;
this.minClientVer = minClientVer; this.minClientVer = minClientVer;
@ -781,7 +781,7 @@ class RealityStreamSettings extends XrayCommonClass {
return new RealityStreamSettings( return new RealityStreamSettings(
json.show, json.show,
json.xver, json.xver,
json.dest, json.target,
json.serverNames, json.serverNames,
json.privateKey, json.privateKey,
json.minClientVer, json.minClientVer,
@ -797,7 +797,7 @@ class RealityStreamSettings extends XrayCommonClass {
return { return {
show: this.show, show: this.show,
xver: this.xver, xver: this.xver,
dest: this.dest, target: this.target,
serverNames: this.serverNames.split(","), serverNames: this.serverNames.split(","),
privateKey: this.privateKey, privateKey: this.privateKey,
minClientVer: this.minClientVer, minClientVer: this.minClientVer,
@ -1726,7 +1726,7 @@ Inbound.Settings = class extends XrayCommonClass {
case Protocols.VLESS: return new Inbound.VLESSSettings(protocol); case Protocols.VLESS: return new Inbound.VLESSSettings(protocol);
case Protocols.TROJAN: return new Inbound.TrojanSettings(protocol); case Protocols.TROJAN: return new Inbound.TrojanSettings(protocol);
case Protocols.SHADOWSOCKS: return new Inbound.ShadowsocksSettings(protocol); case Protocols.SHADOWSOCKS: return new Inbound.ShadowsocksSettings(protocol);
case Protocols.DOKODEMO: return new Inbound.DokodemoSettings(protocol); case Protocols.TUNNEL: return new Inbound.TunnelSettings(protocol);
case Protocols.SOCKS: return new Inbound.SocksSettings(protocol); case Protocols.SOCKS: return new Inbound.SocksSettings(protocol);
case Protocols.HTTP: return new Inbound.HttpSettings(protocol); case Protocols.HTTP: return new Inbound.HttpSettings(protocol);
case Protocols.WIREGUARD: return new Inbound.WireguardSettings(protocol); case Protocols.WIREGUARD: return new Inbound.WireguardSettings(protocol);
@ -1740,7 +1740,7 @@ Inbound.Settings = class extends XrayCommonClass {
case Protocols.VLESS: return Inbound.VLESSSettings.fromJson(json); case Protocols.VLESS: return Inbound.VLESSSettings.fromJson(json);
case Protocols.TROJAN: return Inbound.TrojanSettings.fromJson(json); case Protocols.TROJAN: return Inbound.TrojanSettings.fromJson(json);
case Protocols.SHADOWSOCKS: return Inbound.ShadowsocksSettings.fromJson(json); case Protocols.SHADOWSOCKS: return Inbound.ShadowsocksSettings.fromJson(json);
case Protocols.DOKODEMO: return Inbound.DokodemoSettings.fromJson(json); case Protocols.TUNNEL: return Inbound.TunnelSettings.fromJson(json);
case Protocols.SOCKS: return Inbound.SocksSettings.fromJson(json); case Protocols.SOCKS: return Inbound.SocksSettings.fromJson(json);
case Protocols.HTTP: return Inbound.HttpSettings.fromJson(json); case Protocols.HTTP: return Inbound.HttpSettings.fromJson(json);
case Protocols.WIREGUARD: return Inbound.WireguardSettings.fromJson(json); case Protocols.WIREGUARD: return Inbound.WireguardSettings.fromJson(json);
@ -1970,7 +1970,6 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
} }
static fromJson(json = {}) { static fromJson(json = {}) {
return new Inbound.VLESSSettings.VLESS( return new Inbound.VLESSSettings.VLESS(
json.id, json.id,
@ -2118,6 +2117,23 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
this.updated_at = updated_at; this.updated_at = updated_at;
} }
toJson() {
return {
password: this.password,
email: this.email,
limitIp: this.limitIp,
speedLimit: this.speedLimit, // <--- 中文注释: 序列化到 JSON
totalGB: this.totalGB,
expiryTime: this.expiryTime,
enable: this.enable,
tgId: this.tgId,
subId: this.subId,
comment: this.comment,
reset: this.reset,
created_at: this.created_at,
updated_at: this.updated_at,
};
}
static fromJson(json = {}) { static fromJson(json = {}) {
return new Inbound.TrojanSettings.Trojan( return new Inbound.TrojanSettings.Trojan(
@ -2275,6 +2291,24 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
this.updated_at = updated_at; this.updated_at = updated_at;
} }
toJson() {
return {
method: this.method,
password: this.password,
email: this.email,
limitIp: this.limitIp,
speedLimit: this.speedLimit, // <--- 中文注释: 序列化到 JSON
totalGB: this.totalGB,
expiryTime: this.expiryTime,
enable: this.enable,
tgId: this.tgId,
subId: this.subId,
comment: this.comment,
reset: this.reset,
created_at: this.created_at,
updated_at: this.updated_at,
};
}
static fromJson(json = {}) { static fromJson(json = {}) {
return new Inbound.ShadowsocksSettings.Shadowsocks( return new Inbound.ShadowsocksSettings.Shadowsocks(
@ -2322,7 +2356,7 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
}; };
Inbound.DokodemoSettings = class extends Inbound.Settings { Inbound.TunnelSettings = class extends Inbound.Settings {
constructor( constructor(
protocol, protocol,
address, address,
@ -2340,8 +2374,8 @@ Inbound.DokodemoSettings = class extends Inbound.Settings {
} }
static fromJson(json = {}) { static fromJson(json = {}) {
return new Inbound.DokodemoSettings( return new Inbound.TunnelSettings(
Protocols.DOKODEMO, Protocols.TUNNEL,
json.address, json.address,
json.port, json.port,
XrayCommonClass.toHeaders(json.portMap), XrayCommonClass.toHeaders(json.portMap),