windows-remote-desktop-connection-doctor by daymade/claude-code-skills
npx skills add https://github.com/daymade/claude-code-skills --skill windows-remote-desktop-connection-doctor在 macOS 上诊断和修复 Windows 应用(AVD/WVD/W365)的连接质量问题,重点关注传输协议优化。
Azure 虚拟桌面传输优先级:UDP 短路径 > TCP > WebSocket。UDP 短路径提供最佳体验(最低延迟,支持 UDP 多播)。当它失败时,客户端会通过网关回退到 TCP 443 上的 WebSocket,这会增加显著的延迟开销。
请用户提供 Windows 应用中的连接信息(点击工具栏中的信号图标)。需要提取的关键字段:
| 字段 | 说明 |
|---|---|
| 传输协议 | 当前传输:UDP、UDP Multicast、WebSocket 或 TCP |
| 往返时间 (RTT) | 端到端延迟(毫秒) |
| 可用带宽 | 当前带宽(Mbps) |
| 网关 | AVD 网关主机名和端口 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 服务区域 | Azure 区域代码(例如,SEAS = 东南亚) |
如果传输协议是 UDP 或 UDP Multicast,则连接是最优的——无需进一步诊断。
如果传输协议是 WebSocket 或 TCP,请继续步骤 2。
并行收集证据——不要做假设。同时运行以下检查:
ifconfig | grep -E "^[a-z]|inet |utun"
netstat -rn | head -40
scutil --proxy
查找:
0/1 + 128.0/1 → utun 模式意味着 VPN 捕获了所有流量# 查找 Windows 应用进程(不是 "msrdc" —— 新客户端使用 "Windows" 作为进程名)
ps aux | grep -i -E 'msrdc|Windows' | grep -v grep
# 检查其网络连接
lsof -i -n -P 2>/dev/null | grep -i "Windows" | head -20
# 检查 UDP 连接
lsof -i UDP -n -P 2>/dev/null | head -30
需要查找的关键证据:
198.18.0.x:流量正通过 ShadowRocket/代理 TUN 隧道路由# 环境代理变量
env | grep -i proxy
# 通过 scutil 的系统代理
scutil --proxy
# ShadowRocket 配置 API(如果在本地网络可访问)
NO_PROXY="<local-ip>" curl -s --connect-timeout 5 "http://<local-ip>:8080/api/read"
tailscale status
tailscale netcheck
netcheck 输出揭示了 NAT 类型(MappingVariesByDestIP)、UDP 支持和公共 IP——即使 Tailscale 不是问题所在,这些信息也很有价值。
这是最关键的一步。Windows 应用日志包含传输协商细节,这是任何网络级测试都无法揭示的。
macOS 上的日志位置:
~/Library/Containers/com.microsoft.rdc.macos/Data/Library/Logs/Windows App/
文件命名格式:com.microsoft.rdc.macos_v<version>_<date>_<time>.log
有关详细的日志解析指南,请参阅 references/windows_app_log_analysis.md。
LOG_DIR=~/Library/Containers/com.microsoft.rdc.macos/Data/Library/Logs/Windows\ App
# 查找最新的日志
LATEST_LOG=$(ls -t "$LOG_DIR"/*.log 2>/dev/null | head -1)
# 搜索传输关键条目(过滤掉噪音)
grep -i -E "STUN|TURN|VPN|Routed|Shortpath|FetchClient|clientoption|GATEWAY.*ERR|Certificate.*valid|InternetConnectivity|Passed URL" "$LATEST_LOG" | grep -v "BasicStateManagement\|DynVC\|dynvcstat\|asynctransport"
| 日志模式 | 含义 |
|---|---|
Passed: InternetConnectivity | 健康检查成功完成 |
TCP/IP Traffic Routed Through VPN: No/Yes | 客户端检测到 TCP 流量的 VPN 路由 |
STUN/TURN Traffic Routed Through VPN: Yes | 客户端检测到 STUN/TURN 流量的 VPN 路由 |
Passed URL: https://...wvd.microsoft.com/ Response Time: Nms | 网关可达性已确认 |
FetchClientOptions exception: Request timed out | 关键:客户端无法从网关获取传输选项 |
Certificate validation failed | 检测到 TLS 拦截或 DNS 污染 |
OnRDWebRTCRedirectorRpc rtcSession not handled | WebRTC 会话设置未被客户端处理 |
如果可能,将连接正常(UDP)时的日志与当前日志进行比较:
# 比较启动健康检查块
for f in "$LOG_DIR"/*.log; do
echo "=== $(basename "$f") ==="
grep -E "InternetConnectivity|Routed Through VPN|Passed URL|FetchClient" "$f" | head -10
echo ""
done
正常的日志将包含完整的健康检查块(InternetConnectivity、VPN 路由检测、网关 URL 测试)。异常的日志可能完全缺少这些条目,或者显示证书/超时错误。
根据收集到的证据,确定根本原因类别:
证据:Windows 应用源 IP 是 198.18.0.x,STUN/TURN 通过 VPN 路由,没有 UDP 连接。
修复:在代理工具中为 AVD 流量添加 DIRECT 规则:
DOMAIN-SUFFIX,wvd.microsoft.com,DIRECT
DOMAIN-SUFFIX,microsoft.com,DIRECT
IP-CIDR,13.104.0.0/14,DIRECT
验证:临时禁用 VPN/代理,重新连接 VDI,检查传输是否更改为 UDP。
证据:即使关闭所有 VPN,仍然是 WebSocket。没有 UDP 连接。FetchClientOptions 超时。
验证:
# 测试到已知服务器的 STUN 连接性
python3 -c "
import socket, struct, os
header = struct.pack('!HHI', 0x0001, 0, 0x2112A442) + os.urandom(12)
for srv in [('stun.l.google.com', 19302), ('stun1.l.google.com', 19302)]:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(3)
s.sendto(header, srv)
data, addr = s.recvfrom(1024)
print(f'STUN from {srv[0]}: OK')
s.close(); break
except: print(f'STUN from {srv[0]}: FAILED'); s.close()
"
修复选项:
证据:日志显示启动时证书验证错误,日志中缺少健康检查块(InternetConnectivity、STUN/TURN 检测),FetchClientOptions 超时。
这意味着客户端无法完成其诊断/能力发现,从而阻止了短路径协商。
可能的原因:
修复选项:
证据:日志显示完全没有 STUN/TURN 或短路径相关条目(甚至没有检测到),但健康检查通过且没有错误。
这意味着 AVD 主机池未启用 RDP 短路径。这需要在 Azure 门户上进行管理员操作。
应用修复后,重新连接 VDI 会话并验证:
UDP 或 UDP Multicastlsof -i UDP -n -P 2>/dev/null | grep -i "Windows"
# 如果短路径处于活动状态,应显示 UDP 连接
每周安装次数
33
代码仓库
GitHub 星标数
636
首次出现
2026年2月15日
安全审计
安装于
codex29
gemini-cli28
opencode28
github-copilot27
cursor26
amp25
Diagnose and fix Windows App (AVD/WVD/W365) connection quality issues on macOS, with focus on transport protocol optimization.
Azure Virtual Desktop transport priority: UDP Shortpath > TCP > WebSocket. UDP Shortpath provides the best experience (lowest latency, supports UDP Multicast). When it fails, the client falls back to WebSocket over TCP 443 through the gateway, adding significant latency overhead.
Ask the user to provide the Connection Info from Windows App (click the signal icon in the toolbar). Key fields to extract:
| Field | What It Tells |
|---|---|
| Transport Protocol | Current transport: UDP, UDP Multicast, WebSocket, or TCP |
| Round-Trip Time (RTT) | End-to-end latency in ms |
| Available Bandwidth | Current bandwidth in Mbps |
| Gateway | The AVD gateway hostname and port |
| Service Region | Azure region code (e.g., SEAS = South East Asia) |
If Transport Protocol is UDP or UDP Multicast, the connection is optimal — no further diagnosis needed.
If Transport Protocol is WebSocket or TCP, proceed to Step 2.
Gather evidence in parallel — do NOT make assumptions. Run the following checks simultaneously:
ifconfig | grep -E "^[a-z]|inet |utun"
netstat -rn | head -40
scutil --proxy
Look for:
0/1 + 128.0/1 → utun pattern means a VPN captures all traffic# Find the Windows App process (NOT "msrdc" — the new client uses "Windows" as process name)
ps aux | grep -i -E 'msrdc|Windows' | grep -v grep
# Check its network connections
lsof -i -n -P 2>/dev/null | grep -i "Windows" | head -20
# Check for UDP connections
lsof -i UDP -n -P 2>/dev/null | head -30
Key evidence to look for:
198.18.0.x: Traffic is being routed through ShadowRocket/proxy TUN tunnel# Environment proxy variables
env | grep -i proxy
# System proxy via scutil
scutil --proxy
# ShadowRocket config API (if accessible on local network)
NO_PROXY="<local-ip>" curl -s --connect-timeout 5 "http://<local-ip>:8080/api/read"
tailscale status
tailscale netcheck
The netcheck output reveals NAT type (MappingVariesByDestIP), UDP support, and public IP — valuable even when Tailscale is not the problem.
This is the most critical step. Windows App logs contain transport negotiation details that no network-level test can reveal.
Log location on macOS:
~/Library/Containers/com.microsoft.rdc.macos/Data/Library/Logs/Windows App/
Files are named: com.microsoft.rdc.macos_v<version>_<date>_<time>.log
See references/windows_app_log_analysis.md for detailed log parsing guidance.
LOG_DIR=~/Library/Containers/com.microsoft.rdc.macos/Data/Library/Logs/Windows\ App
# Find the most recent log
LATEST_LOG=$(ls -t "$LOG_DIR"/*.log 2>/dev/null | head -1)
# Search for transport-critical entries (filter out noise)
grep -i -E "STUN|TURN|VPN|Routed|Shortpath|FetchClient|clientoption|GATEWAY.*ERR|Certificate.*valid|InternetConnectivity|Passed URL" "$LATEST_LOG" | grep -v "BasicStateManagement\|DynVC\|dynvcstat\|asynctransport"
| Log Pattern | Meaning |
|---|---|
Passed: InternetConnectivity | Health check completed successfully |
TCP/IP Traffic Routed Through VPN: No/Yes | Client detected VPN routing for TCP |
STUN/TURN Traffic Routed Through VPN: Yes | Client detected VPN routing for STUN/TURN |
Passed URL: https://...wvd.microsoft.com/ Response Time: Nms | Gateway reachability confirmed |
FetchClientOptions exception: Request timed out | Critical : Client cannot get transport options from gateway |
When possible, compare a log from when the connection worked (UDP) with the current log:
# Compare startup health check blocks
for f in "$LOG_DIR"/*.log; do
echo "=== $(basename "$f") ==="
grep -E "InternetConnectivity|Routed Through VPN|Passed URL|FetchClient" "$f" | head -10
echo ""
done
A working log will contain the full health check block (InternetConnectivity, VPN routing detection, gateway URL tests). A broken log may show these entries missing entirely, or show certificate/timeout errors instead.
Based on collected evidence, identify the root cause category:
Evidence : Windows App source IP is 198.18.0.x, STUN/TURN routed through VPN, no UDP connections.
Fix : Add DIRECT rules for AVD traffic in the proxy tool:
DOMAIN-SUFFIX,wvd.microsoft.com,DIRECT
DOMAIN-SUFFIX,microsoft.com,DIRECT
IP-CIDR,13.104.0.0/14,DIRECT
Verify : Temporarily disable VPN/proxy, reconnect VDI, check if transport changes to UDP.
Evidence : Even with all VPNs off, still WebSocket. No UDP connections. FetchClientOptions timeout.
Verify :
# Test STUN connectivity to a known server
python3 -c "
import socket, struct, os
header = struct.pack('!HHI', 0x0001, 0, 0x2112A442) + os.urandom(12)
for srv in [('stun.l.google.com', 19302), ('stun1.l.google.com', 19302)]:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(3)
s.sendto(header, srv)
data, addr = s.recvfrom(1024)
print(f'STUN from {srv[0]}: OK')
s.close(); break
except: print(f'STUN from {srv[0]}: FAILED'); s.close()
"
Fix options :
Evidence : Log shows certificate validation errors at startup, health check block (InternetConnectivity, STUN/TURN detection) missing from log, FetchClientOptions timeout.
This means the client cannot complete its diagnostic/capability discovery, preventing Shortpath negotiation.
Possible causes :
Fix options :
Evidence : Log shows no STUN/TURN or Shortpath related entries at all (not even detection), but health checks pass and no errors.
This means the AVD host pool does not have RDP Shortpath enabled. This requires admin action on the Azure portal.
After applying a fix, reconnect the VDI session and verify:
UDP or UDP Multicastlsof -i UDP -n -P 2>/dev/null | grep -i "Windows"
# Should show UDP connections if Shortpath is active
Weekly Installs
33
Repository
GitHub Stars
636
First Seen
Feb 15, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
codex29
gemini-cli28
opencode28
github-copilot27
cursor26
amp25
imsg 命令行工具:macOS 上读取和发送 iMessage/SMS 的终极指南
629 周安装
Datadog自动化监控:通过Rube MCP与Composio实现指标、日志、仪表板管理
69 周安装
Intercom自动化指南:通过Rube MCP与Composio实现客户支持对话管理
69 周安装
二进制初步分析指南:使用ReVa工具快速识别恶意软件与逆向工程
69 周安装
PrivateInvestigator 道德人员查找工具 | 公开数据调查、反向搜索与背景研究
69 周安装
TorchTitan:PyTorch原生分布式大语言模型预训练平台,支持4D并行与H100 GPU加速
69 周安装
screenshot 截图技能:跨平台桌面截图工具,支持macOS/Linux权限管理与多模式捕获
69 周安装
Certificate validation failed | TLS interception or DNS poisoning detected |
OnRDWebRTCRedirectorRpc rtcSession not handled | WebRTC session setup not handled by client |