mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-16 19:05:13 +03:00
feat(inbounds): TUN adapter type and auto-system options
xray-core 26.9 added three TUN settings the inbound form could not set: - desc, the tunnel type a new Wintun adapter is created with on Windows. The settings schema did not list it, so the parse stripped it and a value entered as JSON vanished on the next save; - autoSystemDnsToGateway (Linux), which points systemd-resolved at the TUN gateway; - autoSystemWfpBlockLeak (Windows), whose dns / misconfigtun filters keep traffic from leaking past the TUN. The tooltips name the platform each one acts on and what it needs, since the core refuses to build or start the TUN otherwise.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Form, Input, InputNumber, Space, Tooltip } from 'antd';
|
||||
import { Button, Form, Input, InputNumber, Select, Space, Switch, Tooltip } from 'antd';
|
||||
import { MinusOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { useFieldArray, useFormContext } from 'react-hook-form';
|
||||
|
||||
@@ -35,6 +35,12 @@ function StringList({ name, label, placeholder }: StringListProps) {
|
||||
);
|
||||
}
|
||||
|
||||
// xray-core 26.9.30 accepts exactly these autoSystemWfpBlockLeak values.
|
||||
const WFP_BLOCK_LEAK_OPTIONS = [
|
||||
{ value: 'dns', label: 'dns' },
|
||||
{ value: 'misconfigtun', label: 'misconfigtun' },
|
||||
];
|
||||
|
||||
export default function TunFields() {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
@@ -42,6 +48,13 @@ export default function TunFields() {
|
||||
<FormField name={['settings', 'name']} label={t('pages.inbounds.info.interfaceName')}>
|
||||
<Input placeholder="xray0" />
|
||||
</FormField>
|
||||
<FormField
|
||||
name={['settings', 'desc']}
|
||||
label={t('pages.inbounds.form.tunDesc')}
|
||||
tooltip={t('pages.inbounds.form.tunDescTooltip')}
|
||||
>
|
||||
<Input id="tun-desc" placeholder="Wintun" />
|
||||
</FormField>
|
||||
<FormField name={['settings', 'mtu']} label="MTU">
|
||||
<InputNumber min={0} />
|
||||
</FormField>
|
||||
@@ -77,6 +90,26 @@ export default function TunFields() {
|
||||
>
|
||||
<Input placeholder="auto" />
|
||||
</FormField>
|
||||
<FormField
|
||||
name={['settings', 'autoSystemDnsToGateway']}
|
||||
label={t('pages.inbounds.form.autoSystemDnsToGateway')}
|
||||
tooltip={t('pages.inbounds.form.autoSystemDnsToGatewayTooltip')}
|
||||
valueProp="checked"
|
||||
>
|
||||
<Switch id="tun-auto-dns-gateway" />
|
||||
</FormField>
|
||||
<FormField
|
||||
name={['settings', 'autoSystemWfpBlockLeak']}
|
||||
label={t('pages.inbounds.form.autoSystemWfpBlockLeak')}
|
||||
tooltip={t('pages.inbounds.form.autoSystemWfpBlockLeakTooltip')}
|
||||
>
|
||||
<Select
|
||||
id="tun-wfp-block-leak"
|
||||
mode="multiple"
|
||||
allowClear
|
||||
options={WFP_BLOCK_LEAK_OPTIONS}
|
||||
/>
|
||||
</FormField>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user