Skip to content

Commit 326de1d

Browse files
committed
fix dual IPv6 stack port checking
Signed-off-by: nachoparker <nacho@ownyourbits.com>
1 parent d12b30c commit 326de1d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bin/ncp-diag

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ function is_port_open()
7070
local port=$1
7171
local public_ip
7272
public_ip="$(curl -m4 -4 https://icanhazip.com 2>/dev/null)" || { echo "closed"; return 1; }
73+
if [[ "${public_ip}" == "" ]]; then
74+
public_ip="$(curl -m4 -6 https://icanhazip.com 2>/dev/null)" || { echo "closed"; return 1; }
75+
fi
7376
local tmp_file=$(mktemp)
7477
local token=$(wget -T2 -t1 -qO- --keep-session-cookies --save-cookies $tmp_file https://portchecker.co | grep -oP "_csrf\" value=\"\K.*\"")
7578

0 commit comments

Comments
 (0)