diff --git a/vpn-auto.sh b/vpn-auto.sh index b8c1dc2..047712c 100755 --- a/vpn-auto.sh +++ b/vpn-auto.sh @@ -83,15 +83,17 @@ if [ -n "$US_SERVERS" ]; then state="${server#US-}" state="${state%%#*}" + # ⚡ Bolt: Replaced regex evaluation (=~) with native bash glob matching. + # Impact: Avoids regex compilation overhead in a tight loop, speeding up server filtering. # Check against exclusions - if [[ "$state" =~ ^($EXCLUDED_STATES)$ ]]; then + if [[ "|$EXCLUDED_STATES|" == *"|$state|"* ]]; then continue fi FILTERED_SERVERS+=("$server") # Check against favorites - if [[ "$state" =~ ^($FAVORED_STATES)$ ]]; then + if [[ "|$FAVORED_STATES|" == *"|$state|"* ]]; then FAVORED_SERVERS+=("$server") fi done