静看光阴荏苒
不管不顾不问不说也不念

使用Chihaya搭建一个可以屏蔽迅雷的Tracker

这个Tracker屏蔽的效果和性能还有待测试,过两天我重新做个种子进行测试。先记录一下搭建的过程。。。

chihaya是用GO写的,但是作者并没有给我们准备好预构建的包,只有一个用docker运行旧版本的部署方法,这么一个小工具还用docker真的小题大做了,所以我只能自己编译了。

最基本的组件先装一下:

yum -y install wget curl git nano

然后下载一个预构建好的GO环境:

wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz
tar -xzvf go1.11.4.linux-amd64.tar.gz -C /usr/bin

打开账户配置文件:

nano ~/.bash_profile

把GO的PATH写到账户配置文件下:

export PATH=$PATH:/usr/bin/go/bin

使其生效:

source ~/.bash_profile

现在就可以尝试构建chihaya了,新建一个目录并导入GOPATH:

mkdir chihaya && export GOPATH=$PWD/chihaya

再在这个目录下新建一个bin目录用来待会安装dep:

mkdir -p chihaya/bin

执行这个脚本一键安装dep,安装完成之后会在我们之前的bin目录下有dep的可执行文件:

curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

拉取chihaya的项目文件到指定的目录下:

git clone https://github.com/chihaya/chihaya.git $GOPATH/src/github.com/chihaya/chihaya

进入这个目录:

cd $GOPATH/src/github.com/chihaya/chihaya

使用dep解决项目的依赖问题:

/root/chihaya/bin/dep ensure

现在就可以开始构建了:

go install github.com/chihaya/chihaya/cmd/...

完成之后把可执行的二进制文件复制到/usr/bin:

cp ~/chihaya/bin/chihaya /usr/bin

执行如下命令,查看chihay是否正常:

chihaya --help

下载chihaya的默认配置文件:

wget https://raw.githubusercontent.com/chihaya/chihaya/master/example_config.yaml -O /etc/chihaya.yaml

编辑这个配置文件,按自己的需求更改:

nano /etc/chihaya.yaml

如果要屏蔽迅雷,则在这个配置的文件如下地方取消注释并按照YAML的语法进行配置:

    - name: client approval
      options:
  #     whitelist:
  #     - "OP1011"
        blacklist:
        - "XL0012"

这样可以把PEERID为XL0012的客户端拉入Tracker的黑名单,目前我只知道较新版本的迅雷是这个PEERID,貌似极速版的迅雷和一些旧版本不是这个。。。无从得知,尽力了。。。

配置完成之后就可以尝试运行这个Tracker服务器了:

chihaya --config /etc/chihaya.yaml

如果正常的话可以看到类似如图回显:

键盘组合键Ctrl+C先退出来。我们创建一个systemd的服务文件:

nano /etc/systemd/system/chihaya.service

写入:

[Unit]
Description=chihaya tracker server
    
[Service]
User=root
ExecStart=/usr/bin/chihaya
Restart=on-abort
    
[Install]
WantedBy=multi-user.target

重载systemd:

systemctl daemon-reload

然后使用systemd来管理Chihaya:

systemctl start chihaya
systemctl stop chihaya
systemctl status chihaya

设置开机启动:

systemctl enable chihaya

在制作种子的时候,Tracker服务器地址可以填写:

http://你的服务器公网IP:6969/announce
udp://你的服务器公网IP:6969/announce

实时日志记录:

http://你的服务器公网IP:6880

我把自己预构建好的包和配置文件打包一份,如果你不想自己编译的话,用我这个就行了(只支持64位Linux):

chihaya-linux-amd64

用法很简单,解压压缩包后给执行权限:

chmod +x chihaya

然后把配置文件复制到/etc下面:

mv chihaya.yaml /etc/chihaya.yaml

按照之前的配置systemd即可。

赞(5)
未经允许不得转载:荒岛 » 使用Chihaya搭建一个可以屏蔽迅雷的Tracker
分享到: 更多 (0)

评论 10

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    第一,想知道自己建tracker的目的是啥 :evil: :evil: :evil:

    JJJZISO5年前 (2018-12-26) Firefox 64.0 Firefox 64.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 可以控制种子的时效性,比如我用自己的tracker制作了一个种子然后公开给人下载,但是后面我又不想让人下载这个种子里面的资源了,我把这个种子加入tracker的黑名单或者把tracker服务器给关闭了,那这个种子就基本失效了。

      LALA5年前 (2018-12-26) Google Chrome 70.0.3538.110 Google Chrome 70.0.3538.110 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    LALA,你好。可以帮忙迁移一下网站吗?有偿

    悟空5年前 (2018-12-28) Google Chrome 71.0.3578.98 Google Chrome 71.0.3578.98 Windows 7 x64 Edition Windows 7 x64 Edition回复
    • 什么网站?

      LALA5年前 (2018-12-29) Google Chrome 70.0.3538.110 Google Chrome 70.0.3538.110 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 一个小网站,用宝塔面板搭建的,搞不定数据库的问题;可以通过邮箱沟通吗?wukong.51@foxmail.com;QQ也可以 :!:

        悟空5年前 (2018-12-29) Google Chrome 71.0.3578.98 Google Chrome 71.0.3578.98 Windows 7 x64 Edition Windows 7 x64 Edition回复
  3. #3

    大佬,搭建完成后,实时日志页面http://你的服务器公网IP:6880 无法打开,显示404 page not found

    dad2年前 (2021-11-28) Google Chrome 96.0.4664.45 Google Chrome 96.0.4664.45 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 你是怎么搭建的,自己编译的还是用我下面那个预编译的?你可以先试试我预编译的版本。

      LALA2年前 (2021-11-28) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 刚试了大佬编译的,打开 http://你的服务器公网IP:6880 显示的内容:https://img.onep.me/2021/11/28/1638070707935.png
        这个显示是正常的吗

        dad2年前 (2021-11-28) Google Chrome 96.0.4664.45 Google Chrome 96.0.4664.45 Windows 10 x64 Edition Windows 10 x64 Edition回复
        • 正常的。

          LALA2年前 (2021-11-28) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿