antigravity-proxy README

The project's README from github.com/yuaotian/antigravity-proxy. As one markdown file: README.md.

Antigravity Logo

Antigravity-Proxy

🚀 专为 Antigravity 编辑器打造:在中国也能无需 TUN 模式稳定走代理

Build Status License Platform C++17 MinHook

🇬🇧 English Version | 🇷🇺 Русская версия


📖 目录 / Table of Contents


🚨 先看这个:对话报错先排 IP / Read This First

先说结论:如果 Antigravity 的对话框里出现 Agent execution terminated due to error,请先排查代理出口 IP,不要先怀疑 DLL 没生效。

我们已经在真实现场里确认过,最容易误判的场景是:

这类问题的主因通常不是 DLL 失效,而是:

你现在应该先看哪两份日志

1. DLL 日志:证明“不是注入失效”

如果你在这份日志里看到类似下面这些关键行,说明 DLL 本身已经在工作:

在配置页开启 diagnostics.agent_ip_probe 后,DLL 会额外输出 IP 诊断日志:

2. Antigravity 应用日志:证明“真正失败的是 agent 执行链路”

如果你在这里看到:

那就说明:

最有效的排查顺序

  1. 先看 proxy-YYYYMMDD.log
    • 如果注入和 SOCKS5 都成功,说明 DLL 大概率没问题。
  2. 再看 %APPDATA%\\Antigravity\\logs\\<最新目录>\\ls-main.log
    • 如果有 User location is not supported for the API use.,优先排 IP。
  3. 优先更换非机房 / 非托管 / 普通 ISP / 住宅出口,再重试
    • 同一个国家(例如新加坡)下,不同 ASN / 不同类型出口,结果可能完全不同。
  4. 只有当 DLL 日志里根本没有注入成功、或根本没有代理握手成功时,才回头排 DLL。

一句话记忆点

Antigravity 对话报错时,先排出口 IP,再排 DLL。看到 location is not supported 基本优先看 IP。


📖 项目介绍 / Introduction

Antigravity-Proxy 是专门为 Antigravity 编辑器量身定制的 Windows 代理注入组件(DLL)。

它的目标很简单:让中国用户使用 Antigravity 时,不用开 Clash TUN 模式,也能把网络流量稳定交给你的 SOCKS5/HTTP 代理。

项目名 Antigravity-Proxy = Antigravity + Proxy:只把 Antigravity 相关进程的流量“拽”进代理里(别担心,不会全局接管)。

🎯 解决的痛点 / Problem Solved

你是否遇到过这些情况?

Antigravity-Proxy 就是来专治这个的。 它可以:

🌟 核心价值 / Core Value

传统方案 Antigravity-Proxy
需要 TUN 模式 无需 TUN
全局代理 精准代理指定进程
需要管理员权限 普通用户即可
配置复杂 放入 DLL 即用

⚠️ 环境要求 / Prerequisites

在使用本工具前,请确保系统已安装必要的运行库,否则可能无法正常启动目标程序。

常见问题:0xc0000142 错误

如果启动程序时遇到 错误代码 0xc0000142(如下图所示),通常是由于系统缺少 Windows 运行库导致的。

0xc0000142 错误截图

解决方案

请安装 微软常用运行库合集,该工具已包含在本仓库中:

📦 下载路径: microsoft\微软常用运行库合集-2025.exe

安装步骤:

  1. 进入本仓库的 microsoft 目录
  2. 运行 微软常用运行库合集-2025.exe
  3. 按照安装向导完成安装
  4. 重新启动目标程序

⚡ Antigravity 快速开始 / Quick Start

只想让 Antigravity 立刻能用?看这一节就够了。

Step 1: 准备代理 / Prepare a Proxy

启动你的代理软件(例如 Clash/Mihomo),确保本机有可用的 SOCKS5 或 HTTP 代理端口(如 127.0.0.1:7890)。

📋 常用代理软件端口速查表(点击展开)

各代理软件默认端口

代理软件 SOCKS5 端口 HTTP 端口 混合端口 备注
Clash / Clash Verge 7891 7890 7890 混合端口同时支持 SOCKS5 和 HTTP
Clash for Windows 7891 7890 7890 设置 → Ports 可查看/修改
Mihomo (Clash Meta) 7891 7890 7890 同 Clash 配置格式
V2RayN 10808 10809 - 设置 → 参数设置 → Core 基础设置
V2RayA 20170 20171 - 后台管理页面可修改
Shadowsocks 1080 - - 仅 SOCKS5,无 HTTP
ShadowsocksR 1080 - - 仅 SOCKS5,无 HTTP
Surge (Mac/iOS) 6153 6152 - 增强模式下端口可能不同
Qv2ray 1089 8889 - 首选项 → 入站设置
sing-box 自定义 自定义 自定义 需在配置文件中手动指定
NekoBox 2080 2081 - 设置 → 入站
Clash Meta for Android 7891 7890 7890 同 Clash 规则

💡 推荐使用 SOCKS5 协议:本工具对 SOCKS5 的支持更完善,建议优先使用。

如何确认代理端口是否开启?

方法 1:查看代理软件界面

  • 大多数代理软件会在主界面或设置中显示当前监听端口

方法 2:命令行测试

# 测试 SOCKS5 端口 (默认 7891)
Test-NetConnection -ComputerName 127.0.0.1 -Port 7891

# 测试 HTTP 端口 (默认 7890)
Test-NetConnection -ComputerName 127.0.0.1 -Port 7890

方法 3:curl 测试(需安装 curl)

# 通过 SOCKS5 代理访问
curl -x socks5://127.0.0.1:7891 https://www.google.com -I

# 通过 HTTP 代理访问
curl -x http://127.0.0.1:7890 https://www.google.com -I

常见端口问题及解决

问题 原因 解决方案
端口被占用 其他程序使用了该端口 `netstat -ano
连接被拒绝 代理软件未启动或端口错误 确认代理软件已启动,检查端口配置
代理无响应 防火墙阻止 检查 Windows 防火墙设置

Step 2: 准备文件 / Get the Files

Release 按架构和运行目标提供四个独立压缩包,下载时只选实际使用的一套:

每个压缩包还包含通用的 config-web.html 与 使用说明.md;自行编译时仍会在本地 output/ide、output/cli 生成两套目录。

Step 3: 部署到 Antigravity / Deploy to Antigravity

桌面端只复制 ide/ 内的文件到 Antigravity 主程序目录(与 Antigravity.exe 同级)。

如果使用 Antigravity CLI,只复制 cli/ 内的文件到 agy.exe 同级目录。dbghelp.dll 会在导出函数首次调用时加载唯一名称的 antigravity_proxy.dll,避开系统 version.dll 同名冲突。

ide/ 与 cli/ 不要混合复制;桌面端不需要 dbghelp.dll。

version.dll 与 config.json 必须来自同一次构建且架构一致。当前版本默认对宿主进程启用全量网络 Hook;启动日志应出现 使用全量模式,随后再以 OAuth 回调和业务请求日志做功能验收。

Antigravity 2.0 注意事项

Antigravity 2.0 新增/改名了关键进程,默认配置已覆盖:

"target_processes": [
  "agy.exe",
  "language_server.exe",
  "language_server_windows",
  "Antigravity.exe",
  "Antigravity IDE.exe",
  "node.exe"
]

如果你是从旧版本手动迁移 config.json,请确认 child_injection 仍为 true,并把上面的目标进程列表同步进去。2.0 环境如果存在多个启动目录,也要把 version.dll 和 config.json 放到实际启动的 Antigravity/IDE 目录中。

Antigravity 更新后可能清理安装目录里的劫持文件;如果更新后不走代理,请重新复制这些文件。若代理软件区分 mixed-port 和 SOCKS5 端口,也要确认 proxy.type 和 proxy.port 匹配本机实际监听端口。

更多现场记录见 docs/antigravity-2.0-issue-85.md。

Windows 常见目录 + 快速跳转

一般情况下 Antigravity 会装在:

例如:C:\Users\<用户名>\AppData\Local\Programs\Antigravity

如果你找不到这个目录:在桌面/开始菜单找到 Antigravity 图标,右键 → 打开文件所在的位置,跳出来的那个目录就是它的主程序目录。

想从命令行一键跳过去(少点鼠标,多点快乐):

cd "$env:LOCALAPPDATA\Programs\Antigravity"
cd /d "%LOCALAPPDATA%\Programs\Antigravity"

(可选)你也可以自己设个环境变量,之后就能 cd 秒过去:

setx ANTIGRAVITY_HOME "%LOCALAPPDATA%\Programs\Antigravity"

设置完后:PowerShell 用 cd $env:ANTIGRAVITY_HOME,CMD 用 cd /d %ANTIGRAVITY_HOME%。

🔧 故障排查自查手册 / Troubleshooting Guide

代理不工作?按照本手册逐步排查,找到问题根源。

📋 快速诊断流程图

代理不工作?
    │
    ├── 检查日志是否存在 ───────────────────────────────────┐
    │       │                                               │
    │       ├── ❌ 无日志 → DLL未加载/位置错误               │
    │       │       └── 见「DLL 加载问题」                   │
    │       │                                               │
    │       └── ✅ 有日志 → 继续检查日志内容                │
    │               │                                       │
    ├── 日志中有 "SOCKS5: 隧道建立成功" 吗? ────────────────┤
    │       │                                               │
    │       ├── ❌ 没有 → 代理连接失败                      │
    │       │       └── 见「代理软件排查」                   │
    │       │                                               │
    │       └── ✅ 有 → 隧道建立成功,问题在后续            │
    │               │                                       │
    └── 检查 Clash 日志和节点可用性 ──────────────────────────┘

🔍 第一步:检查日志文件

日志是排查问题的第一手资料。

日志位置(按优先级):

  1. <Antigravity安装目录>\logs\proxy-YYYYMMDD.log
  2. %TEMP%\antigravity-proxy-logs\proxy-YYYYMMDD.log

快速打开:

# 打开 DLL 目录的 logs 文件夹
cd "$env:LOCALAPPDATA\Programs\Antigravity\logs"

# 或打开 TEMP 目录
cd "$env:TEMP\antigravity-proxy-logs"

日志关键行解读:

日志内容 含义 状态
Antigravity-Proxy DLL 已加载 DLL 成功注入 ✅ 正常
配置加载成功 config.json 读取成功 ✅ 正常
所有 API Hook 安装成功 Hook 生效 ✅ 正常
ConnectEx Hook 已安装 异步连接 Hook 成功 ✅ 正常
SOCKS5: 隧道建立成功 代理连接成功 ✅ 正常
非 SOCK_STREAM socket 直连, soType=2 UDP 有效策略为 direct,或该端口未命中代理规则 ⚠️ 视配置而定
SOCKS5 握手失败 代理握手失败 ❌ 需排查
连接代理服务器失败 无法连接到代理 ❌ 需排查
WSA错误码=10061 连接被拒绝(代理未启动) ❌ 需排查
WSA错误码=10060 连接超时 ❌ 需排查

🌐 第二步:代理软件排查

2.1 确认代理端口可用

# 测试 SOCKS5/混合端口
Test-NetConnection -ComputerName 127.0.0.1 -Port 7890

# 如果 TcpTestSucceeded: False,说明端口未监听

2.2 确认 Clash 配置正确

在 Clash 配置文件中检查:

# 必须开启混合端口或 SOCKS5 端口
mixed-port: 7890     # 混合端口(推荐)
# 或
port: 7890           # HTTP 端口
socks-port: 7891     # SOCKS5 端口

# 如果需要局域网访问
allow-lan: true

2.3 检查 Clash 日志

在 Clash 界面查看「日志」或「Logs」,确认:

2.4 测试节点可用性

最简单的方法:直接开启 TUN 模式,如果 TUN 模式下 Antigravity 正常,说明节点没问题。


💻 第三步:系统环境排查

3.1 检查 Windows 版本

winver

不同 Windows 11 小版本的 Winsock 行为可能有差异。请记录版本号备用。

3.2 检查 Winsock LSP 配置

某些安全软件会注入 LSP(分层服务提供程序),可能干扰 Hook。

# 以管理员身份运行
netsh winsock show catalog

正常情况下只应该有 Microsoft 的 Provider。如果看到第三方 Provider(如 360、火绒等),可能会有兼容性问题。

3.3 检查安全软件

以下软件可能干扰 DLL 注入或 Hook:

软件 可能的影响 解决方案
360 安全卫士 拦截 DLL 注入、Hook 添加白名单或临时关闭
火绒安全 可能阻止远程线程注入 添加白名单
腾讯电脑管家 LSP 注入可能干扰网络 添加白名单
Windows Defender 通常不干扰 无需处理

临时排查:尝试完全退出安全软件后测试(不只是退到托盘,要完全退出)。

3.4 检查 IPv6 配置

如果系统启用了 IPv6,某些连接可能尝试 IPv6 优先:

# 查看网络适配器 IPv6 状态
Get-NetAdapterBinding -ComponentID ms_tcpip6

如果日志中出现大量 IPv6 相关内容,可以尝试在 config.json 中设置:

"proxy_rules": {
    "ipv6_mode": "block"
}

🔄 第四步:对比排查(与正常环境对比)

如果你的环境正常,但朋友的不行,请对比以下信息:

对比项 你的值 对方的值
Windows 版本 (winver)
Clash 版本
代理端口 7890
代理类型 socks5
是否有安全软件
netsh winsock show catalog 输出行数

📊 第五步:收集信息提交 Issue

如果以上排查都无法解决,请收集以下信息提交 GitHub Issue:

  1. 日志文件:完整的 proxy-YYYYMMDD.log 内容
  2. config.json:你的配置文件(隐藏敏感信息)
  3. Windows 版本:winver 输出
  4. Clash 版本和配置(端口设置部分)
  5. 安全软件列表:已安装的杀软/安全软件
  6. 问题描述:具体什么功能不工作?打开什么网站/功能时失败?

⚠️ 已知兼容性问题

问题 原因 解决方案
大量 非 SOCK_STREAM socket 直连, soType=2 UDP/QUIC 有效策略为 direct,或 UDP 代理未生效 优先使用 udp_mode=auto + proxy.type=socks5,并确认代理端支持 SOCKS5 UDP Associate
日志显示成功但网页打不开 Clash 规则、节点问题 检查 Clash 日志
某些请求绕过代理 应用使用了未 Hook 的 API 提交 Issue 反馈
360 等安全软件环境下失效 LSP 注入干扰 添加白名单或卸载

❓ DLL常见问题与错误码 / Common Errors and Error Codes

遇到问题时,建议先确认目标程序位数(x86/x64),并查看目标程序目录下的日志文件(如 proxy-YYYYMMDD.log)。

已知错误码

错误码 问题描述 可能原因 解决方案
0xC0000142 应用程序无法正常启动(已知:部分环境使用 x64 版本会出现此错误,切换到 x86 版本可以正常运行) 架构不兼容(目标程序为 x86,但放入了 x64 的 version.dll)
依赖库缺失或版本不匹配(常见:VC++ 运行库未安装/版本不一致)
安�

antigravity-proxy (yuaotian/antigravity-proxy)

Searching Database…

What is this?Antigravity-Proxy is a Windows DLL injector that forces the Antigravity code editor (and its CLI) to route its network traffic through your SOCKS5/HTTP proxy, without needing Clash's TUN mode.
Is this a standalone app, or files I drop into another program?It is not an app you run on its own — it is a set of prebuilt DLLs (version.dll/config.json for the desktop app, dbghelp.dll/antigravityproxy.dll/config.json for the CLI) that you copy next to Antigravity's executable; they load automatically when Antigravity starts.
How do I get this working with Antigravity?Start a proxy app like Clash/Mihomo with a SOCKS5 or HTTP port open, download the release zip matching your target (ide-win-x64/x86 for the desktop app, cli-win-x64/x86 for the CLI), then copy the files into the Antigravity install folder next to Antigravity.exe (or agy.exe for the CLI) and restart it.
What do I need installed before this works?A working SOCKS5 or HTTP proxy such as Clash, Mihomo or V2RayN, and the Microsoft Visual C++ runtime libraries — the repo bundles a runtime installer to avoid a 0xc0000142 startup error.
What are the common gotchas when setting this up?The DLL architecture (x86/x64) must match the target executable, ide/ and cli/ files must not be mixed, antivirus tools like 360 or Huorong can block injection through LSP interference, and Antigravity updates can wipe the injected files so you may need to recopy them afterward.
Does this work on macOS or Linux too?No, it is Windows-only — it works by hooking Winsock APIs inside Windows processes via DLL injection.
Why not just use Clash's TUN mode instead?TUN mode routes all system traffic through the proxy and needs admin rights; this tool only hijacks Antigravity-related processes, so the rest of your network stays untouched and no admin privileges are required.
I get 'User location is not supported' even though the proxy connects fine — what's wrong?That error means the agent-execution request was rejected based on your proxy's egress IP/ASN, not a failed DLL injection; switching to a non-datacenter, residential-type exit IP usually fixes it.
Does it support the Antigravity CLI, not just the desktop IDE?Yes — there are separate cli-win-x64/x86 release bundles with dbghelp.dll and antigravityproxy.dll for agy.exe, alongside the ide bundles for the desktop app.
Creator
yuaotian
Size
58.3 MB
Stars
4.5K
Age
9mo
Commits · 90 Days