From 5b57f38d8918d1425d1ce4f0533ae1e94f51536d Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Thu, 4 Apr 2019 03:32:44 +0100 Subject: [PATCH] LND connect in REST and RPC mode --- home.admin/97addMobileWallet.sh | 6 +++--- home.admin/97addMobileWalletLNDconnect.sh | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/home.admin/97addMobileWallet.sh b/home.admin/97addMobileWallet.sh index 9fa9526..c437ef3 100755 --- a/home.admin/97addMobileWallet.sh +++ b/home.admin/97addMobileWallet.sh @@ -111,7 +111,7 @@ case $CHOICE in rm -f qr.txt /home/admin/XXdisplayQRlcd_hide.sh - ./97addMobileWalletLNDconnect.sh 10009 + ./97addMobileWalletLNDconnect.sh RPC exit 1; ;; ZEUS_IOS) @@ -130,7 +130,7 @@ case $CHOICE in rm -f qr.txt /home/admin/XXdisplayQRlcd_hide.sh - ./97addMobileWalletLNDconnect.sh 8080 + ./97addMobileWalletLNDconnect.sh REST exit 1; ;; ZEUS_ANDROID) @@ -147,7 +147,7 @@ case $CHOICE in rm -f qr.txt /home/admin/XXdisplayQRlcd_hide.sh - ./97addMobileWalletLNDconnect.sh 8080 + ./97addMobileWalletLNDconnect.sh REST exit 1; ;; esac diff --git a/home.admin/97addMobileWalletLNDconnect.sh b/home.admin/97addMobileWalletLNDconnect.sh index bc523e9..bc862fb 100755 --- a/home.admin/97addMobileWalletLNDconnect.sh +++ b/home.admin/97addMobileWalletLNDconnect.sh @@ -3,7 +3,14 @@ # get service port from argument servicePort="10009" if [ $# -gt 0 ]; then - servicePort="$1" + if [ "$1" == "RPC" ]; then + echo "running RPC mode" + servicePort="10009" + fi + if [ "$1" == "REST" ]; then + echo "running REST mode" + servicePort="8080" + fi fi # load raspiblitz config data @@ -79,7 +86,11 @@ if [ ${#sshtunnel} -gt 0 ]; then if [ ${isForwarded} -gt 0 ]; then local=0 host=$(echo $sshtunnel | cut -d '@' -f2 | cut -d ' ' -f1) - port=$(echo $sshtunnel | awk "{split($0,a,\"${servicePort}<\"); print a[2]}" | cut -d ' ' -f1 | sed 's/[^0-9]//g') + if [ "${servicePort}" == "1009" ]; then + port=$(echo $sshtunnel | awk '{split($0,a,"10009<"); print a[2]}' | cut -d ' ' -f1 | sed 's/[^0-9]//g') + elif [ "${servicePort}" == "8080" ]; then + port=$(echo $sshtunnel | awk '{split($0,a,"8080<"); print a[2]}' | cut -d ' ' -f1 | sed 's/[^0-9]//g') + fi echo "port ${servicePort} forwarding from port ${port} from server ${host}" else echo "port ${servicePort} is not part of the ssh forwarding - keep default port ${servicePort}"