|
@@ -1,12 +1,21 @@
|
|
|
|
|
+import { useState } from 'react';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
-import { Button, Form, Input, InputNumber, Space, Typography } from 'antd';
|
|
|
|
|
|
|
+import { Button, Form, Input, InputNumber, Select, Space, Typography } from 'antd';
|
|
|
|
|
+
|
|
|
|
|
+type VlessAuthKind =
|
|
|
|
|
+ | 'x25519'
|
|
|
|
|
+ | 'x25519_xorpub'
|
|
|
|
|
+ | 'x25519_random'
|
|
|
|
|
+ | 'mlkem768'
|
|
|
|
|
+ | 'mlkem768_xorpub'
|
|
|
|
|
+ | 'mlkem768_random';
|
|
|
|
|
|
|
|
interface VlessFieldsProps {
|
|
interface VlessFieldsProps {
|
|
|
saving: boolean;
|
|
saving: boolean;
|
|
|
selectedVlessAuth: string;
|
|
selectedVlessAuth: string;
|
|
|
network: string;
|
|
network: string;
|
|
|
security: string;
|
|
security: string;
|
|
|
- getNewVlessEnc: (kind: 'x25519' | 'mlkem768') => void;
|
|
|
|
|
|
|
+ getNewVlessEnc: (kind: VlessAuthKind) => void;
|
|
|
clearVlessEnc: () => void;
|
|
clearVlessEnc: () => void;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -19,6 +28,17 @@ export default function VlessFields({
|
|
|
clearVlessEnc,
|
|
clearVlessEnc,
|
|
|
}: VlessFieldsProps) {
|
|
}: VlessFieldsProps) {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
|
|
+ const [authKind, setAuthKind] = useState<VlessAuthKind>('x25519');
|
|
|
|
|
+
|
|
|
|
|
+ const authOptions = [
|
|
|
|
|
+ { value: 'x25519', label: t('pages.inbounds.vlessAuthX25519') },
|
|
|
|
|
+ { value: 'x25519_xorpub', label: t('pages.inbounds.vlessAuthX25519Xorpub') },
|
|
|
|
|
+ { value: 'x25519_random', label: t('pages.inbounds.vlessAuthX25519Random') },
|
|
|
|
|
+ { value: 'mlkem768', label: t('pages.inbounds.vlessAuthMlkem768') },
|
|
|
|
|
+ { value: 'mlkem768_xorpub', label: t('pages.inbounds.vlessAuthMlkem768Xorpub') },
|
|
|
|
|
+ { value: 'mlkem768_random', label: t('pages.inbounds.vlessAuthMlkem768Random') },
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<Form.Item name={['settings', 'decryption']} label={t('pages.inbounds.decryption')}>
|
|
<Form.Item name={['settings', 'decryption']} label={t('pages.inbounds.decryption')}>
|
|
@@ -27,13 +47,16 @@ export default function VlessFields({
|
|
|
<Form.Item name={['settings', 'encryption']} label={t('pages.inbounds.encryption')}>
|
|
<Form.Item name={['settings', 'encryption']} label={t('pages.inbounds.encryption')}>
|
|
|
<Input />
|
|
<Input />
|
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
- <Form.Item label=" ">
|
|
|
|
|
|
|
+ <Form.Item label={t('pages.inbounds.vlessAuthGenerate')}>
|
|
|
<Space size={8} wrap>
|
|
<Space size={8} wrap>
|
|
|
- <Button type="primary" loading={saving} onClick={() => getNewVlessEnc('x25519')}>
|
|
|
|
|
- {t('pages.inbounds.vlessAuthX25519')}
|
|
|
|
|
- </Button>
|
|
|
|
|
- <Button type="primary" loading={saving} onClick={() => getNewVlessEnc('mlkem768')}>
|
|
|
|
|
- {t('pages.inbounds.vlessAuthMlkem768')}
|
|
|
|
|
|
|
+ <Select
|
|
|
|
|
+ value={authKind}
|
|
|
|
|
+ onChange={(v) => setAuthKind(v)}
|
|
|
|
|
+ options={authOptions}
|
|
|
|
|
+ style={{ width: 240 }}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Button type="primary" loading={saving} onClick={() => getNewVlessEnc(authKind)}>
|
|
|
|
|
+ {t('pages.inbounds.vlessAuthGenerateButton')}
|
|
|
</Button>
|
|
</Button>
|
|
|
<Button danger onClick={clearVlessEnc}>{t('clear')}</Button>
|
|
<Button danger onClick={clearVlessEnc}>{t('clear')}</Button>
|
|
|
</Space>
|
|
</Space>
|