Merge branch 'dev'
commit
a0128417a9
380
install.sh
380
install.sh
|
@ -199,8 +199,8 @@ installTools(){
|
||||||
mkdirTools
|
mkdirTools
|
||||||
|
|
||||||
progressTools "yellow" "检查、安装acme--->" 13
|
progressTools "yellow" "检查、安装acme--->" 13
|
||||||
mkdir -p /tmp/tls/
|
mkdir -p /etc/tls/
|
||||||
curl -s https://get.acme.sh | sh > /tmp/tls/acme.log
|
curl -s https://get.acme.sh | sh > /etc/tls/acme.log
|
||||||
if [[ -z `find ~/.acme.sh -name "acme.sh"` ]]
|
if [[ -z `find ~/.acme.sh -name "acme.sh"` ]]
|
||||||
then
|
then
|
||||||
echoContent red " acme安装失败--->"
|
echoContent red " acme安装失败--->"
|
||||||
|
@ -251,9 +251,9 @@ installNginx(){
|
||||||
# 安装TLS
|
# 安装TLS
|
||||||
installTLS(){
|
installTLS(){
|
||||||
mkdir -p /etc/nginx/v2ray-agent-https/
|
mkdir -p /etc/nginx/v2ray-agent-https/
|
||||||
|
mkdir -p /etc/v2ray-agent/tls/
|
||||||
touch /etc/nginx/v2ray-agent-https/config
|
touch /etc/nginx/v2ray-agent-https/config
|
||||||
|
if [[ -z `find /etc/v2ray-agent/tls/ -name "$1*"` ]]
|
||||||
if [[ -z `find /tmp -name "$1*"` ]]
|
|
||||||
then
|
then
|
||||||
progressTools "yellow" "检查、安装TLS证书--->" 16
|
progressTools "yellow" "检查、安装TLS证书--->" 16
|
||||||
|
|
||||||
|
@ -272,20 +272,20 @@ installTLS(){
|
||||||
|
|
||||||
echo $1 `date +%s` > /etc/nginx/v2ray-agent-https/config
|
echo $1 `date +%s` > /etc/nginx/v2ray-agent-https/config
|
||||||
|
|
||||||
cp -R /etc/nginx/v2ray-agent-https/config /tmp/tls/config
|
cp -R /etc/nginx/v2ray-agent-https/config /etc/v2ray-agent/tls/config
|
||||||
cp -R /etc/nginx/v2ray-agent-https/$1.crt /tmp/tls/$1.crt
|
cp -R /etc/nginx/v2ray-agent-https/$1.crt /etc/v2ray-agent/tls/$1.crt
|
||||||
cp -R /etc/nginx/v2ray-agent-https/$1.key /tmp/tls/$1.key
|
cp -R /etc/nginx/v2ray-agent-https/$1.key /etc/v2ray-agent/tls/$1.key
|
||||||
progressTools "yellow" " TLS证书备份成功,证书位置:/tmp/tls--->"
|
progressTools "yellow" " TLS证书备份成功,证书位置:/etc/v2ray-agent/tls--->"
|
||||||
elif [[ -z `cat /tmp/tls/$1.crt` ]] || [[ -z `cat /tmp/tls/$1.key` ]]
|
elif [[ -z `cat /etc/v2ray-agent/tls/$1.crt` ]] || [[ -z `cat /etc/v2ray-agent/tls/$1.key` ]]
|
||||||
then
|
then
|
||||||
progressTools "red" " 检测到错误证书,需重新生成,重新生成中--->" 17
|
progressTools "red" " 检测到错误证书,需重新生成,重新生成中--->" 17
|
||||||
rm -rf /tmp/tls
|
rm -rf /etc/v2ray-agent/tls/
|
||||||
installTLS $1
|
installTLS $1
|
||||||
else
|
else
|
||||||
progressTools "yellow" "检测到备份证书,使用--->"
|
progressTools "yellow" "检测到备份证书,使用--->"
|
||||||
cp -R /tmp/tls/$1.crt /etc/nginx/v2ray-agent-https/$1.crt
|
cp -R /etc/v2ray-agent/tls/$1.crt /etc/nginx/v2ray-agent-https/$1.crt
|
||||||
cp -R /tmp/tls/$1.key /etc/nginx/v2ray-agent-https/$1.key
|
cp -R /etc/v2ray-agent/tls/$1.key /etc/nginx/v2ray-agent-https/$1.key
|
||||||
cp -R /tmp/tls/config /etc/nginx/v2ray-agent-https/config
|
cp -R /etc/v2ray-agent/tls/config /etc/nginx/v2ray-agent-https/config
|
||||||
fi
|
fi
|
||||||
# nginxInstallLine=`cat /etc/nginx/nginx.conf|grep -n "}"|awk -F "[:]" 'END{print $1-1}'`
|
# nginxInstallLine=`cat /etc/nginx/nginx.conf|grep -n "}"|awk -F "[:]" 'END{print $1-1}'`
|
||||||
# sed -i "${nginxInstallLine}i server {listen 443 ssl;server_name $1;root /usr/share/nginx/html;ssl_certificate /etc/nginx/$1.crt;ssl_certificate_key /etc/nginx/$1.key;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_prefer_server_ciphers on;location / {} location /alone { proxy_redirect off;proxy_pass http://127.0.0.1:31299;proxy_http_version 1.1;proxy_set_header Upgrade \$http_upgrade;proxy_set_header Connection "upgrade";proxy_set_header X-Real-IP \$remote_addr;proxy_set_header Host \$host;proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;}}" /etc/nginx/nginx.conf
|
# sed -i "${nginxInstallLine}i server {listen 443 ssl;server_name $1;root /usr/share/nginx/html;ssl_certificate /etc/nginx/$1.crt;ssl_certificate_key /etc/nginx/$1.key;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_prefer_server_ciphers on;location / {} location /alone { proxy_redirect off;proxy_pass http://127.0.0.1:31299;proxy_http_version 1.1;proxy_set_header Upgrade \$http_upgrade;proxy_set_header Connection "upgrade";proxy_set_header X-Real-IP \$remote_addr;proxy_set_header Host \$host;proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;}}" /etc/nginx/nginx.conf
|
||||||
|
@ -322,7 +322,7 @@ reInstallTLS(){
|
||||||
progressTools "yellow" "检查、添加定时维护证书--->" 18
|
progressTools "yellow" "检查、添加定时维护证书--->" 18
|
||||||
touch /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
touch /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
touch /etc/nginx/v2ray-agent-https/backup_crontab.cron
|
touch /etc/nginx/v2ray-agent-https/backup_crontab.cron
|
||||||
touch /tmp/tls/tls.log
|
touch /etc/v2ray-agent/tls/tls.log
|
||||||
if [[ -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
|
if [[ -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
|
||||||
then
|
then
|
||||||
crontab -l >> /etc/nginx/v2ray-agent-https/backup_crontab.cron
|
crontab -l >> /etc/nginx/v2ray-agent-https/backup_crontab.cron
|
||||||
|
@ -333,32 +333,33 @@ reInstallTLS(){
|
||||||
# 备份
|
# 备份
|
||||||
|
|
||||||
domain=$1
|
domain=$1
|
||||||
echo "#!/usr/bin/env bash" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
cat << EOF > /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "domain=${domain}" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
domain=$1
|
||||||
echo "eccPath=\`find ~/.acme.sh -name \"\${domain}_ecc\"|head -1\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
eccPath=\`find ~/.acme.sh -name "\${domain}_ecc"|head -1\`
|
||||||
echo "mkdir -p /tmp/tls" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
mkdir -p /etc/v2ray-agent/tls
|
||||||
echo "touch /tmp/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
touch /etc/v2ray-agent/tls/tls.log
|
||||||
echo "touch /tmp/tls/acme.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
touch /etc/v2ray-agent/tls/acme.log
|
||||||
echo "if [[ ! -z \${eccPath} ]]" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
if [[ ! -z \${eccPath} ]]
|
||||||
echo "then" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
then
|
||||||
echo "modifyTime=\`stat \${eccPath}/\${domain}.key|sed -n '6,6p'|awk '{print \$2\" \"\$3\" \"\$4\" \"\$5}'\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
modifyTime=\`stat \${eccPath}/\${domain}.key|sed -n '6,6p'|awk '{print \$2" "\$3" "\$4" "\$5}'\`
|
||||||
echo "modifyTime=\`date +%s -d \"\${modifyTime}\"\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
modifyTime=\`date +%s -d "\${modifyTime}"\`
|
||||||
echo "currentTime=\`date +%s\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
currentTime=\`date +%s\`
|
||||||
echo "stampDiff=\`expr \${currentTime} - \${modifyTime}\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
stampDiff=\`expr \${currentTime} - \${modifyTime}\`
|
||||||
echo "minutes=\`expr \${stampDiff} / 60\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
minutes=\`expr \${stampDiff} / 60\`
|
||||||
echo "status=\"正常\"" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
status="正常"
|
||||||
echo "reloadTime=\"暂无\"" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
reloadTime="暂无"
|
||||||
echo "if [[ ! -z \${modifyTime} ]] && [[ ! -z \${currentTime} ]] && [[ ! -z \${stampDiff} ]] && [[ ! -z \${minutes} ]] && [[ \${minutes} -lt '120' ]]" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
if [[ ! -z \${modifyTime} ]] && [[ ! -z \${currentTime} ]] && [[ ! -z \${stampDiff} ]] && [[ ! -z \${minutes} ]] && [[ \${minutes} -lt '120' ]]
|
||||||
echo "then" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
then
|
||||||
echo "nginx -s stop" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
nginx -s stop
|
||||||
echo "~/.acme.sh/acme.sh --installcert -d \${domain} --fullchainpath /etc/nginx/v2ray-agent-https/\${domain}.crt --keypath /etc/nginx/v2ray-agent-https/\${domain}.key --ecc >> /tmp/tls/acme.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
~/.acme.sh/acme.sh --installcert -d \${domain} --fullchainpath /etc/nginx/v2ray-agent-https/\${domain}.crt --keypath /etc/nginx/v2ray-agent-https/\${domain}.key --ecc >> /tmp/tls/acme.log
|
||||||
echo "nginx" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
nginx
|
||||||
echo "reloadTime=\`date -d @\${currentTime} +\"%F %H:%M:%S\"\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
reloadTime=\`date -d @\${currentTime} +"%F %H:%M:%S"\`
|
||||||
echo "fi" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
fi
|
||||||
echo "echo \"域名:\${domain},modifyTime:\"\`date -d @\${modifyTime} +\"%F %H:%M:%S\"\`,\"检查时间:\"\`date -d @\${currentTime} +\"%F %H:%M:%S\"\`,"上次生成证书的时:"\`expr \${minutes} / 1440\`\"天前\",\"证书状态:\"\${status},\"重新生成日期:\"\${reloadTime} >> /tmp/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "域名:\${domain},modifyTime:"\`date -d @\${modifyTime} +"%F %H:%M:%S"\`,"检查时间:"\`date -d @\${currentTime} +"%F %H:%M:%S"\`,上次生成证书的时:\`expr \${minutes} / 1440\`"天前","证书状态:"\${status},"重新生成日期:"\${reloadTime} >> /etc/v2ray-agent/tls/tls.log
|
||||||
echo "else" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
else
|
||||||
echo "echo '无法找到证书路径' >> /tmp/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo '无法找到证书路径' >> /etc/v2ray-agent/tls/tls.log
|
||||||
echo "fi" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
fi
|
||||||
|
EOF
|
||||||
|
|
||||||
if [[ ! -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
|
if [[ ! -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
|
||||||
then
|
then
|
||||||
|
@ -374,7 +375,8 @@ reInstallTLS(){
|
||||||
installV2Ray(){
|
installV2Ray(){
|
||||||
# ls -F /usr/bin/v2ray/|grep "v2ray"
|
# ls -F /usr/bin/v2ray/|grep "v2ray"
|
||||||
mkdir -p /usr/bin/v2ray/
|
mkdir -p /usr/bin/v2ray/
|
||||||
if [[ -z `ls -F /tmp/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /tmp/v2ray/|grep "v2ctl"` ]]
|
mkdir -p /etc/v2ray-agent/v2ray/
|
||||||
|
if [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ctl"` ]]
|
||||||
then
|
then
|
||||||
if [[ -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /usr/bin/v2ray/|grep "v2ctl"` ]]
|
if [[ -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /usr/bin/v2ray/|grep "v2ctl"` ]]
|
||||||
then
|
then
|
||||||
|
@ -382,14 +384,14 @@ installV2Ray(){
|
||||||
version=`curl -s https://github.com/v2ray/v2ray-core/releases|grep /v2ray/v2ray-core/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'`
|
version=`curl -s https://github.com/v2ray/v2ray-core/releases|grep /v2ray/v2ray-core/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'`
|
||||||
progressTools "green" " v2ray-core版本:${version}"
|
progressTools "green" " v2ray-core版本:${version}"
|
||||||
|
|
||||||
wget -q -P /tmp/v2ray https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip
|
wget -q -P /etc/v2ray-agent/v2ray https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip
|
||||||
unzip /tmp/v2ray/v2ray-linux-64.zip -d /tmp/v2ray > /dev/null
|
unzip /etc/v2ray-agent/v2ray/v2ray-linux-64.zip -d /etc/v2ray-agent/v2ray > /dev/null
|
||||||
cp /tmp/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /tmp/v2ray/v2ctl /usr/bin/v2ray/v2ctl
|
cp /etc/v2ray-agent/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /etc/v2ray-agent/v2ray/v2ctl /usr/bin/v2ray/v2ctl
|
||||||
rm -rf /tmp/v2ray/v2ray-linux-64.zip
|
rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
progressTools "green" " v2ray-core版本:`/tmp/v2ray/v2ray --version|awk '{print $2}'|head -1`"
|
progressTools "green" " v2ray-core版本:`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1`"
|
||||||
cp /tmp/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /tmp/v2ray/v2ctl /usr/bin/v2ray/v2ctl
|
cp /etc/v2ray-agent/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /etc/v2ray-agent/v2ray/v2ctl /usr/bin/v2ray/v2ctl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z `find /bin /usr/bin -name "systemctl"` ]]
|
if [[ ! -z `find /bin /usr/bin -name "systemctl"` ]]
|
||||||
|
@ -450,24 +452,26 @@ installV2RayService(){
|
||||||
rm -rf /etc/systemd/system/v2ray.service
|
rm -rf /etc/systemd/system/v2ray.service
|
||||||
touch /etc/systemd/system/v2ray.service
|
touch /etc/systemd/system/v2ray.service
|
||||||
|
|
||||||
echo '[Unit]' >> /etc/systemd/system/v2ray.service
|
cat << EOF > /etc/systemd/system/v2ray.service
|
||||||
echo 'Description=V2Ray - A unified platform for anti-censorship' >> /etc/systemd/system/v2ray.service
|
[Unit]
|
||||||
echo 'Documentation=https://v2ray.com https://guide.v2fly.org' >> /etc/systemd/system/v2ray.service
|
Description=V2Ray - A unified platform for anti-censorship
|
||||||
echo 'After=network.target nss-lookup.target' >> /etc/systemd/system/v2ray.service
|
Documentation=https://v2ray.com https://guide.v2fly.org
|
||||||
echo 'Wants=network-online.target' >> /etc/systemd/system/v2ray.service
|
After=network.target nss-lookup.target
|
||||||
echo '' >> /etc/systemd/system/v2ray.service
|
Wants=network-online.target
|
||||||
echo '[Service]' >> /etc/systemd/system/v2ray.service
|
|
||||||
echo 'Type=simple' >> /etc/systemd/system/v2ray.service
|
[Service]
|
||||||
echo 'User=root' >> /etc/systemd/system/v2ray.service
|
Type=simple
|
||||||
echo 'CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_RAW' >> /etc/systemd/system/v2ray.service
|
User=root
|
||||||
echo 'NoNewPrivileges=yes' >> /etc/systemd/system/v2ray.service
|
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||||
echo 'ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json' >> /etc/systemd/system/v2ray.service
|
NoNewPrivileges=yes
|
||||||
echo 'Restart=on-failure' >> /etc/systemd/system/v2ray.service
|
ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json
|
||||||
echo 'RestartPreventExitStatus=23' >> /etc/systemd/system/v2ray.service
|
Restart=on-failure
|
||||||
echo '' >> /etc/systemd/system/v2ray.service
|
RestartPreventExitStatus=23
|
||||||
echo '' >> /etc/systemd/system/v2ray.service
|
|
||||||
echo '[Install]' >> /etc/systemd/system/v2ray.service
|
|
||||||
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/v2ray.service
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
progressTools "green" " 配置V2Ray开机自启成功--->"
|
progressTools "green" " 配置V2Ray开机自启成功--->"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,18 +484,220 @@ initV2RayConfig(){
|
||||||
# 自定义IPLC端口
|
# 自定义IPLC端口
|
||||||
if [[ ! -z ${iplc} ]]
|
if [[ ! -z ${iplc} ]]
|
||||||
then
|
then
|
||||||
echo '{"log":{"access":"/etc/v2ray/v2ray_access_ws_tls.log","error":"/etc/v2ray/v2ray_error_ws_tls.log","loglevel":"debug"},"stats":{},"api":{"services":["StatsService"],"tag":"api"},"policy":{"levels":{"1":{"handshake":4,"connIdle":300,"uplinkOnly":2,"downlinkOnly":5,"statsUserUplink":false,"statsUserDownlink":false}},"system":{"statsInboundUplink":true,"statsInboundDownlink":true}},"allocate":{"strategy":"always","refresh":5,"concurrency":3},"inbounds":[{"port":31299,"protocol":"vmess","settings":{"clients":[{"id":"654765fe-5fb1-271f-7c3f-18ed82827f72","alterId":64,"level":1,"email":"test@v2ray.com"}]},"streamSettings":{"network":"ws","wsSettings":{"path":"/alone"}}},{"port":31294,"protocol":"vmess","settings":{"clients":[{"id":"ab11e002-7008-ef16-4363-217aea8dc81c","alterId":64,"level":1,"email":"HK_深港0.35x IPLC@v2ray.com"},{"id":"246d748a-dd07-2172-a397-ab110aa5ad2a","alterId":64,"level":1,"email":"HK_莞港IPLC@v2ray.com"}]}}],"outbounds":[{"protocol":"freedom","settings":{"OutboundConfigurationObject":{"domainStrategy":"AsIs","userLevel":0}}}],"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"dns":{"servers":["8.8.8.8","8.8.4.4"],"tag":"dns_inbound"}}' > /etc/v2ray/config.json
|
cat << EOF > /etc/v2ray/config.json
|
||||||
|
{
|
||||||
|
"log":{
|
||||||
|
"access":"/etc/v2ray/v2ray_access_ws_tls.log",
|
||||||
|
"error":"/etc/v2ray/v2ray_error_ws_tls.log",
|
||||||
|
"loglevel":"debug"
|
||||||
|
},
|
||||||
|
"stats":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"api":{
|
||||||
|
"services":[
|
||||||
|
"StatsService"
|
||||||
|
],
|
||||||
|
"tag":"api"
|
||||||
|
},
|
||||||
|
"policy":{
|
||||||
|
"levels":{
|
||||||
|
"1":{
|
||||||
|
"handshake":4,
|
||||||
|
"connIdle":300,
|
||||||
|
"uplinkOnly":2,
|
||||||
|
"downlinkOnly":5,
|
||||||
|
"statsUserUplink":false,
|
||||||
|
"statsUserDownlink":false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"system":{
|
||||||
|
"statsInboundUplink":true,
|
||||||
|
"statsInboundDownlink":true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allocate":{
|
||||||
|
"strategy":"always",
|
||||||
|
"refresh":5,
|
||||||
|
"concurrency":3
|
||||||
|
},
|
||||||
|
"inbounds":[
|
||||||
|
{
|
||||||
|
"port":31299,
|
||||||
|
"protocol":"vmess",
|
||||||
|
"settings":{
|
||||||
|
"clients":[
|
||||||
|
{
|
||||||
|
"id":"654765fe-5fb1-271f-7c3f-18ed82827f72",
|
||||||
|
"alterId":64,
|
||||||
|
"level":1,
|
||||||
|
"email":"test@v2ray.com"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings":{
|
||||||
|
"network":"ws",
|
||||||
|
"wsSettings":{
|
||||||
|
"path":"/alone"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"port":31294,
|
||||||
|
"protocol":"vmess",
|
||||||
|
"settings":{
|
||||||
|
"clients":[
|
||||||
|
{
|
||||||
|
"id":"ab11e002-7008-ef16-4363-217aea8dc81c",
|
||||||
|
"alterId":64,
|
||||||
|
"level":1,
|
||||||
|
"email":"HK_深港0.35x IPLC@v2ray.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"246d748a-dd07-2172-a397-ab110aa5ad2a",
|
||||||
|
"alterId":64,
|
||||||
|
"level":1,
|
||||||
|
"email":"HK_莞港IPLC@v2ray.com"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds":[
|
||||||
|
{
|
||||||
|
"protocol":"freedom",
|
||||||
|
"settings":{
|
||||||
|
"OutboundConfigurationObject":{
|
||||||
|
"domainStrategy":"AsIs",
|
||||||
|
"userLevel":0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing":{
|
||||||
|
"settings":{
|
||||||
|
"rules":[
|
||||||
|
{
|
||||||
|
"inboundTag":[
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"outboundTag":"api",
|
||||||
|
"type":"field"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"strategy":"rules"
|
||||||
|
},
|
||||||
|
"dns":{
|
||||||
|
"servers":[
|
||||||
|
"8.8.8.8",
|
||||||
|
"8.8.4.4"
|
||||||
|
],
|
||||||
|
"tag":"dns_inbound"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
else
|
else
|
||||||
echo '{"log":{"access":"/etc/v2ray/v2ray_access_ws_tls.log","error":"/etc/v2ray/v2ray_error_ws_tls.log","loglevel":"debug"},"stats":{},"api":{"services":["StatsService"],"tag":"api"},"policy":{"levels":{"1":{"handshake":4,"connIdle":300,"uplinkOnly":2,"downlinkOnly":5,"statsUserUplink":false,"statsUserDownlink":false}},"system":{"statsInboundUplink":true,"statsInboundDownlink":true}},"allocate":{"strategy":"always","refresh":5,"concurrency":3},"inbounds":[{"port":31299,"protocol":"vmess","settings":{"clients":[{"id":"654765fe-5fb1-271f-7c3f-18ed82827f72","alterId":64,"level":1,"email":"test@v2ray.com"}]},"streamSettings":{"network":"ws","wsSettings":{"path":"/alone"}}}],"outbounds":[{"protocol":"freedom","settings":{"OutboundConfigurationObject":{"domainStrategy":"AsIs","userLevel":0}}}],"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"dns":{"servers":["8.8.8.8","8.8.4.4"],"tag":"dns_inbound"}}' > /etc/v2ray/config.json
|
cat << EOF > /etc/v2ray/config.json
|
||||||
|
{
|
||||||
|
"log":{
|
||||||
|
"access":"/etc/v2ray/v2ray_access_ws_tls.log",
|
||||||
|
"error":"/etc/v2ray/v2ray_error_ws_tls.log",
|
||||||
|
"loglevel":"debug"
|
||||||
|
},
|
||||||
|
"stats":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"api":{
|
||||||
|
"services":[
|
||||||
|
"StatsService"
|
||||||
|
],
|
||||||
|
"tag":"api"
|
||||||
|
},
|
||||||
|
"policy":{
|
||||||
|
"levels":{
|
||||||
|
"1":{
|
||||||
|
"handshake":4,
|
||||||
|
"connIdle":300,
|
||||||
|
"uplinkOnly":2,
|
||||||
|
"downlinkOnly":5,
|
||||||
|
"statsUserUplink":false,
|
||||||
|
"statsUserDownlink":false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"system":{
|
||||||
|
"statsInboundUplink":true,
|
||||||
|
"statsInboundDownlink":true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allocate":{
|
||||||
|
"strategy":"always",
|
||||||
|
"refresh":5,
|
||||||
|
"concurrency":3
|
||||||
|
},
|
||||||
|
"inbounds":[
|
||||||
|
{
|
||||||
|
"port":31299,
|
||||||
|
"protocol":"vmess",
|
||||||
|
"settings":{
|
||||||
|
"clients":[
|
||||||
|
{
|
||||||
|
"id":"654765fe-5fb1-271f-7c3f-18ed82827f72",
|
||||||
|
"alterId":64,
|
||||||
|
"level":1,
|
||||||
|
"email":"test@v2ray.com"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings":{
|
||||||
|
"network":"ws",
|
||||||
|
"wsSettings":{
|
||||||
|
"path":"/alone"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds":[
|
||||||
|
{
|
||||||
|
"protocol":"freedom",
|
||||||
|
"settings":{
|
||||||
|
"OutboundConfigurationObject":{
|
||||||
|
"domainStrategy":"AsIs",
|
||||||
|
"userLevel":0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing":{
|
||||||
|
"settings":{
|
||||||
|
"rules":[
|
||||||
|
{
|
||||||
|
"inboundTag":[
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"outboundTag":"api",
|
||||||
|
"type":"field"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"strategy":"rules"
|
||||||
|
},
|
||||||
|
"dns":{
|
||||||
|
"servers":[
|
||||||
|
"8.8.8.8",
|
||||||
|
"8.8.4.4"
|
||||||
|
],
|
||||||
|
"tag":"dns_inbound"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
# 自定义路径
|
# 自定义路径
|
||||||
if [[ ! -z "$1" ]]
|
if [[ ! -z "$1" ]]
|
||||||
then
|
then
|
||||||
sed -i "s/alone/${1}/g" `grep alone -rl /etc/v2ray/config.json`
|
sed -i "s/alone/${1}/g" `grep alone -rl /etc/v2ray/config.json`
|
||||||
else
|
|
||||||
sed -i "s/654765fe-5fb1-271f-7c3f-18ed82827f72/${uuid}/g" `grep 654765fe-5fb1-271f-7c3f-18ed82827f72 -rl /etc/v2ray/config.json`
|
|
||||||
fi
|
fi
|
||||||
# todo 这里需要修改
|
sed -i "s/654765fe-5fb1-271f-7c3f-18ed82827f72/${uuid}/g" `grep 654765fe-5fb1-271f-7c3f-18ed82827f72 -rl /etc/v2ray/config.json`
|
||||||
}
|
}
|
||||||
qrEncode(){
|
qrEncode(){
|
||||||
user=`cat /etc/v2ray/config.json|jq .inbounds[0]`
|
user=`cat /etc/v2ray/config.json|jq .inbounds[0]`
|
||||||
|
@ -538,14 +744,6 @@ qrEncode(){
|
||||||
# | qrencode -t UTF8
|
# | qrencode -t UTF8
|
||||||
# echo ${qrCodeBase64}
|
# echo ${qrCodeBase64}
|
||||||
}
|
}
|
||||||
# 查看dns解析ip
|
|
||||||
checkDNS(){
|
|
||||||
echo '' > /tmp/pingLog
|
|
||||||
ping -c 3 $1 >> /tmp/pingLog
|
|
||||||
serverStatus=`ping -c 3 $1|head -1|awk -F "[service]" '{print $1}'`
|
|
||||||
pingLog=`ping -c 3 $1|tail -n 5|head -1|awk -F "[ ]" '{print $4 $7}'`
|
|
||||||
echoContent skyBlue "DNS解析ip:"${pingLog}
|
|
||||||
}
|
|
||||||
# 查看本机ip
|
# 查看本机ip
|
||||||
checkDomainIP(){
|
checkDomainIP(){
|
||||||
currentIP=`curl -s ifconfig.me|awk '{print}'`
|
currentIP=`curl -s ifconfig.me|awk '{print}'`
|
||||||
|
@ -613,8 +811,8 @@ installProgressFunction(){
|
||||||
|
|
||||||
# 卸载安装的内容
|
# 卸载安装的内容
|
||||||
removeInstall(){
|
removeInstall(){
|
||||||
rm -rf /tmp/v2ray
|
rm -rf /etc/v2ray-agent/v2ray
|
||||||
rm -rf /tmp/tls
|
rm -rf /etc/v2ray-agent/tls
|
||||||
rm -rf /etc/v2ray
|
rm -rf /etc/v2ray
|
||||||
rm -rf /root/.acme.sh
|
rm -rf /root/.acme.sh
|
||||||
echo ${removeType},${installType}
|
echo ${removeType},${installType}
|
||||||
|
@ -625,18 +823,12 @@ init(){
|
||||||
mkdirTools
|
mkdirTools
|
||||||
cd
|
cd
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
echoContent red "脚本概述"
|
echoContent green "CDN+WebSocket+TLS+Nginx+伪装博客一键脚本"
|
||||||
echoContent green "欢迎使用Cloudflare+WebSocket+TLS+Nginx+伪装博客 一键脚本"
|
echoContent green "作者:mack-a"
|
||||||
echo
|
|
||||||
echoContent green "作者:mack-a [https://t.me/mack_a]"
|
|
||||||
echo
|
|
||||||
echoContent green "Version:v1.0.6"
|
echoContent green "Version:v1.0.6"
|
||||||
echo
|
|
||||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||||
echo
|
echoContent green "TG群:https://t.me/technologyshare"
|
||||||
echoContent green "TG:https://t.me/technologyshare"
|
echoContent green "欢迎找我请求协助与反馈问题"
|
||||||
echo
|
|
||||||
echoContent green "如遇到解决不了的问题可以提issues或者直接私聊作者,欢迎聊骚"
|
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
echoContent red "状态展示"
|
echoContent red "状态展示"
|
||||||
echoContent green "已安装账号:"
|
echoContent green "已安装账号:"
|
||||||
|
@ -687,8 +879,8 @@ init(){
|
||||||
then
|
then
|
||||||
echoContent yellow " 定时更新tls脚本路径:/etc/nginx/v2ray-agent-https/reloadInstallTLS.sh"
|
echoContent yellow " 定时更新tls脚本路径:/etc/nginx/v2ray-agent-https/reloadInstallTLS.sh"
|
||||||
echoContent yellow " 定时任务文件路径:/etc/nginx/v2ray-agent-https/backup_crontab.cron"
|
echoContent yellow " 定时任务文件路径:/etc/nginx/v2ray-agent-https/backup_crontab.cron"
|
||||||
echoContent yellow " 定时任务日志路径:/tmp/tls/tls.log"
|
echoContent yellow " 定时任务日志路径:/etc/v2ray-agent/tls/tls.log"
|
||||||
echoContent yellow " acme.sh日志路径:/tmp/tls/acme.log"
|
echoContent yellow " acme.sh日志路径:/etc/v2ray-agent/tls/acme.log"
|
||||||
else
|
else
|
||||||
echoContent yellow " 暂未安装或未使用最新的脚本安装"
|
echoContent yellow " 暂未安装或未使用最新的脚本安装"
|
||||||
fi
|
fi
|
||||||
|
@ -755,8 +947,8 @@ init(){
|
||||||
elif [[ "${installStatus}" = "2" ]]
|
elif [[ "${installStatus}" = "2" ]]
|
||||||
then
|
then
|
||||||
rm -rf /usr/bin/v2ray
|
rm -rf /usr/bin/v2ray
|
||||||
rm -rf /tmp/v2ray
|
rm -rf /etc/v2ray-agent/v2ray
|
||||||
rm -rf /tmp/tls
|
rm -rf /etc/v2ray-agent/tls
|
||||||
rm -rf /etc/v2ray
|
rm -rf /etc/v2ray
|
||||||
installTools
|
installTools
|
||||||
installNginx
|
installNginx
|
||||||
|
|
Loading…
Reference in New Issue