Outbounds

This commit is contained in:
Return
2024-06-03 23:39:22 +03:30
committed by GitHub
parent 9259ca0184
commit e95d78e535

View File

@ -66,6 +66,9 @@ if ! id -u hysteria &> /dev/null; then
useradd -r -s /usr/sbin/nologin hysteria useradd -r -s /usr/sbin/nologin hysteria
fi fi
# Get the default network interface
networkdef=$(ip route | grep "^default" | awk '{print $5}')
# Step 10: Customize the config.json file # Step 10: Customize the config.json file
echo "Customizing config.json..." echo "Customizing config.json..."
jq --arg port "$port" \ jq --arg port "$port" \
@ -73,13 +76,15 @@ jq --arg port "$port" \
--arg obfspassword "$obfspassword" \ --arg obfspassword "$obfspassword" \
--arg authpassword "$authpassword" \ --arg authpassword "$authpassword" \
--arg UUID "$UUID" \ --arg UUID "$UUID" \
'.listen = ":\($port)" | --arg networkdef "$networkdef" \
.tls.cert = "/etc/hysteria/ca.crt" | '.listen = ":\($port)" |
.tls.key = "/etc/hysteria/ca.key" | .tls.cert = "/etc/hysteria/ca.crt" |
.tls.pinSHA256 = $sha256 | .tls.key = "/etc/hysteria/ca.key" |
.obfs.salamander.password = $obfspassword | .tls.pinSHA256 = $sha256 |
.auth.password = $authpassword | .obfs.salamander.password = $obfspassword |
.trafficStats.secret = $UUID' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json .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 # Step 11: Modify the systemd service file to use config.json
echo "Updating hysteria-server.service to use config.json..." echo "Updating hysteria-server.service to use config.json..."