Check obfs

This commit is contained in:
Whispering Wind
2024-10-09 00:30:08 +03:30
committed by GitHub
parent ab54291a25
commit a4f831c4c4

View File

@ -25,7 +25,6 @@ get_normalsub_domain_and_port() {
fi fi
} }
show_uri() { show_uri() {
if [ -f "$USERS_FILE" ]; then if [ -f "$USERS_FILE" ]; then
if systemctl is-active --quiet hysteria-server.service; then if systemctl is-active --quiet hysteria-server.service; then
@ -60,15 +59,23 @@ show_uri() {
authpassword=$(jq -r ".\"$username\".password" "$USERS_FILE") authpassword=$(jq -r ".\"$username\".password" "$USERS_FILE")
port=$(jq -r '.listen' "$CONFIG_FILE" | cut -d':' -f2) port=$(jq -r '.listen' "$CONFIG_FILE" | cut -d':' -f2)
sha256=$(jq -r '.tls.pinSHA256' "$CONFIG_FILE") sha256=$(jq -r '.tls.pinSHA256' "$CONFIG_FILE")
obfspassword=$(jq -r '.obfs.salamander.password' "$CONFIG_FILE") obfspassword=$(jq -r '.obfs.salamander.password // empty' "$CONFIG_FILE")
generate_uri() { generate_uri() {
local ip_version=$1 local ip_version=$1
local ip=$2 local ip=$2
if [ "$ip_version" -eq 4 ]; then if [ -n "$obfspassword" ]; then
echo "hy2://$username%3A$authpassword@$ip:$port?obfs=salamander&obfs-password=$obfspassword&pinSHA256=$sha256&insecure=1&sni=$SNI#$username-IPv4" if [ "$ip_version" -eq 4 ]; then
elif [ "$ip_version" -eq 6 ]; then echo "hy2://$username%3A$authpassword@$ip:$port?obfs=salamander&obfs-password=$obfspassword&pinSHA256=$sha256&insecure=1&sni=$SNI#$username-IPv4"
echo "hy2://$username%3A$authpassword@[$ip]:$port?obfs=salamander&obfs-password=$obfspassword&pinSHA256=$sha256&insecure=1&sni=$SNI#$username-IPv6" elif [ "$ip_version" -eq 6 ]; then
echo "hy2://$username%3A$authpassword@[$ip]:$port?obfs=salamander&obfs-password=$obfspassword&pinSHA256=$sha256&insecure=1&sni=$SNI#$username-IPv6"
fi
else
if [ "$ip_version" -eq 4 ]; then
echo "hy2://$username%3A$authpassword@$ip:$port?pinSHA256=$sha256&insecure=1&sni=$SNI#$username-IPv4"
elif [ "$ip_version" -eq 6 ]; then
echo "hy2://$username%3A$authpassword@[$ip]:$port?pinSHA256=$sha256&insecure=1&sni=$SNI#$username-IPv6"
fi
fi fi
} }