feat(脚本): 增加vless

pull/534/merge
mack-a 2020-08-10 17:17:14 +08:00
parent 6ea63aa926
commit 8acc9bbeab
1 changed files with 78 additions and 1 deletions

View File

@ -292,8 +292,39 @@ installTLS(){
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
# todo
cat << EOF > /etc/nginx/conf.d/alone.conf
server {
listen 443 ssl;
server_name $1;
root /usr/share/nginx/html;
ssl_certificate /etc/nginx/v2ray-agent-https/$1.crt;ssl_certificate_key /etc/nginx/v2ray-agent-https/$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;
}
location /vless {
proxy_redirect off;
proxy_pass http://127.0.0.1:31298;
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;
}
}
EOF
echo "server {listen 443 ssl;server_name $1;root /usr/share/nginx/html;ssl_certificate /etc/nginx/v2ray-agent-https/$1.crt;ssl_certificate_key /etc/nginx/v2ray-agent-https/$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/conf.d/alone.conf
# 自定义路径 # 自定义路径
# todo 随机路径 # todo 随机路径
@ -551,6 +582,29 @@ initV2RayConfig(){
} }
} }
}, },
{
"port":31298,
"protocol":"vless",
"settings":{
"clients":[
{
"id":"c95f22d4-5f7c-6248-8524-2bc830908ff9",
"alterId":64,
"level":1,
"email":"test@v2ray.com"
}
],
"decryption": "none",
"fallback": {},
"fallback_h2": {}
},
"streamSettings":{
"network":"ws",
"wsSettings":{
"path":"/vld"
}
}
},
{ {
"port":31294, "port":31294,
"protocol":"vmess", "protocol":"vmess",
@ -664,6 +718,29 @@ EOF
"path":"/alone" "path":"/alone"
} }
} }
},
{
"port":31298,
"protocol":"vless",
"settings":{
"clients":[
{
"id":"c95f22d4-5f7c-6248-8524-2bc830908ff9",
"alterId":64,
"level":1,
"email":"test@v2ray.com"
}
],
"decryption": "none",
"fallback": {},
"fallback_h2": {}
},
"streamSettings":{
"network":"ws",
"wsSettings":{
"path":"/vld"
}
}
} }
], ],
"outbounds":[ "outbounds":[