-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_region.sh
executable file
·51 lines (41 loc) · 1.31 KB
/
test_region.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
REGION_IDS=("au" "eu" "na" "as" "ap")
if [ -z "$1" ]; then
for REGION_ID in "${REGION_IDS[@]}"
do
echo "--------------------------------------------"
echo "Running test for $REGION_ID"
echo "--------------------------------------------"
./test_region.sh $REGION_ID
echo "Completed test for $REGION_ID"
echo "--------------------------------------------"
done
exit 0
else
REGION_ID=$1
fi
# Check if IP is specified
if [ -z "$2" ]; then
RESOLVED_IPS=$(dig +short $REGION_ID.hnsdoh.com)
NODE_IPS=($RESOLVED_IPS)
if [ ${#NODE_IPS[@]} -eq 0 ]; then
echo "No IP addresses resolved for $REGION_ID.hnsdoh.com. Exiting."
exit 1
fi
else
NODE_IPS=("$2")
fi
# Define the domain and host for kdig commands
TLS_HOST="$REGION_ID.hnsdoh.com"
DOH_URL="https://$REGION_ID.hnsdoh.com/dns-query"
# Loop over each IP and run the kdig commands
for NODE_IP in "${NODE_IPS[@]}"
do
echo "Running kdig commands for NODE_IP=$NODE_IP"
# Run the kdig commands
kdig +tls +tls-host=$TLS_HOST @$NODE_IP 1.wdbrn TXT +short
kdig +tls-ca +https=@$DOH_URL @$NODE_IP 2.wdbrn TXT +short
kdig @$NODE_IP 3.wdbrn TXT +short
echo "Completed kdig commands for NODE_IP=$NODE_IP"
echo "--------------------------------------------"
done