import type { ReactNode } from 'react'; import { useTranslation } from 'react-i18next'; 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'; import { FormField } from '@/components/form/rhf'; interface StringListProps { name: string[]; label: ReactNode; placeholder: (index: number) => string; } function StringList({ name, label, placeholder }: StringListProps) { const { t } = useTranslation(); const { control } = useFormContext(); const { fields, append, remove } = useFieldArray({ control, name: name.join('.') }); return ( {fields.map((field, j) => ( ))} ); } // 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 ( <> (j === 0 ? '10.0.0.1/16' : 'fc00::1/64')} /> (j === 0 ? '1.1.1.1' : '8.8.8.8')} /> {t('pages.inbounds.info.autoSystemRoutes')} } placeholder={(j) => (j === 0 ? '0.0.0.0/0' : '::/0')} /> {t('pages.inbounds.form.autoOutboundsInterface')} } >