包含的编码网络
1 分•作者: orbisvicis•4 个月前
这有点奇怪,因为它原本打算以“提问”的形式开始,现在却变成了一个混合的“展示/提问”。
提问是:我到底该如何使用 Codex 的代理网络?我希望 Codex 能够访问在其沙盒之外运行的本地服务(不是 MCP 服务器)。默认的 config.toml 文件附带了以下内容:
```
[permissions.network]
# enabled = true
# proxy_url = "http://127.0.0.1:43128"
# admin_url = "http://127.0.0.1:43129"
# enable_socks5 = false
# socks_url = "http://127.0.0.1:43130"
# enable_socks5_udp = false
# allow_upstream_proxy = false
# dangerously_allow_non_loopback_proxy = false
# dangerously_allow_non_loopback_admin = false
# dangerously_allow_all_unix_sockets = false
# mode = "limited" # limited | full
# allowed_domains = ["api.openai.com"]
# denied_domains = ["example.com"]
# allow_unix_sockets = ["/var/run/docker.sock"]
# allow_local_binding = false
```
我无法让它工作,所以我下载了 Codex 的源代码并让 Codex 指向它,但几个小时后,情况并没有好转。我曾想在这里提问,因为没有其他地方能 1000% 全力以赴地投入到人工智能中,但对于这样一个简单的问题,我决定同时尝试构建自己的网络容器……这真是个麻烦事。首先,我代理了本地流量,忘记了 codex 需要 openai.com/chatgpt.com 才能工作。然后我遇到了 systemd-resolved 绑定 :53 SO_BINDTODEVICE 的问题,这很可能是“自以为是”综合症的症状,所以我无法重定向 DNS。还有很多其他的“小问题”,但一周后,我认为这是一个对 Linux 网络非常有趣的深入研究。
总之,我在这里 [1] 提供的算是一个一次性的东西,但也是一个非常有用的构建网络命名空间容器的指南。希望它能成为其他人的有用路线图。
1. https://gist.github.com/orbisvicis/347fb8439b658fd6161486f3de1e1ea0
查看原文
This is a bit odd, because it was going to start off as an Ask, and now its a hybrid Show/Ask.<p>The ask being, how in the world do I make use of Codex's proxy networking? I wanted Codex to have access to local services (not MCP servers) running outside its bubblewrap. The default config.toml file ships with this:<p><pre><code> [permissions.network]
# enabled = true
# proxy_url = "http://127.0.0.1:43128"
# admin_url = "http://127.0.0.1:43129"
# enable_socks5 = false
# socks_url = "http://127.0.0.1:43130"
# enable_socks5_udp = false
# allow_upstream_proxy = false
# dangerously_allow_non_loopback_proxy = false
# dangerously_allow_non_loopback_admin = false
# dangerously_allow_all_unix_sockets = false
# mode = "limited" # limited | full
# allowed_domains = ["api.openai.com"]
# denied_domains = ["example.com"]
# allow_unix_sockets = ["/var/run/docker.sock"]
# allow_local_binding = false
</code></pre>
I couldn't get it to work, so I downloaded Codex's source code and pointed Codex at it, but after a few hours it hadn't fared any better. I was thinking about asking here because nowhere else is 1000% all-in on AI, but for such a simple question I decided to concurrently try building my own network container... Which was a pain in the butt. First I proxied local traffic, forgetting that codex needs openai.com/chatgpt.com to work. Then I ran into systemd-resolved binding :53 SO_BINDTODEVICE, likely a symptom of I-think-I-know-best-itis, so I couldn't redirect DNS. There were lots of other paper-cuts, but a week later I consider this a really interesting deep-dive into Linux networking.<p>Anyway what I have here [1] is somewhat of a one-off, but also a really useful guide to building a network namespace container. Hopefully it'll be a useful roadmap for others.<p>1. https://gist.github.com/orbisvicis/347fb8439b658fd6161486f3de1e1ea0