Torrent 文件协议 - 自定义字段
我想知道 .torrent 文件中是否有任何可用字段可用于某人的 torrent 客户端实现中的某些自定义功能?例如,有人可能想要对文件所有者网站的 URL 进行编码,其他人可能想在打开文件时显示一些自定义消息,等等。在 .torrent 文件的当前实现中,这样的事情是否可行?
I am wondering if there is any available field in the .torrent files that could be used for some custom functionality in someone's implementation of a torrent client? For example, one might want to encode an URL to the file owner's website, someone else - some custom message to be displayed when opening the files, etc. Is something like this feasible in the current implementation of .torrent files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。
.torrent
文件只是 bencoded 字典,可以保存任意键值对。添加自定义字段时的主要考虑因素是确定它是否应该进入 .torrent 的根目录或
info
字典内。如果它进入根目录,则不会影响信息哈希(这是种子的唯一标识符),并且在下载磁力链接时也将不可用。
如果它进入信息字典,它就有点锁定到信息哈希,从某种意义上说,信息哈希依赖于它。下载磁力链接时,它将作为元数据的一部分进行传输,并且无法更改(无需更改信息哈希,从而创建单独的群)。
因此,如果您希望第三方在创建 torrent 后能够对其进行更改,则应将其放入根目录中,如果您希望在创建 torrent 时输入一次且永不更改,则应将其放入信息中字典。
Yes.
.torrent
files are just bencoded dictionaries and can hold arbitrary key-value pairs.The main consideration when adding a custom field is to determine whether it should go into the root of the .torrent or inside the
info
dictionary.If it goes into the root, it will not affect the info hash (which is the unique identifier of the torrent), and it will also not be available when downloading magnet links.
If it goes into the info dictionary, it is sort of locked down to the info-hash, in the sense that the info-hash depends on it. It will be transferred as part of the metadata when downloading magnet links and it cannot be changed (without changing the info-hash and thus creating a separate swarm).
So, if it's something you want 3rd parties should be able to change after the torrent was created, it should go in the root, if you want it to be entered once when the torrent is created and never change, it should go in the info dict.