chore: TCP ping now uses configured interface for accurate testing#396
Draft
Alex-WU-Gen-9-png wants to merge 3 commits intoSagit-chu:mainfrom
Draft
chore: TCP ping now uses configured interface for accurate testing#396Alex-WU-Gen-9-png wants to merge 3 commits intoSagit-chu:mainfrom
Alex-WU-Gen-9-png wants to merge 3 commits intoSagit-chu:mainfrom
Conversation
- Add missing interfaceName field to node list API response map - Fixes bug where interface name value disappears after page refresh - Field is correctly saved to DB but was not returned in API response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现象:之前的误解是由于——即使配置了
eth2作为出口接口,面板转发页面的"测试"按钮仍使用默认网络路径进行 TCP ping。根因:
TcpPing命令不支持接口绑定参数。TcpPingRequest结构体无interface字段tcpPingHost函数使用net.DialTimeout直连,无法指定本地地址tcpPingViaNode未读取节点的interfaceName配置Temped Solution:
Agent 端 (go-gost/x/socket/websocket_reporter.go):
Backend 端:
📊 Data Flow (After Fix)
Panel 测试按钮
↓
tcpPingViaNode(node, ip, port)
↓ 读取 node.InterfaceName = "eth2"
TcpPing { ip, port, interface: "eth2" }
↓ WebSocket
Agent handleTcpPing
↓ net.InterfaceByName("eth2")
↓ 获取接口 IP
net.Dialer{ LocalAddr: 192.168.1.100:0 }
↓
dialer.Dial("tcp", target) ← 使用指定接口出口