Update serv00keep.sh

This commit is contained in:
甬哥侃侃侃ygkkk
2025-03-01 11:32:21 +08:00
committed by GitHub
parent 4e53852695
commit caa1ca4aad
+20 -14
View File
@@ -255,14 +255,9 @@ echo "${public_key}" > public_key.txt
fi fi
private_key=$(<private_key.txt) private_key=$(<private_key.txt)
public_key=$(<public_key.txt) public_key=$(<public_key.txt)
openssl ecparam -genkey -name prime256v1 -out "private.key" openssl ecparam -genkey -name prime256v1 -out "private.key"
openssl req -new -x509 -days 3650 -key "private.key" -out "cert.pem" -subj "/CN=$USERNAME.serv00.net" openssl req -new -x509 -days 3650 -key "private.key" -out "cert.pem" -subj "/CN=$USERNAME.serv00.net"
nb=$(hostname | cut -d '.' -f 1 | tr -d 's') nb=$(hostname | cut -d '.' -f 1 | tr -d 's')
if [[ "$nb" =~ (14|15|16) ]]; then
ytb='"jnn-pa.googleapis.com",'
fi
hy1p=$(sed -n '1p' hy2ip.txt) hy1p=$(sed -n '1p' hy2ip.txt)
hy2p=$(sed -n '2p' hy2ip.txt) hy2p=$(sed -n '2p' hy2ip.txt)
hy3p=$(sed -n '3p' hy2ip.txt) hy3p=$(sed -n '3p' hy2ip.txt)
@@ -275,7 +270,7 @@ hy3p=$(sed -n '3p' hy2ip.txt)
}, },
"inbounds": [ "inbounds": [
{ {
"tag": "hysteria-in", "tag": "hysteria-in1",
"type": "hysteria2", "type": "hysteria2",
"listen": "$hy1p", "listen": "$hy1p",
"listen_port": $hy2_port, "listen_port": $hy2_port,
@@ -296,7 +291,7 @@ hy3p=$(sed -n '3p' hy2ip.txt)
} }
}, },
{ {
"tag": "hysteria-in", "tag": "hysteria-in2",
"type": "hysteria2", "type": "hysteria2",
"listen": "$hy2p", "listen": "$hy2p",
"listen_port": $hy2_port, "listen_port": $hy2_port,
@@ -317,7 +312,7 @@ hy3p=$(sed -n '3p' hy2ip.txt)
} }
}, },
{ {
"tag": "hysteria-in", "tag": "hysteria-in3",
"type": "hysteria2", "type": "hysteria2",
"listen": "$hy3p", "listen": "$hy3p",
"listen_port": $hy2_port, "listen_port": $hy2_port,
@@ -381,7 +376,7 @@ hy3p=$(sed -n '3p' hy2ip.txt)
} }
} }
], ],
"outbounds": [ "outbounds": [
{ {
"type": "wireguard", "type": "wireguard",
"tag": "wg", "tag": "wg",
@@ -414,16 +409,20 @@ hy3p=$(sed -n '3p' hy2ip.txt)
"download_detour": "direct" "download_detour": "direct"
} }
], ],
EOF
if [[ "$nb" =~ (14|15|16) ]]; then
cat >> config.json <<EOF
"rules": [ "rules": [
{ {
"domain": [ "domain": [
$ytb "jnn-pa.googleapis.com"
"oh.my.god"
], ],
"outbound": "wg" "outbound": "wg"
}, },
{ {
"rule_set":"google-gemini", "rule_set":[
"google-gemini"
],
"outbound": "wg" "outbound": "wg"
} }
], ],
@@ -431,6 +430,13 @@ hy3p=$(sed -n '3p' hy2ip.txt)
} }
} }
EOF EOF
else
cat >> config.json <<EOF
"final": "direct"
}
}
EOF
fi
if ! ps aux | grep '[r]un -c con' > /dev/null; then if ! ps aux | grep '[r]un -c con' > /dev/null; then
ps aux | grep '[r]un -c con' | awk '{print $2}' | xargs -r kill -9 > /dev/null 2>&1 ps aux | grep '[r]un -c con' | awk '{print $2}' | xargs -r kill -9 > /dev/null 2>&1