From 84d04c2d9201b259ddf612b0c03463d0793d6685 Mon Sep 17 00:00:00 2001 From: mjbe71 Date: Tue, 24 Nov 2026 13:59:28 +0330 Subject: [PATCH] feat(xray): warn when a Dialer Proxy tag matches no outbound (#7099) An outbound whose Dialer Proxy names a tag that no longer exists was shown like any other choice, and Xray then failed the dial with no outbound handler for it. Show a warning under the field in the outbound form when the tag is not among the available outbounds. The host form stays silent: its Dialer Proxy resolves inside the subscriber's client config, so the server's outbound list cannot judge it. --- .../xray/outbounds/OutboundFormModal.tsx | 1 + .../xray/outbounds/transport/sockopt.tsx | 22 +++++- .../src/test/dialer-proxy-warning.test.tsx | 77 +++++++++++++++++++ internal/web/translation/ar-EG.json | 1 + internal/web/translation/en-US.json | 1 + internal/web/translation/es-ES.json | 1 + internal/web/translation/fa-IR.json | 1 + internal/web/translation/id-ID.json | 1 + internal/web/translation/ja-JP.json | 1 + internal/web/translation/pt-BR.json | 1 + internal/web/translation/ru-RU.json | 1 + internal/web/translation/sk-SK.json | 1 + internal/web/translation/tr-TR.json | 1 + internal/web/translation/uk-UA.json | 1 + internal/web/translation/vi-VN.json | 1 + internal/web/translation/zh-CN.json | 1 + internal/web/translation/zh-TW.json | 1 + 17 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 frontend/src/test/dialer-proxy-warning.test.tsx diff --git a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx index 09ac80a59..961bd48b0 100644 --- a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx +++ b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx @@ -591,6 +591,7 @@ export default function OutboundFormModal({ protocol === 'wireguard') && ( )} diff --git a/frontend/src/pages/xray/outbounds/transport/sockopt.tsx b/frontend/src/pages/xray/outbounds/transport/sockopt.tsx index 4610a618d..5c21b0d1d 100644 --- a/frontend/src/pages/xray/outbounds/transport/sockopt.tsx +++ b/frontend/src/pages/xray/outbounds/transport/sockopt.tsx @@ -1,6 +1,6 @@ import { useId } from 'react'; import { useTranslation } from 'react-i18next'; -import { Form, Input, InputNumber, Select, Switch } from 'antd'; +import { Form, Input, InputNumber, Select, Switch, Typography } from 'antd'; import { Controller, useFormContext, useWatch } from 'react-hook-form'; import { FormField } from '@/components/form/rhf'; @@ -15,13 +15,16 @@ import { ADDRESS_PORT_STRATEGY_OPTIONS } from '../outbound-form-constants'; interface SockoptFormProps { outboundTags?: string[]; + // Only valid where outboundTags is the set the dial actually resolves against. + warnMissingDialerProxy?: boolean; showDomainStrategy?: boolean; } // Freedom's own card writes the strategy into this same sockopt key, so it hides // this field rather than letting two controls fight over one value. export default function SockoptForm({ - outboundTags = [], + outboundTags, + warnMissingDialerProxy = false, showDomainStrategy = true, }: SockoptFormProps) { const { t } = useTranslation(); @@ -33,8 +36,14 @@ export default function SockoptForm({ '') as string; const happyEyeballs = useWatch({ control, name: 'streamSettings.sockopt.happyEyeballs' }); const hasHe = happyEyeballs != null; + // Unknown tags (still loading) must not read as missing, so only warn on a real list. + const dialerProxyMissing = + warnMissingDialerProxy && + !!dialerProxy && + !!outboundTags && + !outboundTags.includes(dialerProxy); const dialerProxyOptions = Array.from( - new Set([...outboundTags, dialerProxy].filter(Boolean)), + new Set([...(outboundTags ?? []), dialerProxy].filter(Boolean)), ).map((tg) => ({ value: tg, label: tg })); return ( <> @@ -56,6 +65,13 @@ export default function SockoptForm({ label={t('pages.inbounds.form.dialerProxy')} name={['streamSettings', 'sockopt', 'dialerProxy']} tooltip={t('pages.xray.outboundForm.dialerProxyHint')} + extra={ + dialerProxyMissing && ( + + {t('pages.xray.outboundForm.dialerProxyMissing')} + + ) + } >