feat: 出口代理池(issue #14)— 免费源/导入 + MITM上游/网关/list_proxies 三入口 - #44
Open
Autumn-27 wants to merge 8 commits into
Open
feat: 出口代理池(issue #14)— 免费源/导入 + MITM上游/网关/list_proxies 三入口#44Autumn-27 wants to merge 8 commits into
Autumn-27 wants to merge 8 commits into
Conversation
- 会话发送键位改用 chat-send-mode 统一配置(CHAT_SEND_MODE_OPTIONS/ useChatSendMode),替换页面内自维护的模式常量。 - Web 搜索区新增代理输入框(http/socks5,留空为直连)。 Claude-Session: https://claude.ai/code/session_01RtPQYJ8W1mcaace3sHWGDm
补充工具描述:与任务无关的资产(如仅存静态资源的 CDN)必须设 related=false 或不插入,避免污染资产覆盖度分母。 Claude-Session: https://claude.ai/code/session_01RtPQYJ8W1mcaace3sHWGDm
出口代理池的地基,支持后续 list_proxies 工具(入口B)与 MITM 上游/网关(入口A/C)。 数据层: - proxies 表(连接拆分存 protocol/host/port/user/pass,去重键 (protocol,host,port); source/trusted 供安全阀门;anonymity/region 供筛选;质量字段 fail_streak/ok_count 等驱动自动禁用死代理 + 优先稳定节点)+ proxy_sources 表(免费源开关,默认全关) - db/proxies.go:ProxyStore CRUD / 导入去重 / UpsertFromSource / SelectForHost (每目标 host 粘性 + 质量排序)/ UpdateHealth(连续失败达阈值自动禁用)/ 源开关 - 密码明文存(与 llm_profiles.api_key 一致),前端序列化打码 proxypool 包: - dial/connect:http(s) CONNECT 隧道 + socks5/4 拨号(复用 x/net/proxy) - probe:通过代理探活 + 测延迟 - sources:内置格式稳定的 GitHub raw 源清单(默认关)+ 抓取解析 - pool:抓取 + 验活两个后台 loop(间隔可配,读设置每 tick 生效)+ 手动探活 server: - Manager 挂 proxyPool,启动/关闭;settings 键 proxy_pool_enabled / proxy_egress_trusted_only / 抓取·验活间隔;CRUD/导入/探活/源开关 API + 路由 前端: - 代理池管理页(system/proxies):源开关、节点列表、CRUD、批量导入、健康徽标、 可信/免费源标记、手动探活;侧边栏入口;types + api 验证:go build/vet/test(PG 相关测试本机无 DSN 跳过);纯逻辑测试通过; tsc + build:static + biome 通过。 Claude-Session: https://claude.ai/code/session_01Q8nhYZfS4H8fsSCBJXxbSy
给 agent 一个只读工具,按条件筛选代理池中健康节点,自己在命令里用 (curl -x / proxychains / nmap --proxies)轮换出口 IP。不改注入层。 - ToolSet 加 ps 字段 + SetProxyStore;新增 listProxies 工具(protocol/region/tag 过滤,仅返回 enabled+healthy,输出 address(scheme://host:port,含认证)/地区/匿名度/延迟) - 随代理池开关生效:db 导出 SettingProxyPoolEnabled + ProxyStore.PoolEnabled(), handler 在池关时返回"未启用",避免 agent 包依赖 server 包;server 主开关键复用该常量 - 加进 WorkerTools(自动 seed + 绑定给 worker);db.AssetStore.Proxies() passthrough - wiring:worker / assembly(auto/自定义 agent domainReg) / orchestration 处 SetProxyStore 系统提示词的代理池段落留到阶段3(与出口开关说明一起);工具 description 已说明用法。 验证:go build/vet/test 通过。 Claude-Session: https://claude.ai/code/session_01Q8nhYZfS4H8fsSCBJXxbSy
出口代理落地:代理池开关 × 流量录制开关自动决定 agent 出口,无需第三个"模式"。 入口A(MITM 上游,录制开+池开): - traffic.SetPoolUpstream 回调;SetUpstreamProxy 从池按目标 host 选上游(每 host 粘性) - 录制正常抓包,流量经 MITM 转发到池节点再到目标 入口C(代理池网关,录制关+池开): - proxypool/gateway.go:本地转发服务(CONNECT 隧道 + 普通 HTTP 转发),纯 TCP 不解密、 不抓包,适合证书 pinning / MITM 解不了的目标;CLI flag -proxy-pool-gateway(默认 127.0.0.1:8789) - 上游选择与入口A 共用 Manager.selectPoolUpstream(尊重 trusted-only 安全阀门) 注入逻辑(Manager.ProxyAddr/ProxyCACert): - 录制开→MITM 地址+CA;录制关+池开→网关地址+无CA(纯转发不注入 MITM CA,agent 直连目标做 TLS); 全关→直连 - 主开关切换设 changed=true 触发 agent 重建,让新出口生效 其他: - 协议收敛为 http/https/socks5(去掉 socks4:go-mitmproxy/x/net 均不支持) - 系统设置页加代理池开关 + 仅可信出口安全阀门;settings API 读写 4 个键;NewManager 加网关参数 - proxypool/dial+connect:http(s) CONNECT / socks5 拨号,入口C 与验活复用 - gateway_test:CONNECT 隧道回环 + host-only 选路 提示词:list_proxies 工具 description 已说明用法,系统提示词段落留作可选增强。 验证:go build/vet/test 全过(PG 测试本机跳过);tsc + build:static 通过;改动文件 lint 零新增。 Claude-Session: https://claude.ai/code/session_01Q8nhYZfS4H8fsSCBJXxbSy
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
代理池页每个源加"立即抓取"按钮,点击对该源抓取一次、入库并触发验活,不等定时。
- proxypool: 抽出 fetchSource(单源),新增 FetchSourceNow(手动抓取 + 新增节点即时验活);
fetchOnce 复用;不受源 enabled 限制,便于开启前先试抓
- server: POST /api/proxy-sources/{name}/fetch
- 前端: api.fetchProxySource + 源行抓取按钮(转圈/结果 toast)
Claude-Session: https://claude.ai/code/session_01Q8nhYZfS4H8fsSCBJXxbSy
免费源抓取后节点可能上千,一次全渲染会卡。改为服务端分页。
- db: ProxyFilter 加 Limit/Offset;ListProxies 支持分页;新增 CountProxies
(SelectForHost 不设 Limit,不受影响)
- server: GET /api/proxies 支持 ?page=&limit=,返回 {proxies,total}
- 前端: api.proxies 返回 {proxies,total};代理页接入 TablePagination
(默认每页 20,删除后重拉当前页修正 total 并补位)
Claude-Session: https://claude.ai/code/session_01Q8nhYZfS4H8fsSCBJXxbSy
免费代理是一次性的、会被重新抓取,验活失败没有保留价值。UpdateHealth 失败分支: - 免费源(trusted=false):直接 DELETE,不留 disabled 死记录占列表 - 手动/导入(trusted=true):保留重试,累计 fail_streak,达阈值才 auto-disable (用户手动加的,可能只是临时不可用,值得留着) 新增测试:免费源节点单次探测失败后即被删除。 Claude-Session: https://claude.ai/code/session_01Q8nhYZfS4H8fsSCBJXxbSy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
实现 issue #14「渗透侦察任务支持代理/代理池」:一套出口代理池,agent 打目标时可轮换出口 IP 防封。
代理池是共享资源,开放给两个正交入口,用户只拨两个独立开关(流量录制 × 代理池),接入方式自动决定:
外加入口B:
list_proxies只读工具,任何模式下 agent 可自行筛选健康代理,在命令里curl -x/proxychains用。分三阶段
proxies+proxy_sources表,连接拆分存、去重键(protocol,host,port)、质量字段驱动自动禁用死代理 + 优先稳定节点)+ 免费源抓取(内置稳定 GitHub raw 源,默认全关)+ 后台验活(间隔可配)+ 代理池管理页(CRUD/导入/源开关/健康徽标)。list_proxies只读工具(入口B),随代理池开关生效。proxypool/gateway.go纯 TCP 转发)+ 注入逻辑(网关模式不注入 MITM CA)+ 系统设置开关。安全设计
proxy_egress_trusted_only(默认开):主出口只轮换手动/导入的可信代理,免费源节点不进主出口(agent 仍可用list_proxies低敏感场景自选)。llm_profiles.api_key一致),API 返回时打码。协议
http / https / socks5(socks4 go-mitmproxy 与 x/net 均不支持,未纳入)。
Closes #14