xray-0.0.3

[new] 适配 vless 链接规范
https://github.com/XTLS/Xray-core/issues/91
pull/318/head
wulabing 2021-02-15 12:45:42 +08:00
parent 353ab59028
commit 393536f3a9
No known key found for this signature in database
GPG Key ID: 213391AFDF73AE00
1 changed files with 53 additions and 20 deletions

View File

@ -16,7 +16,7 @@ OK="${Green}[OK]${Font}"
ERROR="${Red}[ERROR]${Font}" ERROR="${Red}[ERROR]${Font}"
# 变量 # 变量
shell_version="0.0.2" shell_version="0.0.3"
github_branch="xray" github_branch="xray"
version_cmp="/tmp/version_cmp.tmp" version_cmp="/tmp/version_cmp.tmp"
xray_conf_dir="/usr/local/etc/xray" xray_conf_dir="/usr/local/etc/xray"
@ -24,6 +24,7 @@ website_dir="/www/xray_web/"
xray_access_log="/var/log/xray/access.log" xray_access_log="/var/log/xray/access.log"
xray_error_log="/var/log/xray/error.log" xray_error_log="/var/log/xray/error.log"
cert_dir="/usr/local/etc/xray" cert_dir="/usr/local/etc/xray"
domain_tmp_dir="/usr/local/etc/xray"
VERSION=$(echo "${VERSION}" | awk -F "[()]" '{print $2}') VERSION=$(echo "${VERSION}" | awk -F "[()]" '{print $2}')
@ -125,7 +126,6 @@ function dependency_install() {
${INS} openssl openssl-devel ${INS} openssl openssl-devel
judge "安装 openssl" judge "安装 openssl"
# Nginx 后置 无需编译 不再需要 # Nginx 后置 无需编译 不再需要
# if [[ "${ID}" == "centos" ]]; then # if [[ "${ID}" == "centos" ]]; then
# yum -y groupinstall "Development tools" # yum -y groupinstall "Development tools"
@ -268,6 +268,10 @@ function xray_install() {
print_ok "安装 xray" print_ok "安装 xray"
curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh | bash -s -- install curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh | bash -s -- install
judge "xray 安装" judge "xray 安装"
# 用于生成 xray 的导入链接
echo $domain > $domain_tmp_dir/domain
judge "域名记录"
} }
function ssl_install() { function ssl_install() {
@ -355,8 +359,29 @@ function xray_uninstall() {
print_ok "卸载完成" print_ok "卸载完成"
exit 0 exit 0
} }
function restart_all() {
systemctl restart nginx
judge "Nginx 启动"
systemctl restart xray
judge "xray 启动"
}
function vless_xtls-rprx-direct_link() {
UUID=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].id | tr -d '"')
PORT=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].port)
FLOW=$(cat ${xray_conf_dir}/config.json | jq .inbounds[0].settings.clients[0].flow | tr -d '"')
DOMAIN=$(cat ${domain_tmp_dir}/domain)
print_ok "URL 链接"
print_ok "vless://$UUID@$DOMAIN:$PORT?security=xtls&flow=$FLOW#wulabing-$DOMAIN"
print_ok "URL 二维码 (请在浏览器中访问)"
print_ok "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless://$UUID@$DOMAIN:$PORT?security=xtls%26flow=$FLOW%23wulabing-$DOMAIN"
}
function basic_information() { function basic_information() {
print_ok "vless+tcp+xtls+nginx 安装成功" print_ok "vless+tcp+xtls+nginx 安装成功"
vless_xtls-rprx-direct_link
} }
function show_access_log() { function show_access_log() {
@ -392,6 +417,7 @@ function install_xray() {
generate_certificate generate_certificate
ssl_judge_and_install ssl_judge_and_install
# xray_qr_config # xray_qr_config
restart_all
basic_information basic_information
} }
@ -410,6 +436,7 @@ menu() {
echo -e "—————————————— 查看信息 ——————————————" echo -e "—————————————— 查看信息 ——————————————"
echo -e "${Green}21.${Font} 查看 实时访问日志" echo -e "${Green}21.${Font} 查看 实时访问日志"
echo -e "${Green}22.${Font} 查看 实时错误日志" echo -e "${Green}22.${Font} 查看 实时错误日志"
echo -e "${Green}23.${Font} 查看 xray 配置链接"
# echo -e "${Green}23.${Font} 查看 V2Ray 配置信息" # echo -e "${Green}23.${Font} 查看 V2Ray 配置信息"
echo -e "—————————————— 其他选项 ——————————————" echo -e "—————————————— 其他选项 ——————————————"
echo -e "${Green}31.${Font} 安装 4合1 bbr 锐速安装脚本" echo -e "${Green}31.${Font} 安装 4合1 bbr 锐速安装脚本"
@ -425,10 +452,13 @@ menu() {
install_xray install_xray
;; ;;
11) 11)
read -rp "请输入UUID:" UUID
modify_UUID modify_UUID
restart_all
;; ;;
13) 13)
modify_tls_version modify_tls_version
restart_all
;; ;;
21) 21)
xray_access_log xray_access_log
@ -436,6 +466,9 @@ menu() {
22) 22)
xray_error_log xray_error_log
;; ;;
23)
vless_xtls-rprx-direct_link
;;
31) 31)
bbr_boost_sh bbr_boost_sh
;; ;;