aria2c配置

1698286551730.png

1698286692586.png

  • 配置并开启rpc服务

# 创建一个配置文件 /var/etc/aria2/aria2.conf.main

daemon=true
continue=true

# 最大同时下载数, 包括做种的, 默认5
max-concurrent-downloads=20

## RPC设置 ## ============================================================
# 启用RPC, 默认:false
enable-rpc=true
# 允许所有来源, 默认:false
rpc-allow-origin-all=true
# 允许非外部访问, 默认:false
rpc-listen-all=true
# 事件轮询方式, 取值:[epoll, kqueue, port, poll, select], 不同系统默认值不同
# event-poll=select
# RPC监听端口, 端口被占用时可以修改, 默认:6800
rpc-listen-port=6800


# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
listen-port=6890
dht-listen-port=6892

# 不存在的目录需要创建
dir=/sdcard/Download/aria2c
# 无需记录日志, 否则日志文件很大不会自动删除
log=
input-file=/var/etc/aria2/aria2.session.main
save-session=/var/etc/aria2/aria2.session.main
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0
save-session-interval=1
# 保存控制文件.aria2c
auto-save-interval=1
# 文件空间分配,关闭,其他类型磁盘io会阻塞
file-allocation=none

# 官方的aria2最高设置为16, 如果需要设置任意数值请重新编译aria2
max-connection-per-server=16
# 单个任务最大线程数, 添加时可指定, 默认:5
split=20
# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M
min-split-size=10M


# bttracker设置逗号分割, XIU2的快点
bt-tracker=udp://tracker.opentrackr.org:1337/announce,https://tracker2.ctix.cn:443/announce
# 当下载bt文件的时候 dht-listen-port 就会启用监听
# 会生成 dht.dat 文件, 如果一直没有速度, 手动下载文件

#启用本地节点查找
bt-enable-lpd=true

## 做种相关
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
listen-port=19700
# DHT网络监听端口, 默认:6881-6999
dht-listen-port=16881-16999
# 即使任务完成或删除时使用 --save-session 选项时也保存该任务. 此选项在这种情况下还会保存控制文件. 此选项可以保存被认为已经完成但正在做种的 BT 任务.
force-save=true
# 指定分享率. 当分享率达到此选项设置的值时会完成做种. 强烈建议您将此选项设置为大于等于 1.0. 如果您想不限制分享比率, 可以设置为 0.0. 如果同时设置了 --seed-time 选项, 当任意一个条件满足时将停止做种.
seed-ratio=0.0
# 设置每个 BT 下载的最大连接节点数. 0 表示不限制.默认55
bt-max-peers=1000
# 如果一个 BT 下载的整体下载速度低于此选项设置的值, aria2 会临时提高连接数以提高下载速度. 在某些情况下, 设置期望下载速度可以提高您的下载速度. 您可以增加数值的单位 K 或 M (1K = 1024, 1M = 1024K).
bt-request-peer-speed-limit=10M
# 优化并发下载数
optimize-concurrent-downloads=true
  • 启动

# 启动rpc服务
aria2c --conf-path=/var/etc/aria2/aria2.conf.main

# 我是安装了tmux直接在里面运行的
tmux -S aria2c

# 下载文件会同时生成.aria2进度文件,就算文件下载完成还是一直存在的,删除已经完成的任务之后如果添加同一个种子,会恢复做种状态
  • 安装webui https://github.com/mayswind/AriaNg

# 我是openwrt, 进入ui之后配置jsonrpc地址: http://192.168.8.1:6800 即可
cd /www/aria2
wget https://github.com/mayswind/AriaNg/releases/download/1.2.3/AriaNg-1.2.3-AllInOne.zip
unzip AriaNg-1.2.3-AllInOne.zip

# 访问路由器即可
http://192.168.8.1/aria2/index.html

# 安卓客户端AriaNg
https://github.com/Xmader/aria-ng-gui-android
  • 下载磁力配置

# 配置trackerslist, 直接获取, 推荐使用 https协议的
https://github.com/DeSireFire/animeTrackerList
https://github.com/ngosang/trackerslist
https://github.com/SuperNG6/Aria2-Trackers

# 自动获取
https://github.com/XIU2/TrackersListCollection
# 需要把文件的行设置为,分割
http://www.iamwawa.cn/quchong.html

# 开启端口6881:6999,启动aria2c服务的时候会看到,然后加入防火墙允许访问

# 变更之后需要重启aria2c服务
# 测试下载,在里面下载一个种子, 去测试,https://ubuntu.com/download/alternative-downloads
# http://releases.ubuntu.com/18.10/ubuntu-18.10-desktop-amd64.iso.torrent
# 或者进入 枫雪动漫daphnetd[https://weibo.com/339090694?is_all=1] 新浪微博下载海贼王的一集种子文件

# 注意: 如果文件太大,磁盘io会阻塞,导致jsonrpc服务hang住,耐心等等

# 查看日志文件
watch -n1 "tail -n 20 /tmp/aria2.log"


# 添加任务之后, 需要等待解析一会才有速度
  • 浏览器配合下载

# firefox插件,需要先启动aria2c的rpc服务
https://addons.mozilla.org/zh-CN/firefox/addon/aria2-integration/
  • 展示

  • bt 网站

https://nyaa.land
http://185.163.108.69/down/Index_user.ASP
https://www.wemp4.com/search/

https://www.rarbt.fun/
# 发送邮件至 [email protected] 自动获取
  • docker

https://github.com/wahyd4/aria2-ariang-docker
  • 从种子文件解析 tracker 服务器

# 工具
https://github.com/rakshasa/rbedit
# 全部信息
./rbedit-linux-amd64 get --input  ./swgq.torrent
# announce
./rbedit-linux-amd64 announce get --input ./swgq.torrent
# announce-list
./rbedit-linux-amd64 announce-list get --input ./swgq.torrent
# 获取服务器地址并,分割
./rbedit-linux-amd64 announce-list get --input ./swgq.torrent|awk '{print $2}'|xargs | tr ' ' ','
# 多个种子文件
./rbedit-linux-amd64 announce-list get --input <(find ./ -name "*.torrent") --batch|awk '{print $2}'|xargs | tr ' ' ','



# 编辑 torrent
http://torrenteditor.com
# 编辑器
https://github.com/GerryFerdinandus/bittorrent-tracker-editor
# ACGTracker - 免费、开放、中立、供任何个人和组织使用
http://open.acgtracker.com/announce
  • 自建tracker服务器

https://github.com/webtorrent/bittorrent-tracker
# 使用docker
https://gitlab.com/jarylc/docker-bittorrent-tracker
docker run -d \
    --name bittorrent-tracker \
    -e PORT=8000 \
    -e HTTP=1 \
    -e UDP=1 \
    -e WS=1 \
    -e STATS=1 \
    -e INTERVAL=600000 \
    -e TRUST_PROXY=0 \
    -e QUIET=1 \
    -e SILENT=0 \
    -p 2828:8000 \
    --restart unless-stopped \
    jarylc/bittorrent-tracker

# 使用webtorrent/bittorrent-tracker手动运行
docker pull node:16.13.1
docker run -itd --network=host --name=bt-tracker node:16.13.1
docker exec -it bt-tracker bash
npm config set registry https://registry.npmmirror.com
npm install -g bittorrent-tracker
bittorrent-tracker

# 检查状态
curl http://tracker.2011101.xyz/stats
# 配置, 不要忘记后缀/announce
http://tracker.2011101.xyz/announce

1698485366937.png

# 开始做种
# 主要技巧就是: 不要用root用户;.torrent创建到/watch目录, 而实际的文件以文件夹的形式放到/downloads/complete/的子目录下面
docker exec -u 1000 -it transmission bash
cd /watch
# test5 是个文件夹, 里面才是分享的文件
transmission-create -o 1.torrent -s 2048 -t http://tracker.2011101.xyz/announce -t https://tracker.gbitt.info/announce -t http://open.acgnxtracker.com/announce -t http://1337.abcvg.info/announce -t http://tracker.opentrackr.org:1337/announce /downloads/complete/test5

# 显示磁力 magnet:?xt=urn:btih:
transmission-show -m AriaNg.torrent
transmission-show -c AriaNg.torrent
# 连接信息
transmission-show -s AriaNg.torrent
# 编辑
transmission-edit

# 不同的版本,watch之后会自动生成下载完成记录.torrent.added并做种, 如果没有生成请
# 手动进入webui使用当前的.torrent以及指定downloads目录即可直接下载完成并做种
# 需要2个条件
downloads目录已经保存原文件
watch目录监听.torrent文件(如果添加之后不生效, 需要手动添加种子的下载任务手动下载)

# docker
https://github.com/linuxserver/docker-transmission

# webui
mkdir -p /home/wb/g/bt/downloads/trguing && cd /home/wb/g/bt/downloads/trguing
wget https://gitdl.cn/https://github.com/openscopeproject/TrguiNG/releases/download/v1.3.0/trguing-web-v1.3.0.zip
unzip trguing-web-v1.3.0.zip
# 或者
mkdir -p /home/wb/g/bt/downloads/twu && cd /home/wb/g/bt/downloads/twu
wget https://gitdl.cn/https://github.com/zpqsunny/Transmission-Web-UI/releases/download/v2.3.6/release-v2.3.6.zip
unzip release-v2.3.6.zip


docker run --privileged -d \
  --name=transmission \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -p 9091:9091 \
  -p 51413:51413 \
  -p 51413:51413/udp \
  -e USER=jcleng \
  -e PASS=jclengpass \
  -v /home/wb/g/bt/config:/config \
  -v /home/wb/g/bt/downloads:/downloads \
  -v /home/wb/g/bt/watch:/watch \
  -e TRANSMISSION_WEB_HOME=/downloads/twu \
  registry.cn-hangzhou.aliyuncs.com/jcleng/linuxserver-transmission


# 安卓端管理
https://github.com/y-polek/TransmissionRemote
  • /config/settings.json

{
    "alt-speed-down": 50,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 50,
    "announce-ip": "",
    "announce-ip-enabled": false,
    "anti-brute-force-enabled": false,
    "anti-brute-force-threshold": 100,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": false,
    "blocklist-url": "http://www.example.com/blocklist",
    "cache-size-mb": 4,
    "default-trackers": "",
    "dht-enabled": true,
    "download-dir": "/downloads/complete",
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 1,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/downloads/incomplete",
    "incomplete-dir-enabled": true,
    "lpd-enabled": false,
    "message-level": 2,
    "peer-congestion-algorithm": "",
    "peer-id-ttl-hours": 6,
    "peer-limit-global": 200,
    "peer-limit-per-torrent": 50,
    "peer-port": 51413,
    "peer-port-random-high": 65535,
    "peer-port-random-low": 49152,
    "peer-port-random-on-start": false,
    "peer-socket-tos": "le",
    "pex-enabled": true,
    "port-forwarding-enabled": true,
    "preallocation": 1,
    "prefetch-enabled": true,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 2,
    "ratio-limit-enabled": false,
    "rename-partial-files": true,
    "rpc-authentication-required": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-host-whitelist": "",
    "rpc-host-whitelist-enabled": false,
    "rpc-password": "{8093893b8139611de3b48dda70d0f0c54cd696cfCqJH0FVS",
    "rpc-port": 9091,
    "rpc-socket-mode": "0750",
    "rpc-url": "/transmission/",
    "rpc-username": "jcleng",
    "rpc-whitelist": "",
    "rpc-whitelist-enabled": false,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-added-enabled": false,
    "script-torrent-added-filename": "",
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "script-torrent-done-seeding-enabled": false,
    "script-torrent-done-seeding-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "speed-limit-down": 100,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 100,
    "speed-limit-up-enabled": false,
    "start-added-torrents": true,
    "tcp-enabled": true,
    "torrent-added-verify-mode": "fast",
    "trash-original-torrent-files": false,
    "umask": "002",
    "upload-slots-per-torrent": 14,
    "utp-enabled": false,
    "watch-dir": "/watch",
    "watch-dir-enabled": true
}
  • 在openwrt中使用root用户运行即可, 限制最大下载速度和节点数

# Auto generated file, changes to this file will be lost.
dir=/mnt/sda1/aria2
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
quiet=true
continue=true
input-file=/var/etc/aria2/aria2.session.main
save-session=/var/etc/aria2/aria2.session.main
check-certificate=true
enable-dht=true
dht-file-path=/var/etc/aria2/dht.dat.main
bt-enable-lpd=true
enable-peer-exchange=true
file-allocation=none
follow-torrent=true
save-session-interval=30
save-session-interval=1
file-allocation=none
seed-ratio=0.0
force-save=true
optimize-concurrent-downloads=true
auto-save-interval=1
bt-tracker=udp://tracker.opentrackr.org:1337/announce,http://tracker.2011101.xyz/announce,http://tracker.opentrackr.org:1337/announce,udp://open.tracker.cl:1337/announce,udp://tracker.auctor.tv:6969/announce,udp://opentracker.i2p.rocks:6969/announce,https://opentracker.i2p.rocks:443/announce,udp://open.demonii.com:1337/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.moeking.me:6969/announce,udp://tracker-udp.gbitt.info:80/announce,udp://exodus.desync.com:6969/announce,https://tracker.tamersunion.org:443/announce,https://tracker.gbitt.info:443/announce,http://tracker.gbitt.info:80/announce,udp://movies.zsw.ca:6969/announce,udp://explodie.org:6969/announce,udp://tracker2.dler.org:80/announce,udp://tracker.skyts.net:6969/announce,udp://tracker.dump.cl:6969/announce,udp://tracker.cubonegro.lol:6969/announce,udp://tracker.bittor.pw:1337/announce,udp://tracker.0x7c0.com:6969/announce,udp://opentracker.io:6969/announce,udp://open.tracker.ink:6969/announce,udp://open.dstud.io:6969/announce,udp://new-line.net:6969/announce,udp://isk.richardsw.club:6969/announce,udp://epider.me:6969/announce,udp://bt2.archive.org:6969/announce,udp://bt1.archive.org:6969/announce,udp://bt.ktrackers.com:6666/announce,udp://6ahddutb1ucc3cp.ru:6969/announce,udp://6.pocketnet.app:6969/announce,http://tracker.skyts.net:6969/announce,http://open.tracker.ink:6969/announce,http://open.acgnxtracker.com:80/announce,udp://tracker1.myporn.club:9337/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.therarbg.to:6969/announce,udp://tracker.theoks.net:6969/announce,udp://tracker.t-rb.org:6969/announce,udp://tracker.qu.ax:6969/announce,udp://ryjer.com:6969/announce,udp://open.u-p.pw:6969/announce,udp://oh.fuuuuuck.com:6969/announce,udp://moonburrow.club:6969/announce,udp://free.publictracker.xyz:6969/announce,udp://1c.premierzal.ru:6969/announce,https://tracker.renfei.net:443/announce,https://tracker.loligirl.cn:443/announce,https://tracker.lilithraws.org:443/announce,http://tracker2.dler.org:80/announce,http://tracker.renfei.net:8080/announce,http://tracker.qu.ax:6969/announce,http://tracker.bt4g.com:2095/announce,udp://wepzone.net:6969/announce,udp://tracker.tryhackx.org:6969/announce,udp://tracker.therarbg.com:6969/announce,udp://tracker.srv00.com:6969/announce,udp://tracker.fnix.net:6969/announce,udp://tracker.filemail.com:6969/announce,udp://tracker.edkj.club:6969/announce,udp://tracker.dler.org:6969/announce,udp://tracker.anima.nz:6969/announce,udp://tamas3.ynh.fr:6969/announce,udp://su-data.com:6969/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://public.tracker.vraphim.com:6969/announce,udp://pirate.t-1.org:1337/announce,udp://open.xxtor.com:3074/announce,udp://open.free-tracker.ga:6969/announce,udp://ipv4.rer.lol:2710/announce,udp://evan.im:6969/announce,udp://bittorrent-tracker.e-n-c-r-y-p-t.net:1337/announce,https://yolo.liberbear.com:443/announce,https://www.peckservers.com:9443/announce,https://tracker.yemekyedim.com:443/announce,https://tracker.netmap.top:8443/announce,https://tracker.ipfsscan.io:443/announce,https://tracker.imgoingto.icu:443/announce,https://tracker.gcrreen.xyz:443/announce,https://tracker.cloudit.top:443/announce,https://tr.burnabyhighstar.com:443/announce,https://t1.hloli.org:443/announce,http://www.peckservers.com:9000/announce,http://wg.mortis.me:6969/announce,http://wepzone.net:6969/announce,http://tracker.netmap.top:6969/announce,http://tracker.mywaifu.best:6969/announce,http://tracker.ipv6tracker.org:80/announce,http://tracker.files.fm:6969/announce,http://tracker.edkj.club:6969/announce,http://tracker.dler.org:6969/announce,http://t.overflow.biz:6969/announce,http://open.acgtracker.com:1096/announce,http://ch3oh.ru:6969/announce,http://bvarf.tracker.sh:2086/announce,http://bittorrent-tracker.e-n-c-r-y-p-t.net:1337/announce,udp://tracker.ddunlimited.net:6969/announce,udp://tracker.artixlinux.org:6969/announce,udp://torrents.artixlinux.org:6969/announce,udp://mail.artixlinux.org:6969/announce,udp://freedomalternative.com:6969/announce,udp://fh2.cmp-gaming.com:6969/announce,udp://concen.org:6969/announce,udp://aegir.sexy:6969/announce,http://tracker1.itzmx.com:8080/announce
bt-max-peers=25
max-download-limit=1M
bt-request-peer-speed-limit=1M



# 日志
Sun Feb 18 09:28:15 2024 daemon.info aria2c[5712]: jail: exec-ing /usr/bin/aria2c
Sun Feb 18 09:28:14 2024 daemon.info aria2: Aria2 will run with user 'root'.
  • 查看bt文件信息

aria2c --show-files 2.torrent
  • 命令直接下载

aria2c -c -x 12 --check-certificate=false http://app.vagrantup.com/jborean93/boxes/WindowsServer2016/versions/1.2.0/providers/libvirt/amd64/vagrant.box