Fetching IPs from ip.gs
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
source /etc/hysteria/core/scripts/path.sh
|
||||||
|
|
||||||
# Function to define colors
|
# Function to define colors
|
||||||
define_colors() {
|
define_colors() {
|
||||||
@ -54,8 +55,8 @@ check_version() {
|
|||||||
|
|
||||||
|
|
||||||
load_hysteria2_env() {
|
load_hysteria2_env() {
|
||||||
if [ -f /etc/hysteria/.configs.env ]; then
|
if [ -f "$CONFIG_ENV" ]; then
|
||||||
export $(grep -v '^#' /etc/hysteria/.configs.env | xargs)
|
export $(grep -v '^#' "$CONFIG_ENV" | xargs)
|
||||||
else
|
else
|
||||||
echo "Error: configs.env file not found. Using default SNI 'bts.com'."
|
echo "Error: configs.env file not found. Using default SNI 'bts.com'."
|
||||||
SNI="bts.com"
|
SNI="bts.com"
|
||||||
@ -63,18 +64,19 @@ load_hysteria2_env() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
load_hysteria2_ips() {
|
load_hysteria2_ips() {
|
||||||
if [ -f /etc/hysteria/.configs.env ]; then
|
|
||||||
export $(grep -v '^#' /etc/hysteria/.configs.env | xargs)
|
if [ -f "$CONFIG_ENV" ]; then
|
||||||
|
export $(grep -v '^#' "$CONFIG_ENV" | xargs)
|
||||||
|
|
||||||
if [[ -z "$IP4" || -z "$IP6" ]]; then
|
if [[ -z "$IP4" || -z "$IP6" ]]; then
|
||||||
echo "Warning: IP4 or IP6 is not set in configs.env. Defaulting to empty values."
|
echo "Warning: IP4 or IP6 is not set in configs.env. Fetching from ip.gs..."
|
||||||
IP4=""
|
IP4=$(curl -s -4 ip.gs)
|
||||||
IP6=""
|
IP6=$(curl -s -6 ip.gs)
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Error: configs.env file not found. Using default empty IP values."
|
echo "Error: configs.env file not found. Fetching IPs from ip.gs..."
|
||||||
IP4=""
|
IP4=$(curl -s -4 ip.gs)
|
||||||
IP6=""
|
IP6=$(curl -s -6 ip.gs)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user