bash - Multi protocol support (#1496)

This commit is contained in:
Mammad 2024-01-01 23:39:21 +03:30 committed by MHSanaei
parent ceee1e4277
commit 31e9734414

51
x-ui.sh
View File

@ -115,7 +115,7 @@ install() {
} }
update() { update() {
confirm "This function will forcefully reinstall the latest version, and the data will not be lost. Do you want to continue?" "n" confirm "This function will forcefully reinstall the latest version, and the data will not be lost. Do you want to continue?" "y"
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
LOGE "Cancelled" LOGE "Cancelled"
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
@ -796,6 +796,33 @@ warp_cloudflare() {
esac esac
} }
multi_protocol() {
echo "This script only supports Vless and Vmess. if you use another protocols, DON'T INSTALL or get backup first! "
echo -e "${green}\t1.${plain} Install Multi Protocol Script"
echo -e "${green}\t2.${plain} Uninstall"
echo -e "${green}\t3.${plain} Start Service"
echo -e "${green}\t4.${plain} Stop Service"
echo -e "${green}\t0.${plain} Back to Main Menu"
read -p "Choose an option: " choice
case "$choice" in
0)
show_menu ;;
1)
bash <(curl -Ls https://raw.githubusercontent.com/M4mmad/3xui-multi-protocol/master/install.sh --ipv4)
;;
2)
bash <(curl -Ls https://raw.githubusercontent.com/M4mmad/3xui-multi-protocol/master/unistall.sh --ipv4)
;;
3)
systemctl start 3xui-multi-protocol
;;
4)
systemctl stop 3xui-multi-protocol
;;
*) echo "Invalid choice" ;;
esac
}
run_speedtest() { run_speedtest() {
# Check if Speedtest is already installed # Check if Speedtest is already installed
if ! command -v speedtest &> /dev/null; then if ! command -v speedtest &> /dev/null; then
@ -1080,14 +1107,15 @@ show_menu() {
${green}17.${plain} Cloudflare SSL Certificate ${green}17.${plain} Cloudflare SSL Certificate
${green}18.${plain} IP Limit Management ${green}18.${plain} IP Limit Management
${green}19.${plain} WARP Management ${green}19.${plain} WARP Management
${green}20.${plain} Multi Protocol Management
———————————————— ————————————————
${green}20.${plain} Enable BBR ${green}21.${plain} Enable BBR
${green}21.${plain} Update Geo Files ${green}22.${plain} Update Geo Files
${green}22.${plain} Active Firewall and open ports ${green}23.${plain} Active Firewall and open ports
${green}23.${plain} Speedtest by Ookla ${green}24.${plain} Speedtest by Ookla
" "
show_status show_status
echo && read -p "Please enter your selection [0-23]: " num echo && read -p "Please enter your selection [0-24]: " num
case "${num}" in case "${num}" in
0) 0)
@ -1151,19 +1179,22 @@ show_menu() {
warp_cloudflare warp_cloudflare
;; ;;
20) 20)
enable_bbr multi_protocol
;; ;;
21) 21)
update_geo enable_bbr
;; ;;
22) 22)
open_ports update_geo
;; ;;
23) 23)
open_ports
;;
24)
run_speedtest run_speedtest
;; ;;
*) *)
LOGE "Please enter the correct number [0-23]" LOGE "Please enter the correct number [0-24]"
;; ;;
esac esac
} }