Check WARP installation

This commit is contained in:
Return
2024-06-11 16:49:18 +03:30
committed by GitHub
parent dda0070aa4
commit 75ea5877a1

View File

@ -250,16 +250,24 @@ install_tcp_brutal() {
# Function to install WARP and update config.json # Function to install WARP and update config.json
install_warp() { install_warp() {
# Check if wg-quick@wgcf.service is active
if systemctl is-active --quiet wg-quick@wgcf.service; then
echo "WARP is already active. Skipping installation and configuration update."
else
echo "Installing WARP..." echo "Installing WARP..."
bash <(curl -fsSL git.io/warp.sh) wgx bash <(curl -fsSL git.io/warp.sh) wgx
# Check if the config file exists
if [ -f "/etc/hysteria/config.json" ]; then if [ -f "/etc/hysteria/config.json" ]; then
# Add the outbound configuration to the config.json file
jq '.outbounds += [{"name": "warps", "type": "direct", "direct": {"mode": 4, "bindDevice": "wgcf"}}]' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json jq '.outbounds += [{"name": "warps", "type": "direct", "direct": {"mode": 4, "bindDevice": "wgcf"}}]' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
# Restart the hysteria-server service
systemctl restart hysteria-server.service >/dev/null 2>&1 systemctl restart hysteria-server.service >/dev/null 2>&1
echo "WARP installed and outbound added to config.json." echo "WARP installed and outbound added to config.json."
else else
echo "Error: Config file /etc/hysteria/config.json not found." echo "Error: Config file /etc/hysteria/config.json not found."
fi fi
fi
} }
# Function to configure WARP # Function to configure WARP