Skip to content

Commit

Permalink
add tls ocspStapling
Browse files Browse the repository at this point in the history
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
  • Loading branch information
MHSanaei and alireza0 committed Aug 26, 2023
1 parent 731e83a commit 18617af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions web/assets/js/model/xray.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,27 +541,30 @@ class TlsStreamSettings extends XrayCommonClass {
}

TlsStreamSettings.Cert = class extends XrayCommonClass {
constructor(useFile=true, certificateFile='', keyFile='', certificate='', key='') {
constructor(useFile=true, certificateFile='', keyFile='', certificate='', key='', ocspStapling=3600) {
super();
this.useFile = useFile;
this.certFile = certificateFile;
this.keyFile = keyFile;
this.cert = certificate instanceof Array ? certificate.join('\n') : certificate;
this.key = key instanceof Array ? key.join('\n') : key;
this.ocspStapling = ocspStapling;
}

static fromJson(json={}) {
if ('certificateFile' in json && 'keyFile' in json) {
return new TlsStreamSettings.Cert(
true,
json.certificateFile,
json.keyFile,
json.keyFile, '', '',
json.ocspStapling,
);
} else {
return new TlsStreamSettings.Cert(
false, '', '',
json.certificate.join('\n'),
json.key.join('\n'),
json.ocspStapling,
);
}
}
Expand All @@ -571,11 +574,13 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
return {
certificateFile: this.certFile,
keyFile: this.keyFile,
ocspStapling: this.ocspStapling,
};
} else {
return {
certificate: this.cert.split('\n'),
key: this.key.split('\n'),
ocspStapling: this.ocspStapling,
};
}
}
Expand Down Expand Up @@ -1104,7 +1109,7 @@ class Inbound extends XrayCommonClass {
} else if (this.isWs) {
return this.stream.ws.path;
} else if (this.isH2) {
return this.stream.http.path[0];
return this.stream.http.path;
}
return null;
}
Expand Down
4 changes: 4 additions & 0 deletions web/html/xui/form/tls_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@
<a-input type="textarea" :rows="3" style="width:300px;" v-model="cert.key"></a-input>
</a-form-item>
</template>
<br>
<a-form-item label="ocspStapling">
<a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
</a-form-item>
</template>
</a-form>

Expand Down

0 comments on commit 18617af

Please sign in to comment.