Install
openclaw skills install wsl-proxyWSL2 HTTP proxy setup via Windows host. Automatically detects proxy running on Windows (Clash/V2Ray/SS/Surge etc.) and configures WSL2 environment variables. Trigger when users need to access blocked websites, configure VPN/proxy, or enable external network access from WSL2.
openclaw skills install wsl-proxy此机器为 WSL2 + Windows 代理工具环境。Skill 会自动扫描宿主机上运行的 HTTP 代理端口,无需用户指定端口号或代理地址。
技能安装路径:skills/wsl-proxy/
脚本目录:skills/wsl-proxy/scripts/
bash skills/wsl-proxy/scripts/detect_proxy.sh
自动扫描宿主机常见端口(7890, 7897, 1080, 10808, 10809, 8888, 8080, 9090, 6152 等),找到可达的 HTTP 代理。
eval "$(bash skills/wsl-proxy/scripts/setup_proxy.sh)"
自动检测 + 设置环境变量,一步到位。
bash skills/wsl-proxy/scripts/check_proxy.sh
显示端口检测结果、环境变量、外网连通性。
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}"
curl -s -o /dev/null -w '%{http_code}' https://www.google.com
# 200 → OK
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 |
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
└────────────────────────┘