回复:Linux 构建、代理
首次公开证据
打开首次公开证据查看 1 个交叉存档
来源说明
Published on GitHub in February 2024 as part of Martti Malmi's testimony in the COPA v. Wright trial
太好了,我一直期待着参与 Linux 构建的工作。
如果你连接到 Freenode 的隐藏服务,他们会告诉你,由于滥用,他们也已在该服务上封禁 TOR,然后把你踢下线。你可以按一个包含若干步骤的流程,在 unix 上运行一个密码工具并通过电子邮件申请一个可用于登录的账户,但这就变得相当复杂了。我在想,我们能不能只申请一个账户,然后所有人共用同一个账户?我猜 IRC 服务器可能会限制每个账户只能登录一次,或者某个管理员可能不愿看到同一个账户有十几个登录。
除了 IRC 部分,你的代理测试进行得怎么样?因为你以前连接过,所以你的 addr.dat 包含已知节点的地址,但没有 IRC 来获知哪些节点在线,就需要很长时间才能找到它们。通常除你之外还有 1 到 3 个能够接受传入连接的节点,而已经知道你的现有节点最终会连接到你。你获得了多少个连接,花了多长时间?我想,要知道它是否成功通过 TOR 建立了出站连接,你需要在 debug.log 中搜索“connected”。
如果要在没有先正常连接一次以获得种子节点的情况下首次通过 TOR 连接,你必须知道一个能够接受传入连接的现有节点的地址,并像这样添加为种子节点: bitcoin -proxy=127.0.0.1:9050 -addnode=<ip of a node>
如果一些能够接受传入连接的节点愿意把自己的 IP 编入程序,它就可以自动获得种子节点。或者也可以把一些 IP 种子地址连同说明发布在 Wiki 页面上。
另一个选择是再次在全世界寻找一个不封禁 TOR 节点的 IRC 服务器。或者,我们也可以找人搭建一个。IRC 服务器封禁 TOR,是因为上面有真实的文字聊天……如果有一个上面只有机器人和垃圾内容的服务器,它就不会在意了。或许应该在论坛或邮件列表上发个问题,看看是否有人知道这样的服务器。
另一个问题是 TOR 用户无法接受传入连接,而我们能这样做的节点实在太少了。如果所有人都转向 TOR,就不会有任何节点可供连接。
我们缺少能够接受传入连接的节点。最近通常在 2 到 4 个之间。我们需要向人们强调在路由器上设置端口转发的重要性。每个 P2P 文件共享程序都有如何设置的说明。我们应该在 bitcoin.sourceforge.net 主页上放一段话,敦促人们设置端口转发以接受传入连接,并提供一个网站链接,说明每种路由器的设置方法。
我把目前已经移植的内容上传到了 svn/branches。Util、script、db 和头文件现在都能完整编译,net.cpp 能部分编译,所以还有工作要做。
_beginthread 没有直接对应的 Linux 实现,所以我改用了 Boost 线程。
我没能使用 Tor SOCKS 代理建立连接。这可能是因为 Freenode 的 Tor 政策要求连接到他们的隐藏服务:http://freenode.net/irc_servers.shtml#tor
heapchk() 只是一个未被使用的 MSVCRT 调试功能。它在 Linux 上可以是空操作。OpenSSL 在 Linux 上会自动使用 /dev/urandom 提供种子,所以 RandAddSeedPerfmon 也可以是空操作。
在我们彻底进行离线测试之前,不要让它连接到网络。如果你有两台电脑,请断开互联网,然后使用 "bitcoin -connect=<ip>" 让它们相互连接,一台运行 windows,一台运行 linux。-connect 允许你连接到 192.168.x.x 这样的不可路由地址。如果它向网络发出一些我们还没想到要检查的格式错误的垃圾,或者发现了其他会在网络上做出的反社会行为,我们不希望这损害网络可靠性的声誉。
等你有可以构建、可供测试的东西时,我有时间做一些测试。我可以把它加入我目前正在对迄今修改进行的压力测试。
我在 util.h 中做了一个 #ifdef,用 Linux 的 gettimeofday 替换 QueryPerformanceCounter。更新到 wxWidgets 2.9 后,一些 Unicode/ANSI 错误无需修改代码就解决了。目前我在 Linux 中遇到的唯一编译错误来自 util.h 中的 heapchk()。
我修复了遇到的一些不可移植的内容: QueryPerformanceCounter printf 格式字符串中的 %I64d Sleep CheckDiskSpace
如果你知道还有其他我应该修复的不可移植内容,请告诉我。
我想我会把 debug.log 和 db.log 移到与数据文件相同的目录(%appdata%\Bitcoin)中,而不是放在碰巧作为当前目录的地方。
英文原文
展开英文原文
Great, I've been looking forward to working on the Linux build.
If you connect to Freenode's hidden service, then they tell you they've also banned TOR from that due to abuse and it kicks you off. There's a several step procedure you can do to run a password utility on unix and e-mail request an account that you could login with, but that's getting pretty complicated. I wonder if we could get away with applying for one account and then everyone use the same account? I suppose the IRC server probably limits accounts to one login, or some admin might not like to see a dozen logins on the same account.
Besides the IRC part, how did your test of proxy go? Since you've been connected before, your addr.dat contains known node addresses, but without IRC to know which ones are online, it takes a long time to find them. There are normally 1 to 3 other nodes besides you that can accept incoming connections, and existing nodes that already know you would eventually connect to you. How many connections did you get, and how long did it take? I guess to know whether it successfully connected outbound through TOR you'd need to search debug.log for "connected".
To originally connect with TOR without connecting normally once to get seeded, you'd have to know the address of an existing node that can accept incoming connections and seed it like this: bitcoin -proxy=127.0.0.1:9050 -addnode=<ip of a node>
If some nodes that accept incoming connects were willing to have their IP coded into the program, it could seed automatically. Or some IP seed addresses posted on a Wiki page with the instructions.
Another option is to search the world again for an IRC server that doesn't ban TOR nodes. Or if we could get someone to set one up. IRC servers ban TOR because they have actual text chat on them... if there was one with just bots and junk then it wouldn't care. Probably should post a question on the forum or the mailing list and see if anyone knows one.
Another problem is that TOR users can't accept incoming connections, and we have so few that can. If everyone goes to TOR, there won't be any nodes to connect to.
We have a shortage of nodes that can accept incoming connections. It generally ranges from 2 to 4 lately. We need to emphasize the importance to people of setting up port forwarding on their router. Every P2P file sharing program has instructions how to do it. We should have a paragraph on the bitcoin.sourceforge.net homepage urging people to set up port forwarding to accept incoming connections, and a link to a site that describes how to do it for each router.
I uploaded what I've ported so far to the svn/branches. Util, script, db and the headers compile fully now and net.cpp partially, so there's still work to do.
_beginthread doesn't have a direct Linux equivalent, so I used Boost threads instead.
I couldn't get connected using the Tor SOCKS proxy. That might be because of the Freenode Tor policy which requires connecting to their hidden service: http://freenode.net/irc_servers.shtml#tor
heapchk() is just a MSVCRT debugging thing that's not being used. It can be a no-op on Linux. OpenSSL automatically uses /dev/urandom to seed on Linux, so RandAddSeedPerfmon can also be a no-op.
Don't let it connect to the network before we've tested it thoroughly off-net. If you have two computers, unplug the internet and use "bitcoin -connect=<ip>" to connect to each other, one windows and one linux. -connect will allow you to connect to non-routable addresses like 192.168.x.x. We don't want to reflect badly on the reliability of the network if it throws off some malformed crud we hadn't thought to check for yet, or discovers something else anti-social to do on the network.
I have time that I can do some testing when you've got something buildable to test. I can include it in the stress test I'm currently running on the changes so far.
I made an #ifdef to replace QueryPerformanceCounter with Linux's gettimeofday in util.h. Some Unicode/ANSI errors were resolved without code changes when I updated to wxWidgets 2.9. The only compile error I'm getting in Linux at the moment is from heapchk() in util.h.
I fixed some non-portable stuff I came across: QueryPerformanceCounter %I64d in printf format strings Sleep CheckDiskSpace
If there's any other unportable stuff you know of I should fix, let me know.
I think I'll move debug.log and db.log into the same directory as the data files (%appdata%\Bitcoin), rather than whatever the current directory happens to be.