使用 libtorrent 获取 Bittorrent DHT 消息的所有字段

Get all fields of Bittorrent DHT messages using libtorrent

我有兴趣使用 libtorrent 为 visualize/analyze BitTorrent 主线 DHT 编写一些代码。

我的计划是使用提醒 api 并订阅所有 dht_notification。但是,某些通知不包括 KRPC 消息的所有字段(例如 dht_get_peers_alert 不包括 IP 地址)。

我应该修改警报框架,还是有更好的方法?

获得对所有 DHT 流量的完全访问权限的最简单方法是订阅 dht_log_category 警报并查找 dht_pkt_alert,其中将包含整个 DHT 消息的逐字副本,对于任何传入和传出数据包。