[关闭]
@zhongdao 2019-03-25T21:33:45.000000Z 字数 9067 阅读 5955

OpenTracker的说明与安装

未分类


介绍

Opentracker is a free (licensed as beerware) BitTorrent peer tracker software (a special kind of HTTP or UDP server software) that is designed to be fast and to have a low consumption of system resources.
Opentracker是一款免费(许可为beerware)BitTorrent对等跟踪软件(一种特殊的HTTP或UDP服务器软件),设计速度快,系统资源消耗低。

Several instances of opentracker may be run in a cluster, with all of them synchronizing with each other. Besides the Hypertext Transfer Protocol (HTTP) opentracker may also be connected to via User Datagram Protocol (UDP), which creates less than half of the tracker traffic HTTP creates.[1] It supports IPv6, gzip compression of full scrapes, and blacklists of torrents. Because there have already been cases of people being accused of copyright violation by the fact that their IP address was listed on a BitTorrent tracker,[2] opentracker may mix in random IP address numbers[citation needed] for the purpose of plausible deniability.

opentracker的几个实例可以在集群中运行,所有这些实例都相互同步。除了超文本传输​​协议(HTTP)之外,opentracker还可以通过用户数据报协议(UDP)连接,这会产生不到一半的HTTP创建的跟踪器流量。[1] 它支持IPv6,完全的gzip压缩和种子黑名单。因为已经有人因为他们的IP地址被列在BitTorrent跟踪器上而被指控侵犯版权,[2] 为了合理的否认,opentracker可能会混入随机IP地址编号。

It runs completely in RAM, accounting for much of its speed advantage over other tracker software. It is written in C and based on the library libowfat that manages network connections. For some new functionality like the UDP support with IPv6[3] or the syncing of several instances of BitTorrent tracker software, new extensions to the BitTorrent protocol were made.
它完全在RAM中运行,与其他跟踪器软件相比,它具有很大的速度优势。它是用C语言编写的,基于管理网络连接的库 libowfat。对于一些新功能,如UDP支持IPv6 [3]或同步BitTorrent跟踪器软件的几个实例,新的BitTorrent协议扩展。

安装

Tracker服务器本身位于内网或外网

位于公网上:
无需做防火墙或者路由器上的映射,直接运行即可。若有防火墙,只开放对外服务的端口即可。

位于内网:
需要做NAT映射,将对外公布的外部ip和端口,作为各个接收端的tracker 地址

搭建Tracker索引服务器

下载OpenTracker依赖库及源码,编译。

  1. cvs -d :pserver:cvs@cvs.fefe.de:/cvs -z9 co libowfat
  2. cd libowfat
  3. make
  4. cd ..
  5. # LEGACY: cvs -d:pserver:anoncvs@cvs.erdgeist.org:/home/cvsroot co opentracker
  6. git clone git://erdgeist.org/opentracker
  7. cd opentracker
  8. make

命令行用法

  1. Usage: ./opentracker [-i ip] [-p port] [-P port] [-r redirect] [-d dir] [-u user] [-A ip] [-f config] [-s livesyncport]
  2. -f config include and execute the config file
  3. -i ip specify ip to bind to (default: *, you may specify more than one)
  4. -p port specify tcp port to bind to (default: 6969, you may specify more than one)
  5. -P port specify udp port to bind to (default: 6969, you may specify more than one)
  6. -r redirecturlspecify url where / should be redirected to (default none)
  7. -d dir specify directory to try to chroot to (default: ".")
  8. -u user specify user under whose priviliges opentracker should run (default: "nobody")
  9. -A ip bless an ip address as admin address (e.g. to allow syncs from this address)
  10. Example: ./opentracker -i 127.0.0.1 -p 6969 -P 6969 -f ./opentracker.conf -i 10.1.1.23 -p 2710 -p 80

中文翻译:

  1. Usage: ./opentracker [-i ip] [-p port] [-P port] [-r redirect] [-d dir] [-u user] [-A ip] [-f config] [-s livesyncport]
  2. -f 配置文件
  3. -i ip 绑定的IP (default: *, you may specify more than one)
  4. -p port 绑定的TCP端口 (default: 6969, you may specify more than one)
  5. -P port 绑定的UDP端口 (default: 6969, you may specify more than one)
  6. -r 导向的URL (default none)
  7. -d dir chroot 的目录 (default: ".")
  8. -u user 指定以哪个用户权限来运行 (default: "nobody")
  9. -A ip 管理的IP地址 (e.g. to 从这个地址同步)
  10. Example: ./opentracker -i 127.0.0.1 -p 6969 -P 6969 -f ./opentracker.conf -i 10.1.1.23 -p 2710 -p 80

集群配置与安装

配置文件样例

  1. # opentracker config file
  2. #
  3. # I) Address opentracker will listen on, using both, tcp AND udp family
  4. # (note, that port 6969 is implicite if ommitted).
  5. #
  6. # If no listen option is given (here or on the command line), opentracker
  7. # listens on 0.0.0.0:6969 tcp and udp.
  8. #
  9. # The next variable determines if udp sockets are handled in the event
  10. # loop (set it to 0, the default) or are handled in blocking reads in
  11. # dedicated worker threads. You have to set this value before the
  12. # listen.tcp_udp or listen.udp statements before it takes effect, but you
  13. # can re-set it for each listen statement. Normally you should keep it at
  14. # the top of the config file.
  15. #
  16. # listen.udp.workers 4
  17. #
  18. # listen.tcp_udp 0.0.0.0
  19. # listen.tcp_udp 192.168.0.1:80
  20. # listen.tcp_udp 10.0.0.5:6969
  21. #
  22. # To only listen on tcp or udp family ports, list them this way:
  23. #
  24. # listen.tcp 0.0.0.0
  25. # listen.udp 192.168.0.1:6969
  26. #
  27. # Note, that using 0.0.0.0 for udp sockets may yield surprising results.
  28. # An answer packet sent on that socket will not necessarily have the
  29. # source address that the requesting client may expect, but any address
  30. # on that interface.
  31. #
  32. # II) If opentracker runs in a non-open mode, point it to files containing
  33. # all torrent hashes that it will serve (shell option -w)
  34. #
  35. # access.whitelist /path/to/whitelist
  36. #
  37. # or, if opentracker was compiled to allow blacklisting (shell option -b)
  38. #
  39. # access.blacklist ./blacklist
  40. #
  41. # It is pointless and hence not possible to compile black AND white
  42. # listing, so choose one of those options at compile time. File format
  43. # is straight forward: "<hex info hash>\n<hex info hash>\n..."
  44. #
  45. # If you do not want to grant anyone access to your stats, enable the
  46. # WANT_RESTRICT_STATS option in Makefile and bless the ip addresses
  47. # allowed to fetch stats here.
  48. #
  49. # access.stats 192.168.0.23
  50. #
  51. # There is another way of hiding your stats. You can obfuscate the path
  52. # to them. Normally it is located at /stats but you can configure it to
  53. # appear anywhere on your tracker.
  54. #
  55. # access.stats_path stats
  56. # III) Live sync uses udp multicast packets to keep a cluster of opentrackers
  57. # synchronized. This option tells opentracker which port to listen for
  58. # incoming live sync packets. The ip address tells opentracker, on which
  59. # interface to join the multicast group, those packets will arrive.
  60. # (shell option -i 192.168.0.1 -s 9696), port 9696 is default.
  61. #
  62. # livesync.cluster.listen 192.168.0.1:9696
  63. #
  64. # Note that two udp sockets will be opened. One on ip address 0.0.0.0
  65. # port 9696, that will join the multicast group 224.0.42.23 for incoming
  66. # udp packets and one on ip address 192.168.0.1 port 9696 for outgoing
  67. # udp packets.
  68. #
  69. # As of now one and only one ip address must be given, if opentracker
  70. # was built with the WANT_SYNC_LIVE feature.
  71. #
  72. # IV) Sync between trackers running in a cluster is restricted to packets
  73. # coming from trusted ip addresses. While source ip verification is far
  74. # from perfect, the authors of opentracker trust in the correct
  75. # application of tunnels, filters and LAN setups (shell option -A).
  76. #
  77. # livesync.cluster.node_ip 192.168.0.4
  78. # livesync.cluster.node_ip 192.168.0.5
  79. # livesync.cluster.node_ip 192.168.0.6
  80. #
  81. # This is the admin ip address for old style (HTTP based) asynchronus
  82. # tracker syncing.
  83. #
  84. # batchsync.cluster.admin_ip 10.1.1.1
  85. #
  86. # V) Control privilege drop behaviour.
  87. # Put in the directory opentracker will chroot/chdir to. All black/white
  88. # list files must be put in that directory (shell option -d).
  89. #
  90. #
  91. # tracker.rootdir /usr/local/etc/opentracker
  92. #
  93. # Tell opentracker which user to setuid to.
  94. #
  95. # tracker.user nobody
  96. #
  97. # VI) opentracker can be told to answer to a "GET / HTTP"-request with a
  98. # redirect to another location (shell option -r).
  99. #
  100. # tracker.redirect_url https://your.tracker.local/

配置文件样例翻译

  1. # opentracker 配置文件
  2. #
  3. # I) opentracker会在地址上用tcp和udp同时监听。
  4. # (注意:如果省略,端口6969是隐含的).
  5. # 如果没有给出listen选项(这里或命令行),opentracker侦听0.0.0.0:6969 tcp和udp。
  6. #
  7. # 下一个变量确定是否在事件中处理udp套接字事件loop(默认设置为0).或在阻塞读取中处理专用worker线程。
  8. #你必须在之前设置值,listen.ctp_udp 或者 listen.udp的语句才会生效。但是你可以为每个listen语句重新设置,通常你应该保持它在配置文件的顶部。
  9. #
  10. # listen.udp.workers 4
  11. #
  12. # listen.tcp_udp 0.0.0.0
  13. # listen.tcp_udp 192.168.0.1:80
  14. # listen.tcp_udp 10.0.0.5:6969
  15. #
  16. # 为了只监听tcp或udp端口,按照如下方式列出
  17. #
  18. # listen.tcp 0.0.0.0
  19. # listen.udp 192.168.0.1:6969
  20. #
  21. # 注意: 为upd监听使用0.0.0.0 会产生惊讶的结果。
  22. # 在该套接字上发送的应答包不一定具有该请求客户端可能期望的源地址,可能是这个接口上的任何地址。
  23. #
  24. # II) 如果opentracker以非开放模式运行,则将其指向包含所有种子哈希的文件(脚本选项 -w)
  25. # access.whitelist /path/to/whitelist
  26. # 或者,如果opentracker编译为允许黑名单(脚本选项 -b)
  27. # access.blacklist ./blacklist
  28. #
  29. # 同时编译黑白名单是没有意义的和不可能的。所以编译时选择一个选项。文件格式是简单直接的:
  30. # "<hex info hash>\n<hex info hash>\n..."
  31. #
  32. # 如果你不想授予任何人权限来访问你的统计信息,在Makefile中设置 WANT_RESTRICT_STATS 选项,并将允许访问统计信息的IP放在这里
  33. # access.stats 192.168.0.23
  34. #
  35. # 有另外一种方法来隐藏你的统计信息。你可以混淆路径。通常它位于/stats 但是你可以配置它到你的tracker的任何路径上。
  36. # access.stats_path stats
  37. #
  38. # III) 实时同步使用udp多播数据包来保持一组opentrackers集群同步。此选项告诉opentracker要侦听的端口接收同步数据包。ip地址告诉opentracker,在哪个接口interface加入那些报文将到达的组播组。(shell选项-i 192.168.0.1 -s 9696),端口9696是默认值。
  39. #
  40. # livesync.cluster.listen 192.168.0.1:9696
  41. #
  42. # 注意将打开两个udp套接字。一个在IP地址0.0.0.0端口9696,会加入多播组 224.0.42.23来接收进入的udp数据包。 一个在192.168.0.1端口9696上输出所有的udp数据包。
  43. # 截至目前,如果opentracker是使用WANT_SYNC_LIVE功能编译构建的,必须给出一个且只有一个ip地址。
  44. #
  45. # IV)在群集中运行的Tracker之间的同步仅限于来自可信的IP地址的数据包。虽然源IP验证很完美,opentracker的作者信任正确的应用程序隧道tunnels,过滤器和LAN设置的应用(shell选项-A)。
  46. #
  47. # livesync.cluster.node_ip 192.168.0.4
  48. # livesync.cluster.node_ip 192.168.0.5
  49. # livesync.cluster.node_ip 192.168.0.6
  50. #
  51. # 这是旧风格(基于http)的异步tracker同步的管理ip
  52. #
  53. # batchsync.cluster.admin_ip 10.1.1.1
  54. #
  55. # V) 管理丢弃行为的权限
  56. # 放入opentracerk会chroot/chdir的目录。 所有的黑/白名单文件必须放在哪个目录(shell选项 -d)
  57. #
  58. # tracker.rootdir /usr/local/etc/opentracker
  59. #
  60. # 告诉opentracker对哪个用户setuid
  61. #
  62. # tracker.user nobody
  63. #
  64. # VI) opentracker可以被告知回应“GET / HTTP"请求使用重定向另一个位置(shell选项 -r)
  65. #
  66. # tracker.redirect_url https://your.tracker.local/

运行

单机运行

执行, 同时通过80,6969对外提供服务

  1. ./opentracker -i 172.16.252.249 -p 6969 -P 6969

或者不指定ip

  1. ./opentracker -p 6969 -P 6969

其中 172.16.252.249 是内网ip,
对外公开的tracker地址则替换为外网ip
如果对外的外网ip是 39.106.199.67那么announce地址为:

任选其一即可:

  1. http://39.106.199.67:6969/announce
  2. udp://39.106.199.67:6969/announce

多服务运行

有时为了让服务开机即运行。可以加入/etc/rc.local
也可以即时运行

  1. nohup ./opentracker -p 6969 -P 6969
  2. nohup ./opentracker -p 7070 -P 7070
  3. nohup ./opentracker -p 7071 -P 7071
  4. nohup ./opentracker -p 7072 -P 7072

集群运行

编译时,修改Makfile

  1. FEATURES+=-DWANT_SYNC_LIVE

配置好配置文件,然后

  1. livesync.cluster.listen 192.168.0.1:9696
  2. livesync.cluster.node_ip 192.168.0.4
  3. livesync.cluster.node_ip 192.168.0.5
  4. livesync.cluster.node_ip 192.168.0.6

默认是 6969端口的tcp和udp.

  1. ./opentracker -f opentracker.conf

源码git地址

Clone
git://erdgeist.org/opentracker
https://erdgeist.org/gitweb/opentracker

参考资料与链接

OpenTracker官网:
http://erdgeist.org/arts/software/opentracker/

OpenTracker Wiki:
https://en.wikipedia.org/wiki/Opentracker

An opentracker gitweb
http://erdgeist.org/gitweb/opentracker/

Comparison of BitTorrent tracker software
https://en.wikipedia.org/wiki/Comparison_of_BitTorrent_tracker_software

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注