Browse Source

Merge pull request #131 from piezzo/get_public_ip_from_cli

Get public ip from cli (fixes #100)
#146
Christian Rotzoll 6 years ago
committed by GitHub
parent
commit
bca4dbfae0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      home.admin/00infoBlitz.sh

22
home.admin/00infoBlitz.sh

@ -109,24 +109,10 @@ if [ -n ${btc_path} ]; then
fi
# get IP address & port
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
public_ip=$(curl -s http://v4.ipv6-test.com/api/myip.php)
public_port=$(cat ${bitcoin_dir}/${network}.conf 2>/dev/null | grep port= | awk -F"=" '{print $2}')
if [ "${public_port}" = "" ]; then
if [ "${network}" = "litecoin" ]; then
if [ "${chain}" = "test" ]; then
public_port=19333
else
public_port=9333
fi
else
if [ "${chain}" = "test" ]; then
public_port=18333
else
public_port=8333
fi
fi
fi
public_port="$(echo ${networkInfo} | jq -r '.localaddresses [0] .port')"
# CHAIN NETWORK
public_addr="??"
@ -134,7 +120,7 @@ torInfo=""
# Version
networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version | cut -d ' ' -f6)
# TOR or IP
onionAddress=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo | grep '"address"' | cut -d '"' -f4)
onionAddress=$(echo ${networkInfo} | jq -r '.localaddresses [0] .address')
if [ ${#onionAddress} -gt 0 ]; then
# TOR address
public_addr="${onionAddress}:${public_port}"
@ -221,4 +207,4 @@ ${color_yellow}${ln_external}
if [ ${#onionAddress} -eq 0 ]; then
# one extra space line at the end if nodeaddress is not TOR
echo ""
fi
fi

Loading…
Cancel
Save