SniffingTab.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { useTranslation } from 'react-i18next';
  2. import { Checkbox, Form, Select, Switch } from 'antd';
  3. import { SNIFFING_OPTION } from '@/schemas/primitives';
  4. export default function SniffingTab({ sniffingEnabled }: { sniffingEnabled: boolean }) {
  5. const { t } = useTranslation();
  6. return (
  7. <>
  8. <Form.Item name={['sniffing', 'enabled']} label={t('enable')} valuePropName="checked">
  9. <Switch />
  10. </Form.Item>
  11. {sniffingEnabled && (
  12. <>
  13. <Form.Item name={['sniffing', 'destOverride']} wrapperCol={{ span: 24 }}>
  14. <Checkbox.Group>
  15. {Object.entries(SNIFFING_OPTION).map(([key, value]) => (
  16. <Checkbox key={key} value={value}>{key}</Checkbox>
  17. ))}
  18. </Checkbox.Group>
  19. </Form.Item>
  20. <Form.Item
  21. name={['sniffing', 'metadataOnly']}
  22. label={t('pages.inbounds.sniffingMetadataOnly')}
  23. valuePropName="checked"
  24. >
  25. <Switch />
  26. </Form.Item>
  27. <Form.Item
  28. name={['sniffing', 'routeOnly']}
  29. label={t('pages.inbounds.sniffingRouteOnly')}
  30. valuePropName="checked"
  31. >
  32. <Switch />
  33. </Form.Item>
  34. <Form.Item
  35. name={['sniffing', 'ipsExcluded']}
  36. label={t('pages.inbounds.sniffingIpsExcluded')}
  37. >
  38. <Select
  39. mode="tags"
  40. tokenSeparators={[',']}
  41. placeholder="IP/CIDR/geoip:*/ext:*"
  42. style={{ width: '100%' }}
  43. />
  44. </Form.Item>
  45. <Form.Item
  46. name={['sniffing', 'domainsExcluded']}
  47. label={t('pages.inbounds.sniffingDomainsExcluded')}
  48. >
  49. <Select
  50. mode="tags"
  51. tokenSeparators={[',']}
  52. placeholder="domain:*/ext:*"
  53. style={{ width: '100%' }}
  54. />
  55. </Form.Item>
  56. </>
  57. )}
  58. </>
  59. );
  60. }