add tls ocspStapling

Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
This commit is contained in:
MHSanaei 2023-08-26 18:52:38 +03:30
parent 731e83a7da
commit 18617afd43
2 changed files with 12 additions and 3 deletions

View File

@ -541,13 +541,14 @@ class TlsStreamSettings extends XrayCommonClass {
} }
TlsStreamSettings.Cert = class extends XrayCommonClass { TlsStreamSettings.Cert = class extends XrayCommonClass {
constructor(useFile=true, certificateFile='', keyFile='', certificate='', key='') { constructor(useFile=true, certificateFile='', keyFile='', certificate='', key='', ocspStapling=3600) {
super(); super();
this.useFile = useFile; this.useFile = useFile;
this.certFile = certificateFile; this.certFile = certificateFile;
this.keyFile = keyFile; this.keyFile = keyFile;
this.cert = certificate instanceof Array ? certificate.join('\n') : certificate; this.cert = certificate instanceof Array ? certificate.join('\n') : certificate;
this.key = key instanceof Array ? key.join('\n') : key; this.key = key instanceof Array ? key.join('\n') : key;
this.ocspStapling = ocspStapling;
} }
static fromJson(json={}) { static fromJson(json={}) {
@ -555,13 +556,15 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
return new TlsStreamSettings.Cert( return new TlsStreamSettings.Cert(
true, true,
json.certificateFile, json.certificateFile,
json.keyFile, json.keyFile, '', '',
json.ocspStapling,
); );
} else { } else {
return new TlsStreamSettings.Cert( return new TlsStreamSettings.Cert(
false, '', '', false, '', '',
json.certificate.join('\n'), json.certificate.join('\n'),
json.key.join('\n'), json.key.join('\n'),
json.ocspStapling,
); );
} }
} }
@ -571,11 +574,13 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
return { return {
certificateFile: this.certFile, certificateFile: this.certFile,
keyFile: this.keyFile, keyFile: this.keyFile,
ocspStapling: this.ocspStapling,
}; };
} else { } else {
return { return {
certificate: this.cert.split('\n'), certificate: this.cert.split('\n'),
key: this.key.split('\n'), key: this.key.split('\n'),
ocspStapling: this.ocspStapling,
}; };
} }
} }
@ -1104,7 +1109,7 @@ class Inbound extends XrayCommonClass {
} else if (this.isWs) { } else if (this.isWs) {
return this.stream.ws.path; return this.stream.ws.path;
} else if (this.isH2) { } else if (this.isH2) {
return this.stream.http.path[0]; return this.stream.http.path;
} }
return null; return null;
} }

View File

@ -122,6 +122,10 @@
<a-input type="textarea" :rows="3" style="width:300px;" v-model="cert.key"></a-input> <a-input type="textarea" :rows="3" style="width:300px;" v-model="cert.key"></a-input>
</a-form-item> </a-form-item>
</template> </template>
<br>
<a-form-item label="ocspStapling">
<a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
</a-form-item>
</template> </template>
</a-form> </a-form>