|
@@ -110,11 +110,13 @@ class XrayCommonClass {
|
|
}
|
|
}
|
|
|
|
|
|
class TcpStreamSettings extends XrayCommonClass {
|
|
class TcpStreamSettings extends XrayCommonClass {
|
|
- constructor(type='none',
|
|
|
|
|
|
+ constructor(acceptProxyProtocol=false,
|
|
|
|
+ type='none',
|
|
request=new TcpStreamSettings.TcpRequest(),
|
|
request=new TcpStreamSettings.TcpRequest(),
|
|
response=new TcpStreamSettings.TcpResponse(),
|
|
response=new TcpStreamSettings.TcpResponse(),
|
|
) {
|
|
) {
|
|
super();
|
|
super();
|
|
|
|
+ this.acceptProxyProtocol = acceptProxyProtocol;
|
|
this.type = type;
|
|
this.type = type;
|
|
this.request = request;
|
|
this.request = request;
|
|
this.response = response;
|
|
this.response = response;
|
|
@@ -125,7 +127,7 @@ class TcpStreamSettings extends XrayCommonClass {
|
|
if (!header) {
|
|
if (!header) {
|
|
header = {};
|
|
header = {};
|
|
}
|
|
}
|
|
- return new TcpStreamSettings(
|
|
|
|
|
|
+ return new TcpStreamSettings(json.acceptProxyProtocol,
|
|
header.type,
|
|
header.type,
|
|
TcpStreamSettings.TcpRequest.fromJson(header.request),
|
|
TcpStreamSettings.TcpRequest.fromJson(header.request),
|
|
TcpStreamSettings.TcpResponse.fromJson(header.response),
|
|
TcpStreamSettings.TcpResponse.fromJson(header.response),
|
|
@@ -134,6 +136,7 @@ class TcpStreamSettings extends XrayCommonClass {
|
|
|
|
|
|
toJson() {
|
|
toJson() {
|
|
return {
|
|
return {
|
|
|
|
+ acceptProxyProtocol: this.acceptProxyProtocol,
|
|
header: {
|
|
header: {
|
|
type: this.type,
|
|
type: this.type,
|
|
request: this.type === 'http' ? this.request.toJson() : undefined,
|
|
request: this.type === 'http' ? this.request.toJson() : undefined,
|
|
@@ -293,8 +296,9 @@ class KcpStreamSettings extends XrayCommonClass {
|
|
}
|
|
}
|
|
|
|
|
|
class WsStreamSettings extends XrayCommonClass {
|
|
class WsStreamSettings extends XrayCommonClass {
|
|
- constructor(path='/', headers=[]) {
|
|
|
|
|
|
+ constructor(acceptProxyProtocol=false, path='/', headers=[]) {
|
|
super();
|
|
super();
|
|
|
|
+ this.acceptProxyProtocol = acceptProxyProtocol;
|
|
this.path = path;
|
|
this.path = path;
|
|
this.headers = headers;
|
|
this.headers = headers;
|
|
}
|
|
}
|
|
@@ -318,6 +322,7 @@ class WsStreamSettings extends XrayCommonClass {
|
|
|
|
|
|
static fromJson(json={}) {
|
|
static fromJson(json={}) {
|
|
return new WsStreamSettings(
|
|
return new WsStreamSettings(
|
|
|
|
+ json.acceptProxyProtocol,
|
|
json.path,
|
|
json.path,
|
|
XrayCommonClass.toHeaders(json.headers),
|
|
XrayCommonClass.toHeaders(json.headers),
|
|
);
|
|
);
|
|
@@ -325,6 +330,7 @@ class WsStreamSettings extends XrayCommonClass {
|
|
|
|
|
|
toJson() {
|
|
toJson() {
|
|
return {
|
|
return {
|
|
|
|
+ acceptProxyProtocol: this.acceptProxyProtocol,
|
|
path: this.path,
|
|
path: this.path,
|
|
headers: XrayCommonClass.toV2Headers(this.headers, false),
|
|
headers: XrayCommonClass.toV2Headers(this.headers, false),
|
|
};
|
|
};
|
|
@@ -411,10 +417,11 @@ class GrpcStreamSettings extends XrayCommonClass {
|
|
|
|
|
|
class TlsStreamSettings extends XrayCommonClass {
|
|
class TlsStreamSettings extends XrayCommonClass {
|
|
constructor(serverName='',
|
|
constructor(serverName='',
|
|
- certificates=[new TlsStreamSettings.Cert()]) {
|
|
|
|
|
|
+ certificates=[new TlsStreamSettings.Cert()], alpn=[]) {
|
|
super();
|
|
super();
|
|
this.server = serverName;
|
|
this.server = serverName;
|
|
this.certs = certificates;
|
|
this.certs = certificates;
|
|
|
|
+ this.alpn = alpn;
|
|
}
|
|
}
|
|
|
|
|
|
addCert(cert) {
|
|
addCert(cert) {
|
|
@@ -430,9 +437,11 @@ class TlsStreamSettings extends XrayCommonClass {
|
|
if (!ObjectUtil.isEmpty(json.certificates)) {
|
|
if (!ObjectUtil.isEmpty(json.certificates)) {
|
|
certs = json.certificates.map(cert => TlsStreamSettings.Cert.fromJson(cert));
|
|
certs = json.certificates.map(cert => TlsStreamSettings.Cert.fromJson(cert));
|
|
}
|
|
}
|
|
|
|
+
|
|
return new TlsStreamSettings(
|
|
return new TlsStreamSettings(
|
|
json.serverName,
|
|
json.serverName,
|
|
certs,
|
|
certs,
|
|
|
|
+ json.alpn
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -440,6 +449,7 @@ class TlsStreamSettings extends XrayCommonClass {
|
|
return {
|
|
return {
|
|
serverName: this.server,
|
|
serverName: this.server,
|
|
certificates: TlsStreamSettings.toJsonArray(this.certs),
|
|
certificates: TlsStreamSettings.toJsonArray(this.certs),
|
|
|
|
+ alpn: this.alpn
|
|
};
|
|
};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -629,11 +639,7 @@ class Inbound extends XrayCommonClass {
|
|
if (isTls) {
|
|
if (isTls) {
|
|
this.stream.security = 'tls';
|
|
this.stream.security = 'tls';
|
|
} else {
|
|
} else {
|
|
- if (this.protocol === Protocols.TROJAN) {
|
|
|
|
- this.xtls = true;
|
|
|
|
- } else {
|
|
|
|
- this.stream.security = 'none';
|
|
|
|
- }
|
|
|
|
|
|
+ this.stream.security = 'none';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -645,11 +651,7 @@ class Inbound extends XrayCommonClass {
|
|
if (isXTls) {
|
|
if (isXTls) {
|
|
this.stream.security = 'xtls';
|
|
this.stream.security = 'xtls';
|
|
} else {
|
|
} else {
|
|
- if (this.protocol === Protocols.TROJAN) {
|
|
|
|
- this.tls = true;
|
|
|
|
- } else {
|
|
|
|
- this.stream.security = 'none';
|
|
|
|
- }
|
|
|
|
|
|
+ this.stream.security = 'none';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|