← 返回 Skills 市场
ham-5on

WSL Proxy

作者 Ham-5on · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
52
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install wsl-proxy
功能描述
WSL2 HTTP proxy setup via Windows host. Automatically detects proxy running on Windows (Clash/V2Ray/SS/Surge etc.) and configures WSL2 environment variables....
使用说明 (SKILL.md)

WSL2 Proxy — WSL2 代理上网方案

此机器为 WSL2 + Windows 代理工具环境。Skill 会自动扫描宿主机上运行的 HTTP 代理端口,无需用户指定端口号或代理地址。

技能安装路径:skills/wsl-proxy/ 脚本目录:skills/wsl-proxy/scripts/

快速上手

1️⃣ 检测代理

bash skills/wsl-proxy/scripts/detect_proxy.sh

自动扫描宿主机常见端口(7890, 7897, 1080, 10808, 10809, 8888, 8080, 9090, 6152 等),找到可达的 HTTP 代理。

2️⃣ 设置代理(当前 shell)

eval "$(bash skills/wsl-proxy/scripts/setup_proxy.sh)"

自动检测 + 设置环境变量,一步到位。

3️⃣ 检查完整状态

bash skills/wsl-proxy/scripts/check_proxy.sh

显示端口检测结果、环境变量、外网连通性。

4️⃣ 直接使用(不依赖脚本)

HOST_IP=$(ip route show default | awk '{print $3}')
for PORT in 7890 7897 1080 10808 10809 8888 8080 9090; do
    timeout 1 bash -c "echo > /dev/tcp/${HOST_IP}/${PORT}" 2>/dev/null && echo "Port ${PORT} reachable" && break
done
export http_proxy="http://${HOST_IP}:${PORT}"
export https_proxy="http://${HOST_IP}:${PORT}"

5️⃣ 验证

curl -s -o /dev/null -w '%{http_code}' https://www.google.com
# 200 → OK

6️⃣ 清除代理

eval "$(bash skills/wsl-proxy/scripts/unset_proxy.sh)"

永久生效

追加到 ~/.bashrc~/.zshrc

export host_ip=$(ip route show default | awk '{print $3}')
export http_proxy="http://${host_ip}:${PORT}"
export https_proxy="http://${host_ip}:${PORT}"

常见代理端口参考

工具 默认端口 协议
Clash / Clash Verge 7890, 7897 HTTP
V2Ray / Xray 10808, 10809 HTTP/SOCKS
Shadowsocks 1080 SOCKS5
Surge 6152 HTTP
Squid 3128 HTTP
Charles 8888 HTTP

故障排查

  • 端口全扫不到 → Windows 上代理工具未启动,检查任务栏图标
  • 端口可达但 403 → 代理工具的分流规则未包含目标域名
  • Git 不走代理git config --global http.proxy http://${host_ip}:${PORT}
  • 部分程序不走代理 → 某些程序不读 http_proxy,需单独配置

架构说明

┌────────────────────────┐
│   Windows Host          │
│   Clash/V2Ray/SS etc.   │  ← HTTP proxy (auto-detected port)
└────────┬───────────────┘
         │ 172.x.x.1 (gateway IP)
         ▼
┌────────────────────────┐
│   WSL2 Linux            │
│   curl → http_proxy     │  ← via gateway IP
└────────────────────────┘
安全使用建议
This skill is reasonable for WSL2 proxy setup. Review the shell output before using the eval command, remember that enabling http_proxy and https_proxy can route later command-line traffic through the Windows proxy, and only make the bashrc/zshrc change if you want the proxy to persist across sessions.
功能分析
Type: OpenClaw Skill Name: wsl-proxy Version: 1.0.0 The wsl-proxy skill is a utility designed to automate the configuration of HTTP proxy settings in a WSL2 environment by detecting proxy services running on the Windows host. The scripts (detect_proxy.sh, setup_proxy.sh, etc.) use standard networking commands to identify the host gateway and scan common proxy ports (e.g., 7890, 10809). No evidence of data exfiltration, malicious persistence, or obfuscation was found; the use of eval in setup_proxy.sh is a standard pattern for modifying shell environment variables and is restricted to the script's own output.
能力评估
Purpose & Capability
The stated purpose is WSL2 proxy setup, and the included scripts detect the WSL gateway, check common proxy ports, and emit proxy environment variables consistent with that purpose.
Instruction Scope
The setup flow uses eval to apply generated shell commands in the current shell. This is disclosed and scoped to proxy environment variables, but users should only run it from the reviewed skill path.
Install Mechanism
There is no package install, remote script download, or hidden installer; the shell scripts are included in the provided file manifest.
Credentials
The scripts perform local gateway port probing and external connectivity checks, which are proportionate for proxy discovery but may be visible to the local proxy or test websites.
Persistence & Privilege
Persistent proxy configuration is presented as an optional user action for shell startup files; the provided scripts do not automatically modify those files.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install wsl-proxy
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /wsl-proxy 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: auto-detect Windows HTTP proxy port from WSL2, configure environment variables, verify connectivity
元数据
Slug wsl-proxy
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

WSL Proxy 是什么?

WSL2 HTTP proxy setup via Windows host. Automatically detects proxy running on Windows (Clash/V2Ray/SS/Surge etc.) and configures WSL2 environment variables.... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 52 次。

如何安装 WSL Proxy?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install wsl-proxy」即可一键安装,无需额外配置。

WSL Proxy 是免费的吗?

是的,WSL Proxy 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

WSL Proxy 支持哪些平台?

WSL Proxy 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 WSL Proxy?

由 Ham-5on(@ham-5on)开发并维护,当前版本 v1.0.0。

💬 留言讨论