forked from helloxz/ccaa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置 | ||
dir=/data/myftp | ||
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M | ||
#disk-cache=32M | ||
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc | ||
# 预分配所需时间: none < falloc ? trunc < prealloc | ||
# falloc和trunc则需要文件系统和内核支持 | ||
# NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项 | ||
file-allocation=trunc | ||
# 断点续传 | ||
continue=true | ||
|
||
#https | ||
#rpc-secure=true | ||
#rpc-certificate= | ||
#rpc-private-key= | ||
|
||
## 下载连接相关 ## | ||
|
||
# 最大同时下载任务数, 运行时可修改, 默认:5 | ||
max-concurrent-downloads=5 | ||
# 同一服务器连接数, 添加时可指定, 默认:1 | ||
max-connection-per-server=8 | ||
# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M | ||
# 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载 | ||
min-split-size=10M | ||
# 单个任务最大线程数, 添加时可指定, 默认:5 | ||
split=16 | ||
# 整体下载速度限制, 运行时可修改, 默认:0 | ||
#max-overall-download-limit=0 | ||
# 单个任务下载速度限制, 默认:0 | ||
#max-download-limit=0 | ||
# 整体上传速度限制, 运行时可修改, 默认:0 | ||
#max-overall-upload-limit=0 | ||
# 单个任务上传速度限制, 默认:0 | ||
#max-upload-limit=0 | ||
# 禁用IPv6, 默认:false | ||
disable-ipv6=true | ||
|
||
## 进度保存相关 ## | ||
|
||
# 从会话文件中读取下载任务 | ||
input-file=/etc/aria2/aria2.session | ||
# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件 | ||
save-session=/etc/aria2/aria2.session | ||
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0 | ||
#save-session-interval=60 | ||
|
||
## 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 | ||
# 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项 | ||
rpc-secret= | ||
# 设置的RPC访问用户名, 此选项新版已废弃, 建议改用 --rpc-secret 选项 | ||
#rpc-user= | ||
# 设置的RPC访问密码, 此选项新版已废弃, 建议改用 --rpc-secret 选项 | ||
#rpc-passwd= | ||
|
||
## BT/PT下载相关 ## | ||
|
||
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true | ||
#follow-torrent=true | ||
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999 | ||
listen-port=51413 | ||
# 单个种子最大连接数, 默认:55 | ||
#bt-max-peers=55 | ||
# 打开DHT功能, PT需要禁用, 默认:true | ||
enable-dht=true | ||
# 打开IPv6 DHT功能, PT需要禁用 | ||
#enable-dht6=false | ||
# DHT网络监听端口, 默认:6881-6999 | ||
#dht-listen-port=6881-6999 | ||
# 本地节点查找, PT需要禁用, 默认:false | ||
#bt-enable-lpd=false | ||
# 种子交换, PT需要禁用, 默认:true | ||
enable-peer-exchange=false | ||
# 每个种子限速, 对少种的PT很有用, 默认:50K | ||
#bt-request-peer-speed-limit=50K | ||
# 客户端伪装, PT需要 | ||
peer-id-prefix=-TR2770- | ||
user-agent=Transmission/2.77 | ||
# 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0 | ||
seed-ratio=0 | ||
# 强制保存会话, 即使任务已经完成, 默认:false | ||
# 较新的版本开启后会在任务完成后依然保留.aria2文件 | ||
#force-save=false | ||
# BT校验相关, 默认:true | ||
#bt-hash-check-seed=true | ||
# 继续之前的BT任务时, 无需再次校验, 默认:false | ||
bt-seed-unverified=true | ||
# 保存磁力链接元数据为种子文件(.torrent文件), 默认:false | ||
bt-save-metadata=true | ||
|
||
bt-tracker=udp://tracker.coppersurfer.tk:6969/announce,udp://tracker.open-internet.nl:6969/announce,udp://exodus.desync.com:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://tracker.internetwarriors.net:1337/announce,udp://9.rarbg.to:2710/announce,udp://public.popcorn-tracker.org:6969/announce,udp://tracker.vanitycore.co:6969/announce,udp://tracker.mg64.net:6969/announce,udp://mgtracker.org:6969/announce,udp://tracker.tiny-vps.com:6969/announce,udp://tracker.cypherpunks.ru:6969/announce,udp://bt.xxx-tracker.com:2710/announce,udp://tracker.torrent.eu.org:451/announce,udp://thetracker.org:80/announce,udp://retracker.lanta-net.ru:2710/announce,udp://open.stealth.si:80/announce,udp://torr.ws:2710/announce,http://retracker.telecom.by:80/announce,http://tracker.city9x.com:2710/announce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#配置一个站点 | ||
0.0.0.0:6080 { | ||
root /data/aria2 | ||
gzip | ||
#超时时间 | ||
timeouts 0 | ||
#访问口令 | ||
basicauth / username password | ||
#文件管理 | ||
filemanager /admin { | ||
database /etc/ccaa/ | ||
no_auth | ||
locale zh-cn | ||
allow_commands false | ||
allow_edit true | ||
allow_new true | ||
allow_publish true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/bin/bash | ||
##### 一键安装Caddy + Aria2 + AriaNg ##### | ||
##### 作者:xiaoz.me ##### | ||
##### 更新时间:2018-09-28 ##### | ||
|
||
#导入环境变量 | ||
|
||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin | ||
export PATH | ||
|
||
#安装Aria2 | ||
function install_aria2(){ | ||
#更新软件 | ||
yum -y update | ||
yum -y install wget unzip curl | ||
yum -y install epel-release | ||
yum -y install aria2 | ||
} | ||
#安装caddy | ||
function install_caddy(){ | ||
#一键安装https://caddyserver.com/download/linux/amd64?plugins=http.filemanager&license=personal&telemetry=off | ||
#curl https://getcaddy.com | bash -s personal http.filemanager | ||
#安装caddy | ||
wget http://soft.xiaoz.org/linux/caddy_v0.11.0_linux_amd64_custom_personal.tar.gz -O caddy.tar.gz | ||
tar -zxvf caddy.tar.gz | ||
mv caddy /usr/sbin/ | ||
chmod +x caddy | ||
#添加服务 | ||
mv init/linux-systemd/caddy.service /lib/systemd/system | ||
chmod +x /lib/systemd/system/caddy.service | ||
} | ||
#处理配置文件 | ||
function dealconf(){ | ||
#创建目录和文件 | ||
mkdir -p /etc/ccaa/ | ||
touch /etc/ccaa/aria2.session | ||
touch /etc/ccaa/aria2.log | ||
touch /etc/ccaa/caddy.log | ||
cp aria2.conf /etc/ccaa/ | ||
cp caddy.conf /etc/ccaa/ | ||
} | ||
#自动放行端口 | ||
function chk_firewall() { | ||
if [ -e "/etc/sysconfig/iptables" ] | ||
then | ||
iptables -I INPUT -p tcp --dport 6080 -j ACCEPT | ||
iptables -I INPUT -p tcp --dport 6800 -j ACCEPT | ||
iptables -I INPUT -p tcp --dport 6998 -j ACCEPT | ||
iptables -I INPUT -p tcp --dport 51413 -j ACCEPT | ||
service iptables save | ||
service iptables restart | ||
else | ||
firewall-cmd --zone=public --add-port=6080/tcp --permanent | ||
firewall-cmd --zone=public --add-port=6800/tcp --permanent | ||
firewall-cmd --zone=public --add-port=6998/tcp --permanent | ||
firewall-cmd --zone=public --add-port=51413/tcp --permanent | ||
firewall-cmd --reload | ||
fi | ||
} | ||
#设置账号密码 | ||
function setting(){ | ||
read -p "设置下载路径(请填写绝对地址,如/data/aria2):" downpath | ||
read -p "设置Aria2密码(字母或数字组合,不要含有特殊字符):" secret | ||
read -p "设置Caddy用户名:" caddyuser | ||
read -p "设置Caddy密码:" caddypass | ||
|
||
#执行操作 | ||
mkdir -p ${downpath} | ||
sed -i "s/rpc-secret=/rpc-secret=${secret}/g" /etc/ccaa/aria2.conf | ||
sed -i "s/username/${caddyuser}/g" /etc/ccaa/caddy.conf | ||
sed -i "s/password/${caddypass}/g" /etc/ccaa/caddy.conf | ||
|
||
#启动服务 | ||
nohup aria2c --conf-path=/etc/ccaa/aria2.conf > /etc/ccaa/aria2.log 2>&1 & | ||
nohup caddy -conf="/etc/ccaa/caddy.conf" > /etc/ccaa/caddy.log 2>&1 & | ||
|
||
echo '-------------------------------------------------------------' | ||
echo '大功告成,请访问:http://IP:6080' | ||
echo '需要帮助请访问:' | ||
echo '-------------------------------------------------------------' | ||
} | ||
|
||
#选择安装方式 | ||
echo "------------------------------------------------" | ||
echo "Caddy + Aria2 + AriaNg一键安装脚本,简称CCAA" | ||
echo "1) 安装CCAA" | ||
echo "2) 卸载CCAA" | ||
echo "3) 更新" | ||
echo "q) 退出!" | ||
read -p ":" istype | ||
case $istype in | ||
1) | ||
install_aria2 | ||
install_caddy | ||
dealconf | ||
chk_firewall | ||
setting | ||
;; | ||
2) | ||
check_os | ||
get_ip | ||
chk_firewall | ||
BinaryInstall | ||
;; | ||
3) | ||
#执行卸载函数 | ||
uninstall | ||
#删除端口 | ||
DelPort | ||
echo 'Uninstall complete.' | ||
;; | ||
q) | ||
exit | ||
;; | ||
*) echo '参数错误!' | ||
esac |