Skip to content

Commit

Permalink
deploy: ff55ba1
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 20, 2023
1 parent 24f268e commit b37ee68
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion node_details
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ flkMinorUnitToFlk() {
fi
}

validateIpAddress() {
local validate="^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$"

[[ "$1" =~ $validate ]] && ping -c1 -W1 "$1" > /dev/null
}

findIp() {
for url in "ipinfo.io/ip" "api.ipify.org" "ipecho.net/plain" "ifconfig.me" "ident.me"; do
ip=$(curl -sw "\n" "$url")

if validateIpAddress "$ip"; then
echo "$ip"

return
fi
done
}

# The white space before and after is intentional
cat << "ART"
Expand Down Expand Up @@ -153,7 +171,7 @@ fi

nodePubKey=$(echo "$keys" | sed -n '1p' | cut -d : -f 2 | xargs)
consensusPubKey=$(echo "$keys" | sed -n '2p' | cut -d : -f 2 | xargs)
ipAddr=$(curl -sw '\n' ifconfig.me || curl -sw '\n' ident.me)
ipAddr=$(findIp)
hasStake=$(curl -sX POST \
"$defaultRPCUrl" \
-H 'Content-Type: application/json' \
Expand Down

0 comments on commit b37ee68

Please sign in to comment.