libtorrent dht 对等请求?
我一直在研究 libtorrent/rasterbar 的 python 绑定。 我想做的是生成一个新的“节点 ID”并将其重新通告给其他节点。
我读到需要创建一个“bencoded 字典”,并且我假设使用像force_dht_reannounce 这样的东西来宣布,这是正确的吗?
Ive been playing around with the python bindings for libtorrent/rasterbar.
What I wanted to do was generate a new 'node-id' and reannounce it to the other nodes.
I read that a 'bencoded dicionary' needs to be created and I assume announced using something like force_dht_reannounce, is this correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过创建会话状态文件来强制 libtorrent 使用 DHT 的特定节点 ID,并将其提供给
session::load_state()
函数。执行此操作后,您还需要通过调用session::stop_dht()
和session::start_dht()
来重新启动 DHT。您需要制作的会话状态的相关部分具有以下格式(编码):
如果您想保留会话状态的其余部分,首先调用 session::save_state() 可能是个好主意/code> 然后简单地插入/覆盖
node-id
字段。像这样的东西:
You can force libtorrent to use a specific node ID for the DHT by crafting a session-state file, and feed it to the
session::load_state()
function. Once you do this, you also need to restart the DHT by callingsession::stop_dht()
followed bysession::start_dht()
.The relevant parts of the session state you need to craft have the following format (bencoded):
If you want to keep the rest of the session state, it might be a good idea to first call
session::save_state()
and then simply insert/overwrite thenode-id
field.Something like this: