From e19588178be61697ec284d11ff590b4bf9acee24 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Wed, 3 Apr 2019 13:07:25 +0100 Subject: [PATCH] update just local detection --- README.md | 5 ++++- home.admin/97addMobileWallet.sh | 26 ++++++++++++++++++++++---- home.admin/97addMobileWalletZap.sh | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2e704a2..a485450 100644 --- a/README.md +++ b/README.md @@ -384,12 +384,15 @@ To do so you can register at an DynamicDomain service like freedns.afraid.org an * 8333 (Bitcoin/mainnet) * 9735 (LND Node) -* 10009 (LND RPC) +* 10009 (LND RPC) +* 8080 (LND REST API) ... from your internet router to the local IP of your RaspiBlitz and then activate unter "Services" the "DynamicDNS" option. You will be asked for your dynamic domain name such like "mynode.crabdance.org" and you can also optionally set an URL that will be called regularly to update your routers IP with the dynnamic domain service. At freedns.afraid.org this URL is called "Direct URL" under the menu "Dynamic DNS" once you added one. +*NOTE: DynamicDNS just works if you can forward ports on your router and you have a temporary public IP address (your ISP is not running you behind a NAT - like on most mobile connections). Another solution to make your ports reachable from the public internet is to use reverse ssh tunneling - see FAQ on ['How to setup port-forwarding with a SSH tunnel?'](FAQ.md#how-to-setup-port-forwarding-with-a-ssh-tunnel)* + ##### Run behind TOR You can run your Bitcoin- and Lightning-Node as a TOR hidden service - replacing your IP with an .onion-address diff --git a/home.admin/97addMobileWallet.sh b/home.admin/97addMobileWallet.sh index 0d53805..71fa27f 100644 --- a/home.admin/97addMobileWallet.sh +++ b/home.admin/97addMobileWallet.sh @@ -4,19 +4,37 @@ source /home/admin/raspiblitz.info source /mnt/hdd/raspiblitz.conf +justLocal=1 + +# if dynDomain is set connect from outside is possible (no notice) +if [ ${#dynDomain} -gt 0 ]; then + justLocal=0 +fi + +# if sshtunnel to 10009/8080 then outside reach is possible (no notice) +isForwarded=$(echo ${sshtunnel} | grep -c "10009<") +if [ ${isForwarded} -gt 0 ]; then + justLocal=0 +fi +isForwarded=$(echo ${sshtunnel} | grep -c "8080<") +if [ ${isForwarded} -gt 0 ]; then + justLocal=0 +fi + # check if dynamic domain is set -if [ ${#dynDomain} -eq 0 ]; then +if [ ${justLocal} -eq 1 ]; then dialog --title " Just Local Network? " --yesno "If you want to connect with your RaspiBlitz also from outside your local network you need to -activate 'Services' -> 'DynamicDNS' FIRST. +activate 'Services' -> 'DynamicDNS' FIRST. +Or use SSH tunnel forwarding for port 10009. For more details see chapter in GitHub README -'Public Domain with DynamicDNS' +on the service 'DynamicDNS' https://github.com/rootzoll/raspiblitz Do you JUST want to connect with your mobile when your are on the same LOCAL NETWORK? -" 14 54 +" 15 54 response=$? case $response in 1) exit ;; diff --git a/home.admin/97addMobileWalletZap.sh b/home.admin/97addMobileWalletZap.sh index e8ee4b0..6d8bea2 100755 --- a/home.admin/97addMobileWalletZap.sh +++ b/home.admin/97addMobileWalletZap.sh @@ -92,7 +92,7 @@ fi # check if port 10009 is forwarded if [ ${#sshtunnel} -gt 0 ]; then - isForwarded=$(echo "${sshtunnel}" | grep -c "10009<") + isForwarded=$(echo ${sshtunnel} | grep -c "10009<") if [ ${isForwarded} -gt 0 ]; then host=$(echo $sshtunnel | cut -d '@' -f2 | cut -d ' ' -f1) port=$(echo $sshtunnel | awk '{split($0,a,"10009<"); print a[2]}' | sed 's/[^0-9]//g')