mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-04-17 13:05:57 +00:00
Fix LibreSpeed and fix DNS changer
This commit is contained in:
parent
4b5f5db4ed
commit
af39f42b7e
1 changed files with 38 additions and 10 deletions
48
x-ui.sh
48
x-ui.sh
|
|
@ -1673,15 +1673,29 @@ run_speedtest() {
|
||||||
|
|
||||||
run_librespeed() {
|
run_librespeed() {
|
||||||
|
|
||||||
if command -v librespeed-cli &>/dev/null; then
|
echo -e "${yellow}What do you want to do?\n1) Use\n2) Install/Update\n3) Delete"
|
||||||
librespeed-cli
|
read -p ": " action
|
||||||
else
|
|
||||||
#Intalling LibreSpeed
|
if [ "$action" = 1 ]; then
|
||||||
echo -e "${yellow} Installing LibreSpeed..."
|
if command -v librespeed-cli &>/dev/null; then
|
||||||
|
librespeed-cli
|
||||||
|
else
|
||||||
|
echo -e "${red}LibreSpeed is not installed!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "$action" = 2 ]; then
|
||||||
|
echo -e "${yellow} Installing\Updating LibreSpeed..."
|
||||||
|
#Uninstall old version, or actual version
|
||||||
|
rm -f librespeed-cli_*_linux_amd64.tar.gz && rm -rf /usr/bin/librespeed-cli
|
||||||
VERSION=$(curl -s "https://api.github.com/repos/librespeed/speedtest-cli/releases/latest"| grep '"tag_name":' | sed -E 's/.*"v?([^"]+)".*/\1/')
|
VERSION=$(curl -s "https://api.github.com/repos/librespeed/speedtest-cli/releases/latest"| grep '"tag_name":' | sed -E 's/.*"v?([^"]+)".*/\1/')
|
||||||
wget https://github.com/librespeed/speedtest-cli/releases/download/v${VERSION}/librespeed-cli_${VERSION}_linux_amd64.tar.gz
|
wget https://github.com/librespeed/speedtest-cli/releases/download/v${VERSION}/librespeed-cli_${VERSION}_linux_amd64.tar.gz
|
||||||
tar -xzvf librespeed-cli_${VERSION}_linux_amd64.tar.gz && mv librespeed-cli /usr/bin
|
tar -xzvf librespeed-cli_${VERSION}_linux_amd64.tar.gz && mv librespeed-cli /usr/bin
|
||||||
|
echo -e "${green}Starting libreSpeed... (Delete old archive)"
|
||||||
librespeed-cli
|
librespeed-cli
|
||||||
|
elif [ "$action" = 3 ]; then
|
||||||
|
#Uninstall LibreSpeed
|
||||||
|
rm -f librespeed-cli_*_linux_amd64.tar.gz && rm -rf /usr/bin/librespeed-cli
|
||||||
|
echo -e "${green}LibreSpeed was deleted!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1891,14 +1905,28 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
change_dns() {
|
change_dns() {
|
||||||
echo -e "${yellow}${plain}Changing DNS resolver"
|
echo -e "${yellow}Changing DNS resolver"
|
||||||
echo -e "${plain}Enter resolver (default: 9.9.9.9): "
|
echo -e "${plain}Enter resolver (default: 9.9.9.9 for IPv4 or 2620:fe::fe for IPv6): "
|
||||||
read resolver
|
read resolver
|
||||||
|
|
||||||
if [ -n "$resolver" ]; then
|
IPv6_on=$(cat /proc/sys/net/ipv6/conf/all/disable_ipv6)
|
||||||
echo "nameserver $resolver" > /etc/resolv.conf
|
echo $IPv6_on
|
||||||
|
|
||||||
|
if [ "$IPv6_on" = 0 ]; then
|
||||||
|
echo -e "${green}Your server using IPv6!"
|
||||||
|
if [ -n "$resolver" ]; then
|
||||||
|
echo "nameserver $resolver" > /etc/resolv.conf
|
||||||
|
else
|
||||||
|
echo "nameserver 9.9.9.9" > /etc/resolv.conf
|
||||||
|
echo "nameserver 2620:fe::fe" > /etc/resolv.conf
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "nameserver 9.9.9.9" > /etc/resolv.conf
|
echo -e "${green}IPv6 is disabled!"
|
||||||
|
if [ -n "$resolver" ]; then
|
||||||
|
echo "nameserver $resolver" > /etc/resolv.conf
|
||||||
|
else
|
||||||
|
echo "nameserver 9.9.9.9" > /etc/resolv.conf
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo -e "${green}${plain}Done!"
|
echo -e "${green}${plain}Done!"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue