mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-07-01 20:42:07 +00:00
new - Cert (TLS-XTLS) - oneTimeLoading , usage
This commit is contained in:
parent
5aae32c888
commit
70f9e32f28
2 changed files with 55 additions and 3 deletions
|
@ -84,14 +84,22 @@ const SNIFFING_OPTION = {
|
||||||
FAKEDNS: "fakedns"
|
FAKEDNS: "fakedns"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const USAGE_OPTION = {
|
||||||
|
ENCIPHERMENT: "encipherment",
|
||||||
|
VERIFY: "verify",
|
||||||
|
ISSUE: "issue",
|
||||||
|
};
|
||||||
|
|
||||||
Object.freeze(Protocols);
|
Object.freeze(Protocols);
|
||||||
Object.freeze(SSMethods);
|
Object.freeze(SSMethods);
|
||||||
Object.freeze(XTLS_FLOW_CONTROL);
|
Object.freeze(XTLS_FLOW_CONTROL);
|
||||||
Object.freeze(TLS_FLOW_CONTROL);
|
Object.freeze(TLS_FLOW_CONTROL);
|
||||||
Object.freeze(TLS_VERSION_OPTION);
|
Object.freeze(TLS_VERSION_OPTION);
|
||||||
Object.freeze(TLS_CIPHER_OPTION);
|
Object.freeze(TLS_CIPHER_OPTION);
|
||||||
|
Object.freeze(UTLS_FINGERPRINT);
|
||||||
Object.freeze(ALPN_OPTION);
|
Object.freeze(ALPN_OPTION);
|
||||||
Object.freeze(SNIFFING_OPTION);
|
Object.freeze(SNIFFING_OPTION);
|
||||||
|
Object.freeze(USAGE_OPTION);
|
||||||
|
|
||||||
class XrayCommonClass {
|
class XrayCommonClass {
|
||||||
|
|
||||||
|
@ -585,7 +593,7 @@ class TlsStreamSettings extends XrayCommonClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
TlsStreamSettings.Cert = class extends XrayCommonClass {
|
TlsStreamSettings.Cert = class extends XrayCommonClass {
|
||||||
constructor(useFile=true, certificateFile='', keyFile='', certificate='', key='', ocspStapling=3600) {
|
constructor(useFile=true, certificateFile='', keyFile='', certificate='', key='', ocspStapling=3600, oneTimeLoading=false, usage=USAGE_OPTION.ENCIPHERMENT) {
|
||||||
super();
|
super();
|
||||||
this.useFile = useFile;
|
this.useFile = useFile;
|
||||||
this.certFile = certificateFile;
|
this.certFile = certificateFile;
|
||||||
|
@ -593,6 +601,8 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
||||||
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;
|
this.ocspStapling = ocspStapling;
|
||||||
|
this.oneTimeLoading = oneTimeLoading;
|
||||||
|
this.usage = usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json={}) {
|
static fromJson(json={}) {
|
||||||
|
@ -602,6 +612,8 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
||||||
json.certificateFile,
|
json.certificateFile,
|
||||||
json.keyFile, '', '',
|
json.keyFile, '', '',
|
||||||
json.ocspStapling,
|
json.ocspStapling,
|
||||||
|
json.oneTimeLoading,
|
||||||
|
json.usage,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return new TlsStreamSettings.Cert(
|
return new TlsStreamSettings.Cert(
|
||||||
|
@ -609,6 +621,8 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
||||||
json.certificate.join('\n'),
|
json.certificate.join('\n'),
|
||||||
json.key.join('\n'),
|
json.key.join('\n'),
|
||||||
json.ocspStapling,
|
json.ocspStapling,
|
||||||
|
json.oneTimeLoading,
|
||||||
|
json.usage,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,12 +633,16 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
||||||
certificateFile: this.certFile,
|
certificateFile: this.certFile,
|
||||||
keyFile: this.keyFile,
|
keyFile: this.keyFile,
|
||||||
ocspStapling: this.ocspStapling,
|
ocspStapling: this.ocspStapling,
|
||||||
|
oneTimeLoading: this.oneTimeLoading,
|
||||||
|
usage: this.usage,
|
||||||
};
|
};
|
||||||
} 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,
|
ocspStapling: this.ocspStapling,
|
||||||
|
oneTimeLoading: this.oneTimeLoading,
|
||||||
|
usage: this.usage,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -698,13 +716,16 @@ class XtlsStreamSettings extends XrayCommonClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
XtlsStreamSettings.Cert = class extends XrayCommonClass {
|
XtlsStreamSettings.Cert = class extends XrayCommonClass {
|
||||||
constructor(useFile=true, certificateFile='', keyFile='', certificate='', key='') {
|
constructor(useFile=true, certificateFile='', keyFile='', certificate='', key='', ocspStapling=3600, oneTimeLoading=false, usage=USAGE_OPTION.ENCIPHERMENT) {
|
||||||
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;
|
||||||
|
this.oneTimeLoading = oneTimeLoading;
|
||||||
|
this.usage = usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json={}) {
|
static fromJson(json={}) {
|
||||||
|
@ -712,13 +733,19 @@ XtlsStreamSettings.Cert = class extends XrayCommonClass {
|
||||||
return new XtlsStreamSettings.Cert(
|
return new XtlsStreamSettings.Cert(
|
||||||
true,
|
true,
|
||||||
json.certificateFile,
|
json.certificateFile,
|
||||||
json.keyFile,
|
json.keyFile, '', '',
|
||||||
|
json.ocspStapling,
|
||||||
|
json.oneTimeLoading,
|
||||||
|
json.usage,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return new XtlsStreamSettings.Cert(
|
return new XtlsStreamSettings.Cert(
|
||||||
false, '', '',
|
false, '', '',
|
||||||
json.certificate.join('\n'),
|
json.certificate.join('\n'),
|
||||||
json.key.join('\n'),
|
json.key.join('\n'),
|
||||||
|
json.ocspStapling,
|
||||||
|
json.oneTimeLoading,
|
||||||
|
json.usage,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -728,11 +755,17 @@ XtlsStreamSettings.Cert = class extends XrayCommonClass {
|
||||||
return {
|
return {
|
||||||
certificateFile: this.certFile,
|
certificateFile: this.certFile,
|
||||||
keyFile: this.keyFile,
|
keyFile: this.keyFile,
|
||||||
|
ocspStapling: this.ocspStapling,
|
||||||
|
oneTimeLoading: this.oneTimeLoading,
|
||||||
|
usage: this.usage,
|
||||||
};
|
};
|
||||||
} 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,
|
||||||
|
oneTimeLoading: this.oneTimeLoading,
|
||||||
|
usage: this.usage,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,14 @@
|
||||||
<a-form-item label='OCSP stapling'>
|
<a-form-item label='OCSP stapling'>
|
||||||
<a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
|
<a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="One Time Loading">
|
||||||
|
<a-switch v-model="cert.oneTimeLoading"></a-switch>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label='Usage Option'>
|
||||||
|
<a-select v-model="cert.usage" style="width: 50%" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
|
<a-select-option v-for="key in USAGE_OPTION" :value="key">[[ key ]]</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -134,6 +142,17 @@
|
||||||
<a-input type="textarea" :rows="3" v-model="cert.key"></a-input>
|
<a-input type="textarea" :rows="3" v-model="cert.key"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
<a-form-item label='OCSP stapling'>
|
||||||
|
<a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="One Time Loading">
|
||||||
|
<a-switch v-model="cert.oneTimeLoading"></a-switch>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label='Usage Option'>
|
||||||
|
<a-select v-model="cert.usage" style="width: 50%" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
|
<a-select-option v-for="key in USAGE_OPTION" :value="key">[[ key ]]</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue