Skip to content

Commit e328617

Browse files
authored
AI refinement (#250)
* AI refinement * Refine aria2 config provided by AI
1 parent dc615fb commit e328617

File tree

4 files changed

+145
-20
lines changed

4 files changed

+145
-20
lines changed

Caddyfile

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,53 @@ redir /rclone /rclone/ 301
1111
redir /files /files/ 301
1212
redir /ro /ro/ 301
1313

14-
reverse_proxy /rpc 127.0.0.1:6800
15-
reverse_proxy /jsonrpc 127.0.0.1:6800
14+
# Aria2 RPC with WebSocket support and timeouts
15+
reverse_proxy /rpc 127.0.0.1:6800 {
16+
transport http {
17+
read_timeout 300s
18+
write_timeout 300s
19+
dial_timeout 30s
20+
keepalive 90s
21+
keepalive_idle_conns 10
22+
max_conns_per_host 0
23+
}
24+
header_up X-Real-IP {remote_host}
25+
header_up X-Forwarded-For {remote_host}
26+
}
27+
28+
reverse_proxy /jsonrpc 127.0.0.1:6800 {
29+
transport http {
30+
read_timeout 300s
31+
write_timeout 300s
32+
dial_timeout 30s
33+
keepalive 90s
34+
keepalive_idle_conns 10
35+
max_conns_per_host 0
36+
}
37+
header_up X-Real-IP {remote_host}
38+
header_up X-Forwarded-For {remote_host}
39+
}
1640

1741
route /rclone/* {
1842
uri strip_prefix /rclone
19-
reverse_proxy 127.0.0.1:5572
43+
reverse_proxy 127.0.0.1:5572 {
44+
transport http {
45+
read_timeout 120s
46+
write_timeout 120s
47+
keepalive 60s
48+
}
49+
}
2050
}
2151

2252
route /files/* {
2353
uri strip_prefix /files
24-
reverse_proxy 127.0.0.1:8080
54+
reverse_proxy 127.0.0.1:8080 {
55+
transport http {
56+
read_timeout 120s
57+
write_timeout 120s
58+
keepalive 60s
59+
}
60+
}
2561
}
2662

2763
route /ro/* {

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ File Browser
7575
* Caddy File Server(Read Only) <http://yourip:8000/ro>
7676
* FileManger: <http://yourip:8000/files>
7777
* Rclone: <http://yourip:8000/rclone>
78-
* Please use `admin`/`admin` as username and password to login `Filebrowser` for the first time. And use `user`/`password` to login `Rclone` if you don't update `ARIA2_USER` and `ARIA2_PWD`
78+
* For the initial `admin` password of Filebrowser, please check the docker logs you should see something like `User 'admin' initialized with randomly generated password: xxx`, then use that password to login Filebrowser.
79+
* And use `user`/`password` to login `Rclone` if you don't update `ARIA2_USER` and `ARIA2_PWD`
7980

8081
### Full features run
8182

@@ -111,8 +112,8 @@ services:
111112
image: wahyd4/aria2-ui:latest
112113
environment:
113114
- ENABLE_AUTH=true
114-
- ARIA2_USER=hello
115-
- ARIA2_PWD=world
115+
- ARIA2_USER=user
116+
- ARIA2_PWD=password
116117
- DOMAIN=http://toozhao.com
117118
ports:
118119
- "80:80"
@@ -127,8 +128,8 @@ Then simply run `docker-compose up -d`, that's it!
127128
| `ENABLE_AUTH` | Whether to enable Basic auth |
128129
| `ENABLE_RCLONE` | Whether to disable Rclone, if you running this container offline or do not have stable connection to Github, please set to `false` |
129130
| `ENABLE_FILEBROWSER` | Whether to disable Filebrowser, set it to `false` to disable it, by default it's enabled |
130-
| `ARIA2_USER` | Basic Auth username, Rclone GUI uses it as well. |
131-
| `ARIA2_PWD` | Basic Auth password, Rclone GUI uses it as well. |
131+
| `ARIA2_USER` | Basic Auth username, Rclone GUI uses it as well. Default value: `user` |
132+
| `ARIA2_PWD` | Basic Auth password, Rclone GUI uses it as well. Default value: `password` |
132133
| `ARIA2_EXTERNAL_PORT` | The Aria2 port which exposed to public to access to |
133134
| `PUID` | Bind Linux UID into container which means you can use non `root` user to manage downloaded files, default UID is `1000` |
134135
| `PGID` | Bind Linux GID into container, default GID is 1000 |

SecureCaddyfile

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,53 @@ redir /rclone /rclone/ 301
1717
redir /files /files/ 301
1818
redir /ro /ro/ 301
1919

20-
reverse_proxy /rpc 127.0.0.1:6800
21-
reverse_proxy /jsonrpc 127.0.0.1:6800
20+
# Aria2 RPC with WebSocket support and timeouts
21+
reverse_proxy /rpc 127.0.0.1:6800 {
22+
transport http {
23+
read_timeout 300s
24+
write_timeout 300s
25+
dial_timeout 30s
26+
keepalive 90s
27+
keepalive_idle_conns 10
28+
max_conns_per_host 0
29+
}
30+
header_up X-Real-IP {remote_host}
31+
header_up X-Forwarded-For {remote_host}
32+
}
33+
34+
reverse_proxy /jsonrpc 127.0.0.1:6800 {
35+
transport http {
36+
read_timeout 300s
37+
write_timeout 300s
38+
dial_timeout 30s
39+
keepalive 90s
40+
keepalive_idle_conns 10
41+
max_conns_per_host 0
42+
}
43+
header_up X-Real-IP {remote_host}
44+
header_up X-Forwarded-For {remote_host}
45+
}
2246

2347
route /rclone/* {
2448
uri strip_prefix /rclone
25-
reverse_proxy 127.0.0.1:5572
49+
reverse_proxy 127.0.0.1:5572 {
50+
transport http {
51+
read_timeout 120s
52+
write_timeout 120s
53+
keepalive 60s
54+
}
55+
}
2656
}
2757

2858
route /files/* {
2959
uri strip_prefix /files
30-
reverse_proxy 127.0.0.1:8080
60+
reverse_proxy 127.0.0.1:8080 {
61+
transport http {
62+
read_timeout 120s
63+
write_timeout 120s
64+
keepalive 60s
65+
}
66+
}
3167
}
3268

3369
route /ro/* {

conf/aria2.conf

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ rpc-listen-all=true
1414
#RPC端口, 仅当默认端口被占用时修改
1515
#rpc-listen-port=6800
1616
#最大同时下载数(任务数), 路由建议值: 3
17-
max-concurrent-downloads=5
17+
max-concurrent-downloads=3
1818
#种子最小分享率
1919
seed-ratio=100.0
2020
#断点续传
@@ -24,7 +24,8 @@ max-connection-per-server=5
2424
#最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要
2525
min-split-size=10M
2626
#单文件最大线程数, 路由建议值: 5
27-
split=10
27+
# 降低到5以减少并发连接数 (3任务×5连接×5线程=75个连接,比之前的250少很多)
28+
split=5
2829
#下载速度限制
2930
max-overall-download-limit=0
3031
#单文件速度限制
@@ -41,12 +42,14 @@ max-upload-limit=0
4142
# dir=/user-files/superuser/
4243
dir=/data
4344
#文件缓存, 使用内置的文件缓存, 如果你不相信Linux内核文件缓存和磁盘内置缓存时使用, 需要1.16及以上版本
44-
#disk-cache=0
45+
# 启用16MB磁盘缓存以提高性能
46+
disk-cache=16M
4547
#另一种Linux文件缓存方式, 使用前确保您使用的内核支持此选项, 需要1.15及以上版本(?)
4648
#enable-mmap=true
4749
#文件预分配, 能有效降低文件碎片, 提高磁盘性能. 缺点是预分配时间较长
4850
#所需时间 none < falloc ? trunc « prealloc, falloc和trunc需要文件系统和内核支持
49-
file-allocation=prealloc
51+
# 改用falloc,比prealloc快很多,同时保持较好的性能
52+
file-allocation=falloc
5053

5154
# disable IPV6 by default
5255
disable-ipv6=true
@@ -56,6 +59,32 @@ log=/var/log/aria2.log
5659
#You can set either debug, info, notice, warn or error.
5760
log-level=warn
5861

62+
# 超时和重试设置
63+
# 连接超时时间(秒)
64+
connect-timeout=60
65+
# 超时时间(秒)
66+
timeout=60
67+
# 最大重试次数,0表示不限制
68+
max-tries=5
69+
# 重试等待时间(秒)
70+
retry-wait=10
71+
72+
# HTTP/FTP 选项
73+
# HTTP/FTP 最大连接数
74+
max-connection-per-server=5
75+
# 允许 HTTP/FTP 分片下载
76+
allow-piece-length-change=true
77+
# 允许覆盖已存在的文件
78+
allow-overwrite=false
79+
# 自动重命名
80+
auto-file-renaming=true
81+
82+
# 优化网络性能
83+
# URI 选择器,adaptive 会根据速度自动选择最快的服务器
84+
uri-selector=adaptive
85+
# 服务器状态保存间隔(秒)
86+
server-stat-of=/app/.cache/aria2_server_stat
87+
server-stat-timeout=86400
5988

6089
## Related to save downloading progress ##
6190
# 从会话文件中读取下载任务
@@ -66,7 +95,7 @@ save-session=/app/conf/aria2.session
6695
save-session-interval=10
6796

6897
# BT trackers from https://trackerslist.com/best.txt updated on 2021-06-06
69-
bt-tracker=http://1337.abcvg.info:80/announce,http://nyaa.tracker.wf:7777/announce,http://opentracker.xyz:80/announce,http://rt.tace.ru:80/announce,http://share.camoe.cn:8080/announce,http://t.nyaatracker.com:80/announce,http://torrentsmd.com:8080/announce,http://tr.cili001.com:8070/announce,http://tracker-cdn.moeking.me:2095/announce,http://tracker.anirena.com:80/announce,http://tracker.anirena.com:80/b16a15d9a238d1f59178d3614b857290/announce,http://tracker.anonwebz.xyz:8080/announce,http://tracker.bt4g.com:2095/announce,http://tracker.files.fm:6969/announce,http://tracker.gbitt.info:80/announce,http://tracker.ipv6tracker.ru:80/announce,http://tracker.noobsubs.net:80/announce,http://tracker.shittyurl.org:80/announce,http://tracker.tfile.co:80/announce,http://tracker.tfile.me:80/announce,http://tracker.trackerfix.com:80/announce,http://vps02.net.orel.ru:80/announce,https://1337.abcvg.info:443/announce,https://tr.torland.ga:443/announce,https://tracker.coalition.space:443/announce,https://tracker.gbitt.info:443/announce,https://tracker.lilithraws.cf:443/announce,https://tracker.nanoha.org:443/announce,https://tracker.nitrix.me:443/announce,https://tracker.parrotsec.org:443/announce,https://tracker.shittyurl.org:443/announce,https://tracker.tamersunion.org:443/announce,https://w.wwwww.wtf:443/announce,udp://6rt.tace.ru:80/announce,udp://9.rarbg.com:2830/announce,udp://9.rarbg.me:2710/announce,udp://9.rarbg.to:2710/announce,udp://app.icon256.com:8000/announce,udp://bubu.mapfactor.com:6969/announce,udp://discord.heihachi.pw:6969/announce,udp://exodus.desync.com:6969/announce,udp://explodie.org:6969/announce,udp://fe.dealclub.de:6969/announce,udp://inferno.demonoid.is:3391/announce,udp://ipv6.tracker.zerobytes.xyz:16661/announce,udp://mail.realliferpg.de:6969/announce,udp://movies.zsw.ca:6969/announce,udp://mts.tvbit.co:6969/announce,udp://open.demonii.com:1337/announce,udp://open.stealth.si:80/announce,udp://opentor.org:2710/announce,udp://opentracker.i2p.rocks:6969/announce,udp://p4p.arenabg.ch:1337/announce,udp://p4p.arenabg.com:1337/announce,udp://pow7.com:80/announce,udp://retracker.hotplug.ru:2710/announce,udp://retracker.lanta-net.ru:2710/announce,udp://retracker.netbynet.ru:2710/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://t1.leech.ie:1337/announce,udp://t2.leech.ie:1337/announce,udp://thetracker.org:80/announce,udp://torrentclub.online:54123/announce,udp://tracker-de.ololosh.space:6969/announce,udp://tracker.0x.tf:6969/announce,udp://tracker.altrosky.nl:6969/announce,udp://tracker.army:6969/announce,udp://tracker.beeimg.com:6969/announce,udp://tracker.birkenwald.de:6969/announce,udp://tracker.blacksparrowmedia.net:6969/announce,udp://tracker.breizh.pm:6969/announce,udp://tracker.ccp.ovh:6969/announce,udp://tracker.cyberia.is:6969/announce,udp://tracker.dler.com:6969/announce,udp://tracker.internetwarriors.net:1337/announce,udp://tracker.moeking.me:6969/announce,udp://tracker.nrx.me:6969/announce,udp://tracker.ololosh.space:6969/announce,udp://tracker.openbittorrent.com:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://tracker.shkinev.me:6969/announce,udp://tracker.theoks.net:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.uw0.xyz:6969/announce,udp://tracker.zerobytes.xyz:1337/announce,udp://tracker0.ufibox.com:6969/announce,udp://tracker1.bt.moack.co.kr:80/announce,udp://tracker1.itzmx.com:8080/announce,udp://tracker2.dler.com:80/announce,udp://tracker2.dler.org:80/announce,udp://tracker2.itzmx.com:6961/announce,udp://tracker3.itzmx.com:6961/announce,udp://tracker4.itzmx.com:2710/announce,udp://u.wwwww.wtf:1/announce,udp://valakas.rollo.dnsabr.com:2710/announce,udp://vibe.community:6969/announce,udp://wassermann.online:6969/announce,udp://www.torrent.eu.org:451/announce
98+
bt-tracker=http://1337.abcvg.info:80/announce,http://aboutbeautifulgallopinghorsesinthegreenpasture.online:80/announce,http://bt.okmp3.ru:2710/announce,http://echostar.ddnsfree.com:8080/announce,http://ipv4.rer.lol:2710/announce,http://ipv6.rer.lol:6969/announce,http://lucke.fenesisu.moe:6969/announce,http://nyaa.tracker.wf:7777/announce,http://t-backup.213891.xyz:80/announce,http://tk.greedland.net:80/announce,http://torrentsmd.com:8080/announce,http://tr.highstar.shop:80/announce,http://tracker.beeimg.com:6969/announce,http://tracker.bt4g.com:2095/announce,http://tracker.dhitechnical.com:6969/announce,http://tracker.mywaifu.best:6969/announce,http://tracker.renfei.net:8080/announce,http://tracker.tritan.gg:8080/announce,http://www.all4nothin.net:80/announce.php,http://www.wareztorrent.com:80/announce,https://1337.abcvg.info:443/announce,https://shahidrazi.online:443/announce,https://t.213891.xyz:443/announce,https://torrent.tracker.durukanbal.com:443/announce,https://tr.abiir.top:443/announce,https://tr.abir.ga:443/announce,https://tr.nyacat.pw:443/announce,https://tracker.alaskantf.com:443/announce,https://tracker.belmult.online:443/announce,https://tracker.foreverpirates.co:443/announce,https://tracker.ghostchu-services.top:443/announce,https://tracker.kuroy.me:443/announce,https://tracker.moeblog.cn:443/announce,https://tracker.pmman.tech:443/announce,https://tracker.qingwa.pro:443/announce,https://tracker.uraniumhexafluori.de:443/announce,https://tracker.yemekyedim.com:443/announce,https://tracker.zhuqiy.com:443/announce,https://tracker1.520.jp:443/announce,udp://anna.bt.bontal.net:6969/announce,udp://d40969.acod.regrucolo.ru:6969/announce,udp://evan.im:6969/announce,udp://exodus.desync.com:6969/announce,udp://extracker.dahrkael.net:6969/announce,udp://hificode.in:6969/announce,udp://martin-gebhardt.eu:25/announce,udp://open-tracker.demonoid.ch:6969/announce,udp://open.demonii.com:1337/announce,udp://open.demonoid.ch:6969/announce,udp://open.stealth.si:80/announce,udp://opentor.org:2710/announce,udp://opentracker.io:6969/announce,udp://p4p.arenabg.com:1337/announce,udp://public.demonoid.ch:6969/announce,udp://retracker.hotplug.ru:2710/announce,udp://retracker.lanta.me:2710/announce,udp://retracker01-msk-virt.corbina.net:80/announce,udp://run.publictracker.xyz:6969/announce,udp://torrentclub.online:54123/announce,udp://tr4ck3r.duckdns.org:6969/announce,udp://tracker.dler.com:6969/announce,udp://tracker.dler.org:6969/announce,udp://tracker.ducks.party:1984/announce,udp://tracker.fnix.net:6969/announce,udp://tracker.gmi.gd:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://tracker.playground.ru:6969/announce,udp://tracker.plx.im:6969/announce,udp://tracker.qu.ax:6969/announce,udp://tracker.skyts.net:6969/announce,udp://tracker.srv00.com:6969/announce,udp://tracker.theoks.net:6969/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.tryhackx.org:6969/announce,udp://tracker.tvunderground.org.ru:3218/announce,udp://tracker1.myporn.club:9337/announce,udp://tracker2.dler.org:80/announce,udp://udp.tracker.projectk.org:23333/announce,udp://wepzone.net:6969/announce,udp://www.torrent.eu.org:451/announce,wss://tracker.openwebtorrent.com:443/announce
7099

71100
# The script to be run when download completes
72101
#on-download-complete=/app/conf/aria2-sample-hook.sh
@@ -75,8 +104,31 @@ on-download-complete=/app/conf/auto-upload.sh
75104
# The script to be run when download fails
76105
on-download-error=/app/conf/aria2-sample-hook.sh
77106

78-
## DHT
107+
## BT/DHT 优化
108+
# 启用本地节点查找
109+
bt-enable-lpd=true
110+
# 启用 DHT 功能
111+
enable-dht=true
112+
# 启用 DHT6(IPv6 DHT)
113+
#enable-dht6=false
114+
# BT 监听端口
115+
listen-port=6881-6999
116+
# DHT 监听端口
117+
dht-listen-port=6881
118+
# DHT 入口节点
79119
dht-entry-point=dht.transmissionbt.com:6881
80120
dht-entry-point=dht.vuze.com:6881
81121
dht-entry-point=dht.libtorrent.org:25401
82-
dht-listen-port=6881
122+
# DHT 文件
123+
dht-file-path=/app/.cache/dht.dat
124+
dht-file-path6=/app/.cache/dht6.dat
125+
# BT 最大连接数
126+
bt-max-peers=50
127+
# BT 请求的 peer 数量
128+
bt-request-peer-speed-limit=50K
129+
# 继续之前的BT任务时不进行hash检查
130+
bt-seed-unverified=true
131+
# BT tracker 的最大连接超时时间
132+
bt-tracker-connect-timeout=10
133+
# BT tracker 超时时间
134+
bt-tracker-timeout=10

0 commit comments

Comments
 (0)