mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-20 10:12:06 +01:00
bonus.lndconnect.sh wirking with target wallets
This commit is contained in:
parent
790b1ce710
commit
e970844baa
@ -90,7 +90,7 @@ case $CHOICE in
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh RPC SHANGO
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh shango-ios
|
||||
exit 1;
|
||||
;;
|
||||
SHANGO_ANDROID)
|
||||
@ -104,7 +104,7 @@ case $CHOICE in
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh RPC SHANGO
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh shango-android
|
||||
exit 1;
|
||||
;;
|
||||
ZAP_IOS)
|
||||
@ -118,7 +118,7 @@ case $CHOICE in
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh RPC
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zap-ios
|
||||
exit 1;
|
||||
;;
|
||||
ZAP_ANDROID)
|
||||
@ -132,7 +132,7 @@ case $CHOICE in
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh RPC
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zap-android
|
||||
exit 1;
|
||||
;;
|
||||
ZEUS_IOS)
|
||||
@ -146,7 +146,7 @@ case $CHOICE in
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh REST
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zeus-ios
|
||||
exit 1;
|
||||
;;
|
||||
ZEUS_ANDROID)
|
||||
@ -160,7 +160,7 @@ case $CHOICE in
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh REST
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zeus-android
|
||||
exit 1;
|
||||
;;
|
||||
FULLY_NODED)
|
||||
|
@ -16,7 +16,7 @@ fi
|
||||
/home/admin/config.scripts/bonus.go.sh
|
||||
|
||||
# make sure lndconnect is installed
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh install
|
||||
|
||||
# get Go vars
|
||||
source /etc/profile
|
||||
|
@ -4,7 +4,7 @@
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo "# config script to connect mobile apps with lnd connect"
|
||||
echo "# will autodetect dyndns, sshtunnel or TOR"
|
||||
echo "# bonus.lndconnect.sh [REST|RPC] [?NOCERT|SHANGO]"
|
||||
echo "# bonus.lndconnect.sh [zap-ios|zap-android|zeus-ios|zeus-android|shango-ios|shango-android]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -14,11 +14,8 @@ source /mnt/hdd/raspiblitz.conf
|
||||
|
||||
#### PARAMETER
|
||||
|
||||
# defaults
|
||||
connector="lndconnect"
|
||||
servicePort="10009"
|
||||
useTOR=0
|
||||
extraparamter=""
|
||||
# 1. TARGET WALLET
|
||||
targetWallet=$1
|
||||
|
||||
# 1. REST or RPC
|
||||
# determine service port from argument
|
||||
@ -61,48 +58,110 @@ else
|
||||
echo "# lndconnect is already installed"
|
||||
fi
|
||||
|
||||
#### ADAPT PARAMETERS BASED ON RASPIBLITZ CONFIG
|
||||
#### ADAPT PARAMETERS BASED TARGETWALLET
|
||||
|
||||
# default host to local IP and port
|
||||
localIP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
host="${localIP}"
|
||||
port="${servicePort}"
|
||||
# defaults
|
||||
connector=""
|
||||
host=""
|
||||
port=""
|
||||
extraparamter=""
|
||||
supportsTOR=0
|
||||
|
||||
if [ "${targetWallet}" = "zap-ios" ]; then
|
||||
|
||||
connector="lndconnect"
|
||||
supportsTOR=0 # deactivated until fix: https://github.com/rootzoll/raspiblitz/issues/1001
|
||||
|
||||
if [ "${runBehindTor}" == "on" ] && [ ${supportsTOR} -eq 1 ]; then
|
||||
# when ZAP runs on TOR it uses REST
|
||||
port="8080"
|
||||
extraparamter="--nocert"
|
||||
else
|
||||
# normal ZAP uses gRPC ports
|
||||
port="10009"
|
||||
fi
|
||||
|
||||
elif [ "${targetWallet}" = "zap-android" ]; then
|
||||
|
||||
connector="lndconnect"
|
||||
supportsTOR=1
|
||||
if [ "${runBehindTor}" == "on" ] && [ ${supportsTOR} -eq 1 ]; then
|
||||
# when ZAP runs on TOR it uses REST
|
||||
port="8080"
|
||||
extraparamter="--nocert"
|
||||
else
|
||||
# normal ZAP uses gRPC ports
|
||||
port="10009"
|
||||
fi
|
||||
|
||||
elif [ "${targetWallet}" = "zeus-ios" ]; then
|
||||
|
||||
connector="lndconnect"
|
||||
supportsTOR=1
|
||||
port="8080"
|
||||
|
||||
elif [ "${targetWallet}" = "zeus-android" ]; then
|
||||
|
||||
connector="lndconnect"
|
||||
supportsTOR=1
|
||||
port="8080"
|
||||
|
||||
elif [ "${targetWallet}" = "shango-ios" ]; then
|
||||
|
||||
connector="shango"
|
||||
supportsTOR=0
|
||||
port="10009"
|
||||
|
||||
elif [ "${targetWallet}" = "shango-android" ]; then
|
||||
|
||||
connector="shango"
|
||||
supportsTOR=0
|
||||
port="10009"
|
||||
|
||||
else
|
||||
echo "error='unknown target wallet'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
#### ADAPT PARAMETERS BASED RASPIBLITZ CONFIG
|
||||
|
||||
# get the local IP as default host
|
||||
host=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
|
||||
# change host to dynDNS if set
|
||||
if [ ${#dynDomain} -gt 0 ]; then
|
||||
localIP=''
|
||||
host="${dynDomain}"
|
||||
echo "# port ${servicePort} forwarding from dynDomain ${host}"
|
||||
fi
|
||||
|
||||
# check if local service port is forwarded
|
||||
if [ ${#sshtunnel} -gt 0 ]; then
|
||||
isForwarded=$(echo ${sshtunnel} | grep -c "${servicePort}<")
|
||||
if [ ${isForwarded} -gt 0 ]; then
|
||||
localIP=''
|
||||
host=$(echo $sshtunnel | cut -d '@' -f2 | cut -d ' ' -f1 | cut -d ':' -f1)
|
||||
if [ "${servicePort}" == "10009" ]; 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}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# use TOR address if running on RaspiBlitz
|
||||
if [ "${runBehindTor}" == "on" ]; then
|
||||
# tunnel thru TOR if running and supported by the wallet
|
||||
if [ "${runBehindTor}" == "on" ] && [ ${supportsTOR} -eq 1 ]; then
|
||||
# depending on RPC or REST use different TOR address
|
||||
if [ "${servicePort}" == "10009" ]; then
|
||||
if [ "${port}" == "10009" ]; then
|
||||
host=$(sudo cat /mnt/hdd/tor/lndrpc10009/hostname)
|
||||
port="10009"
|
||||
elif [ "${servicePort}" == "8080" ]; then
|
||||
echo "# using TOR --> host ${host} port ${port}"
|
||||
elif [ "${port}" == "8080" ]; then
|
||||
host=$(sudo cat /mnt/hdd/tor/lndrest8080/hostname)
|
||||
port="8080"
|
||||
echo "# using TOR --> host ${host} port ${port}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# tunnel thru SSH-Reverse-Tunnel if activated for that port
|
||||
if [ ${#sshtunnel} -gt 0 ]; then
|
||||
isForwarded=$(echo ${sshtunnel} | grep -c "${port}<")
|
||||
if [ ${isForwarded} -gt 0 ]; then
|
||||
if [ "${port}" == "10009" ]; then
|
||||
host=$(echo $sshtunnel | cut -d '@' -f2 | cut -d ' ' -f1 | cut -d ':' -f1)
|
||||
port=$(echo $sshtunnel | awk '{split($0,a,"10009<"); print a[2]}' | cut -d ' ' -f1 | sed 's/[^0-9]//g')
|
||||
echo "# using ssh-tunnel --> host ${host} port ${port}"
|
||||
elif [ "${port}" == "8080" ]; then
|
||||
host=$(echo $sshtunnel | cut -d '@' -f2 | cut -d ' ' -f1 | cut -d ':' -f1)
|
||||
port=$(echo $sshtunnel | awk '{split($0,a,"8080<"); print a[2]}' | cut -d ' ' -f1 | sed 's/[^0-9]//g')
|
||||
echo "# using ssh-tunnel --> host ${host} port ${port}"
|
||||
fi
|
||||
fi
|
||||
echo "# port ${port} on host ${host}"
|
||||
fi
|
||||
|
||||
#### RUN LNDCONNECT
|
||||
@ -137,7 +196,7 @@ fi
|
||||
|
||||
# show pairing info dialog
|
||||
msg=""
|
||||
if [ ${#localIP} -gt 0 ]; then
|
||||
if [ $(echo "${host}" | grep -c '192.168') -gt 0 ]; then
|
||||
msg="Make sure you are on the same local network.\n(WLAN same as LAN - use WIFI not cell network on phone).\n\n"
|
||||
fi
|
||||
msg="You should now see the pairing QR code on the RaspiBlitz LCD.\n\n${msg}When you start the App choose to connect to your own node.\n(DIY / Remote-Node / lndconnect)\n\nClick on the 'Scan QR' button. Scan the QR on the LCD and <continue> or <show QR code> to see it in this window."
|
||||
@ -164,9 +223,9 @@ rm -f ${imagePath} 2> /dev/null
|
||||
echo "------------------------------"
|
||||
echo "If the connection was not working:"
|
||||
if [ ${#dynDomain} -gt 0 ]; then
|
||||
echo "- Make sure that your router is forwarding port ${port} to the Raspiblitz with IP ${localIP}"
|
||||
echo "- Make sure that your router is forwarding port ${port} to the Raspiblitz"
|
||||
fi
|
||||
if [ ${#localIP} -gt 0 ]; then
|
||||
if [ $(echo "${host}" | grep -c '192.168') -gt 0 ]; then
|
||||
echo "- Check that your WIFI devices can talk to the LAN devices on your router (deactivate IP isolation or guest mode)."
|
||||
fi
|
||||
echo "- try to refresh the TLS & macaroons: Main Menu 'EXPORT > 'RESET'"
|
||||
|
Loading…
Reference in New Issue
Block a user