diff --git a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx
index c1e54a54..e323d87e 100644
--- a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx
+++ b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx
@@ -13,12 +13,9 @@ import {
Tabs,
message,
} from 'antd';
-import { DeleteOutlined, MinusOutlined, PlusOutlined, ReloadOutlined } from '@ant-design/icons';
-
import { FinalMaskForm } from '@/lib/xray/forms/transport';
import { HeaderMapEditor } from '@/components/form';
import { HysteriaMasqueradeForm } from '@/lib/xray/forms/protocols/shared';
-import { InputAddon } from '@/components/ui';
import { JsonEditor } from '@/components/form';
import { Wireguard } from '@/utils';
import {
@@ -39,7 +36,6 @@ import {
DOMAIN_STRATEGY_OPTION,
SNIFFING_OPTION,
TCP_CONGESTION_OPTION,
- WireguardDomainStrategy,
} from '@/schemas/primitives';
import {
HappyEyeballsSchema,
@@ -75,6 +71,7 @@ import {
} from './outbound-form-helpers';
import { OutboundOnlyProtocolFields } from './outbound-only-fields';
import { FreedomOutboundFields } from './outbound-freedom-fields';
+import { WireguardOutboundFields } from './outbound-wireguard-fields';
import './OutboundFormModal.css';
// Pattern A rewrite of OutboundFormModal. Built as a sibling `.new.tsx`
@@ -582,136 +579,7 @@ export default function OutboundFormModal({
)}
- {protocol === 'wireguard' && (
- <>
-
-
-
-
-
-
-
-
- }
- onClick={() => {
- const pair = Wireguard.generateKeypair();
- form.setFieldValue(['settings', 'secretKey'], pair.privateKey);
- form.setFieldValue(['settings', 'pubKey'], pair.publicKey);
- }}
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {(fields, { add, remove }) => (
- <>
-
- }
- onClick={() =>
- add({
- publicKey: '',
- psk: '',
- allowedIPs: ['0.0.0.0/0', '::/0'],
- endpoint: '',
- keepAlive: 0,
- })
- }
- />
-
- {fields.map((field, index) => (
-
- ))}
- >
- )}
-
- >
- )}
+ {protocol === 'wireguard' && }
{streamAllowed && network && (
<>
diff --git a/frontend/src/pages/xray/outbounds/outbound-wireguard-fields.tsx b/frontend/src/pages/xray/outbounds/outbound-wireguard-fields.tsx
new file mode 100644
index 00000000..c6a85aad
--- /dev/null
+++ b/frontend/src/pages/xray/outbounds/outbound-wireguard-fields.tsx
@@ -0,0 +1,142 @@
+import { useTranslation } from 'react-i18next';
+import { Button, Form, Input, InputNumber, Select, Space, Switch, type FormInstance } from 'antd';
+import { DeleteOutlined, MinusOutlined, PlusOutlined, ReloadOutlined } from '@ant-design/icons';
+
+import { Wireguard } from '@/utils';
+import { InputAddon } from '@/components/ui';
+import { WireguardDomainStrategy } from '@/schemas/primitives';
+import type { OutboundFormValues } from '@/schemas/forms/outbound-form';
+
+export function WireguardOutboundFields({ form }: { form: FormInstance }) {
+ const { t } = useTranslation();
+ return (
+ <>
+
+
+
+
+
+
+
+
+ }
+ onClick={() => {
+ const pair = Wireguard.generateKeypair();
+ form.setFieldValue(['settings', 'secretKey'], pair.privateKey);
+ form.setFieldValue(['settings', 'pubKey'], pair.publicKey);
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {(fields, { add, remove }) => (
+ <>
+
+ }
+ onClick={() =>
+ add({
+ publicKey: '',
+ psk: '',
+ allowedIPs: ['0.0.0.0/0', '::/0'],
+ endpoint: '',
+ keepAlive: 0,
+ })
+ }
+ />
+
+ {fields.map((field, index) => (
+
+ ))}
+ >
+ )}
+
+ >
+ );
+}