From e95d78e53519c31160f996907215dfb0f7f6d5ed Mon Sep 17 00:00:00 2001 From: Return <151555003+H-Return@users.noreply.github.com> Date: Mon, 3 Jun 2024 23:39:22 +0330 Subject: [PATCH] Outbounds --- install.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 026fd62..9d78411 100644 --- a/install.sh +++ b/install.sh @@ -66,6 +66,9 @@ if ! id -u hysteria &> /dev/null; then useradd -r -s /usr/sbin/nologin hysteria fi +# Get the default network interface +networkdef=$(ip route | grep "^default" | awk '{print $5}') + # Step 10: Customize the config.json file echo "Customizing config.json..." jq --arg port "$port" \ @@ -73,13 +76,15 @@ jq --arg port "$port" \ --arg obfspassword "$obfspassword" \ --arg authpassword "$authpassword" \ --arg UUID "$UUID" \ - '.listen = ":\($port)" | - .tls.cert = "/etc/hysteria/ca.crt" | - .tls.key = "/etc/hysteria/ca.key" | - .tls.pinSHA256 = $sha256 | - .obfs.salamander.password = $obfspassword | - .auth.password = $authpassword | - .trafficStats.secret = $UUID' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json + --arg networkdef "$networkdef" \ + '.listen = ":\($port)" | + .tls.cert = "/etc/hysteria/ca.crt" | + .tls.key = "/etc/hysteria/ca.key" | + .tls.pinSHA256 = $sha256 | + .obfs.salamander.password = $obfspassword | + .auth.password = $authpassword | + .trafficStats.secret = $UUID | + .outbounds[0].direct.bindDevice = $networkdef' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json # Step 11: Modify the systemd service file to use config.json echo "Updating hysteria-server.service to use config.json..."