BeyondDimension / BeyondDimension/SteamTools
👑[Enhancement]
- Dominant language
- C#
- Stars
- 26.8k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
## 🔍 根因分析
当前加速方案的核心问题:
1. **hosts 劫持 + 本地反代 = 单点故障**:域名一旦被指向 `127.0.0.1`,所有流量完全依赖本地代理服务。代理挂了 = 全挂,没有任何降级机制。
2. **无健康检查**:写入 hosts 后,没有验证本地代理是否真正在 443 端口监听并正常工作。
3. **关闭加速后 hosts 残留**:关闭 GitHub 加速开关后,部分条目可能未被清理(需要用户手动刷新 DNS 缓存才能恢复)。
4. **影响范围过大**:一次操作劫持 20+ 个 GitHub 子域名,影响 git 操作、API 调用、网页访问等全部场景。
## 💡 建议
1. **添加健康检查**:写入 hosts 后,立即验证本地代理是否正常工作。如果检测到代理未启动或 443 端口无响应,自动回滚 hosts 修改并提示用户。
2. **考虑替代方案**:使用系统代理(`netsh winhttp set proxy`)或 PAC 文件代替 hosts 劫持。系统代理方案可以随时关闭,不会造成"改了 hosts 但代理没跑"的死锁。
3. **确保 hosts 清理**:关闭加速时务必完整清理所有写入的 hosts 条目,并自动刷新 DNS 缓存(`ipconfig /flushdns`)。
4. **降级策略**:如果本地代理启动失败,至少应该恢复直连状态,而不是让域名持续指向一个无法响应的 `127.0.0.1`。
## 🚑 基本信息
- 程序版本:Watt Toolkit 最新版
- 系统版本号:Windows 11 22631
- 加速模式:默认(hosts 劫持 + YARP 反代)
## 📎 相关 Issue
- #954 GitHub 反代失败 Empty Response
- #2872 StartProxyFail:BindPortError
- #2784 无法下载 GitHub 源码(hosts 加速模式问题)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the GitHub acceleration implementation that writes hosts entries and the YARP reverse-proxy startup and cleanup paths. Review how proxy health, hosts rollback, complete removal, and DNS cache flushing are currently handled. Done should include a safe fallback when the proxy is unavailable, reliable cleanup when acceleration is disabled, and a clear decision on the system-proxy or PAC alternative.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100