From f1e0622813bcba013087dee4fcadf2253e762200 Mon Sep 17 00:00:00 2001 From: ysakura99 <178342173+ysakura99@users.noreply.github.com> Date: Mon, 13 Jul 2026 23:42:07 -0700 Subject: [PATCH] fix(connections): show destination IP as host for raw-IP targets (#7483) * fix(connections): show destination IP as host for raw-IP targets When metadata.host is empty (a raw-IP CONNECT with no domain), the connection "Host" column fell back to remoteDestination (the outbounds relay/exit address) joined with the destination port, which misleadingly showed the relay as the connections destination. Fall back to metadata.destinationIP instead, in both the list column (getConnectionHost) and the detail panel. Closes #6669 * fix(connections): preserve fallback for empty destination IP --------- Co-authored-by: wonfen --- Changelog.md | 1 + src/components/connection/connection-detail.tsx | 6 +++--- src/components/connection/connection-row-view.ts | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Changelog.md b/Changelog.md index 254f1f38c..02b22d82e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -37,6 +37,7 @@ - 修复全局扩展脚本中的通配符配置可能生成无效 YAML 的问题 - 修复代理组筛选后定位及滚动位置恢复异常的问题 - 修复编辑订阅配置时清空 HTTP 请求超时会报错的问题 +- 修复纯 IP 连接的主机地址显示错误,并保留目标 IP 为空时的地址回退
✨ 新增功能 diff --git a/src/components/connection/connection-detail.tsx b/src/components/connection/connection-detail.tsx index b66698412..77cda53d7 100644 --- a/src/components/connection/connection-detail.tsx +++ b/src/components/connection/connection-detail.tsx @@ -73,9 +73,9 @@ const InnerConnectionDetail = ({ data, closed, onClose }: InnerProps) => { const theme = useTheme() const chains = [...data.chains].reverse().join(' / ') const rule = rulePayload ? `${data.rule}(${rulePayload})` : data.rule - const host = metadata.host - ? `${metadata.host}:${metadata.destinationPort}` - : `${metadata.remoteDestination}:${metadata.destinationPort}` + const hostAddress = + metadata.host || metadata.destinationIP || metadata.remoteDestination + const host = `${hostAddress}:${metadata.destinationPort}` const Destination = metadata.destinationIP ? metadata.destinationIP : metadata.remoteDestination diff --git a/src/components/connection/connection-row-view.ts b/src/components/connection/connection-row-view.ts index 1d7e7426d..de6a22997 100644 --- a/src/components/connection/connection-row-view.ts +++ b/src/components/connection/connection-row-view.ts @@ -57,9 +57,9 @@ export const getConnectionDestination = (connection: IConnectionsItem) => { export const getConnectionHost = (connection: IConnectionsItem) => { const { metadata } = connection - return metadata.host - ? `${metadata.host}:${metadata.destinationPort}` - : `${metadata.remoteDestination}:${metadata.destinationPort}` + const host = + metadata.host || metadata.destinationIP || metadata.remoteDestination + return `${host}:${metadata.destinationPort}` } export const getConnectionProcess = (connection: IConnectionsItem) => {