shadowsocks.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { useTranslation } from 'react-i18next';
  2. import { Input, InputNumber, Select, Switch } from 'antd';
  3. import { FormField, rhfZodValidate } from '@/components/form/rhf';
  4. import { ShadowsocksOutboundFormSettingsSchema } from '@/schemas/forms/outbound-form';
  5. import { SSMethodSchema } from '@/schemas/protocols/shared/shadowsocks';
  6. import { SS_METHOD_OPTIONS } from '../outbound-form-constants';
  7. export default function ShadowsocksFields() {
  8. const { t } = useTranslation();
  9. return (
  10. <>
  11. <FormField
  12. label={t('password')}
  13. name={['settings', 'password']}
  14. rules={{ validate: rhfZodValidate(ShadowsocksOutboundFormSettingsSchema.shape.password) }}
  15. >
  16. <Input />
  17. </FormField>
  18. <FormField
  19. label={t('encryption')}
  20. name={['settings', 'method']}
  21. rules={{ validate: rhfZodValidate(SSMethodSchema) }}
  22. >
  23. <Select options={SS_METHOD_OPTIONS} />
  24. </FormField>
  25. <FormField
  26. label={t('pages.xray.outboundForm.udpOverTcp')}
  27. name={['settings', 'uot']}
  28. valueProp="checked"
  29. >
  30. <Switch />
  31. </FormField>
  32. <FormField label={t('pages.xray.outboundForm.uotVersion')} name={['settings', 'UoTVersion']}>
  33. <InputNumber min={1} max={2} />
  34. </FormField>
  35. </>
  36. );
  37. }