mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-02 17:08:28 +02:00
1973 lndconnect refactor & zeus tor by default (#2100)
This commit is contained in:
parent
e48a7f32a6
commit
47f3455704
@ -726,12 +726,6 @@ fi
|
||||
# *** FATPACK *** (can be activated by parameter - see details at start of script)
|
||||
if [ "${fatpack}" == "true" ]; then
|
||||
echo "*** FATPACK ***"
|
||||
echo "* Adding GO Framework ..."
|
||||
sudo /home/admin/config.scripts/bonus.go.sh on
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "FATPACK FAILED"
|
||||
exit 1
|
||||
fi
|
||||
echo "* Adding nodeJS Framework ..."
|
||||
sudo /home/admin/config.scripts/bonus.nodejs.sh on
|
||||
if [ "$?" != "0" ]; then
|
||||
|
@ -175,36 +175,6 @@ case $CHOICE in
|
||||
/home/admin/config.scripts/bonus.sphinxrelay.sh menu
|
||||
exit 1;
|
||||
;;
|
||||
SHANGO_IOS)
|
||||
appstoreLink="https://testflight.apple.com/join/WwCjFnS8"
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
|
||||
whiptail --title "Install Testflight and Shango on your iOS device" \
|
||||
--yes-button "continue" \
|
||||
--no-button "link as QR code" \
|
||||
--yesno "At the moment this app is in public beta testing:\n\n${appstoreLink}\n\nJoin testing and follow ALL instructions.\n\nWhen installed and started -> continue" 10 60
|
||||
if [ $? -eq 1 ]; then
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
checkIP2TOR LND-GRPC-API
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh shango-ios ${connect}
|
||||
exit 1;
|
||||
;;
|
||||
SHANGO_ANDROID)
|
||||
appstoreLink="https://play.google.com/store/apps/details?id=com.shango"
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
|
||||
whiptail --title "Install Shango on your Android Phone" \
|
||||
--yes-button "continue" \
|
||||
--no-button "link as QR code" \
|
||||
--yesno "At the moment this app is in public beta testing:\n\n${appstoreLink}\n\nEasiest way to install scan QR code on LCD with phone.\n\nWhen installed and started -> continue" 10 60
|
||||
if [ $? -eq 1 ]; then
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
checkIP2TOR LND-GRPC-API
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh shango-android ${connect}
|
||||
exit 1;
|
||||
;;
|
||||
ZAP_IOS)
|
||||
appstoreLink="https://apps.apple.com/us/app/zap-bitcoin-lightning-wallet/id1406311960"
|
||||
#/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
|
||||
@ -300,8 +270,7 @@ Please go to MAINMENU > SERVICES and activate KEYSEND first.
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${appstoreLink}
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
checkIP2TOR LND-REST-API
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zeus-ios ${connect}
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zeus-ios tor
|
||||
exit 1;
|
||||
;;
|
||||
ZEUS_ANDROID)
|
||||
@ -320,11 +289,7 @@ Or scan the qr code on the LCD with your mobile phone.
|
||||
" 11 70
|
||||
fi
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
checkIP2TOR LND-REST-API
|
||||
if [ ${#ip2tor} -eq 0 ]; then
|
||||
choose_IP_or_TOR
|
||||
fi
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zeus-android ${connect}
|
||||
/home/admin/config.scripts/bonus.lndconnect.sh zeus-android tor
|
||||
exit 1;
|
||||
;;
|
||||
FULLY_NODED)
|
||||
|
@ -11,7 +11,7 @@ fi
|
||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# set version, check: https://github.com/golang/go/releases
|
||||
goVersion="1.13.3"
|
||||
goVersion="1.16.2"
|
||||
|
||||
# get cpu architecture
|
||||
isARM=$(uname -m | grep -c 'arm')
|
||||
|
@ -8,6 +8,9 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure commandline tool is available
|
||||
sudo apt-get install -y qrencode 1>/dev/null 2>/dev/null
|
||||
|
||||
# load raspiblitz config data
|
||||
source /home/admin/raspiblitz.info
|
||||
source /mnt/hdd/raspiblitz.conf
|
||||
@ -23,41 +26,6 @@ if [ "$2" == "tor" ]; then
|
||||
forceTOR=1
|
||||
fi
|
||||
|
||||
#### MAKE SURE LNDCONNECT IS INSTALLED
|
||||
|
||||
# check if it is installed
|
||||
# https://github.com/rootzoll/lndconnect
|
||||
# using own fork of lndconnet because of this commit to fix for better QR code:
|
||||
commit=82d7103bb8c8dd3c8ae8de89e3bc061eef82bb8f
|
||||
isInstalled=$(lndconnect -h 2>/dev/null | grep "nocert" -c)
|
||||
if [ $isInstalled -eq 0 ] || [ "$1" == "update" ]; then
|
||||
echo "# Installing lndconnect.."
|
||||
# make sure Go is installed
|
||||
/home/admin/config.scripts/bonus.go.sh on
|
||||
# get Go vars
|
||||
source /etc/profile
|
||||
# Install latest lndconnect from source:
|
||||
go get -d github.com/rootzoll/lndconnect
|
||||
cd $GOPATH/src/github.com/rootzoll/lndconnect
|
||||
git checkout $commit
|
||||
make
|
||||
else
|
||||
echo "# lndconnect is already installed"
|
||||
fi
|
||||
|
||||
# recheck if install worked
|
||||
isInstalled=$(lndconnect -h 2>/dev/null | grep "nocert" -c)
|
||||
if [ $isInstalled -eq 0 ]; then
|
||||
echo ""
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
echo "FAIL: Was not able to install/build lndconnect"
|
||||
echo "Retry later or report to developers with logs above."
|
||||
lndconnect -h
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
read key
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#### CHECK IF IP2TOR BRIDGES ARE AVAILABLE
|
||||
ip2torREST_IP=""
|
||||
ip2torREST_PORT=""
|
||||
@ -79,19 +47,17 @@ fi
|
||||
#### ADAPT PARAMETERS BASED TARGETWALLET
|
||||
|
||||
# defaults
|
||||
connector=""
|
||||
host=""
|
||||
port=""
|
||||
extraparameter=""
|
||||
addcert=1
|
||||
supportsTOR=0
|
||||
usingIP2TOR=""
|
||||
|
||||
if [ "${targetWallet}" = "zap-ios" ]; then
|
||||
connector="lndconnect"
|
||||
if [ ${forceTOR} -eq 1 ]; then
|
||||
# when ZAP runs on TOR it uses REST
|
||||
port="8080"
|
||||
extraparameter="--nocert"
|
||||
addcert=0
|
||||
else
|
||||
# normal ZAP uses gRPC ports
|
||||
port="10009"
|
||||
@ -100,13 +66,11 @@ if [ "${targetWallet}" = "zap-ios" ]; then
|
||||
# when IP2TOR bridge is available - force using that
|
||||
usingIP2TOR="LND-GRPC-API"
|
||||
forceTOR=0
|
||||
extraparameter=""
|
||||
host="${ip2torGRPC_IP}"
|
||||
port="${ip2torGRPC_PORT}"
|
||||
fi
|
||||
|
||||
elif [ "${targetWallet}" = "zap-android" ]; then
|
||||
connector="lndconnect"
|
||||
if [ ${forceTOR} -eq 1 ]; then
|
||||
# when ZAP runs on TOR it uses gRPC
|
||||
port="10009"
|
||||
@ -117,41 +81,24 @@ elif [ "${targetWallet}" = "zap-android" ]; then
|
||||
if [ ${#ip2torGRPC_IP} -gt 0 ]; then
|
||||
# when IP2TOR bridge is available - force using that
|
||||
usingIP2TOR="LND-GRPC-API"
|
||||
forceTOR=0
|
||||
extraparameter=""
|
||||
forceTOR=1
|
||||
host="${ip2torGRPC_IP}"
|
||||
port="${ip2torGRPC_PORT}"
|
||||
fi
|
||||
|
||||
elif [ "${targetWallet}" = "zeus-ios" ]; then
|
||||
|
||||
connector="lndconnect"
|
||||
port="8080"
|
||||
if [ ${#ip2torREST_IP} -gt 0 ]; then
|
||||
# when IP2TOR bridge is available - force using that
|
||||
port="8080"
|
||||
usingIP2TOR="LND-REST-API"
|
||||
forceTOR=0
|
||||
extraparameter=""
|
||||
host="${ip2torREST_IP}"
|
||||
port="${ip2torREST_PORT}"
|
||||
fi
|
||||
if [ ${forceTOR} -eq 1 ]; then
|
||||
echo "error='no tor support'"
|
||||
exit 1
|
||||
fi
|
||||
forceTOR=1
|
||||
host=$(sudo cat /mnt/hdd/tor/lndrest8080/hostname)
|
||||
|
||||
elif [ "${targetWallet}" = "zeus-android" ]; then
|
||||
|
||||
connector="lndconnect"
|
||||
port="8080"
|
||||
if [ ${#ip2torREST_IP} -gt 0 ]; then
|
||||
# when IP2TOR bridge is available - force using that
|
||||
port="8080"
|
||||
usingIP2TOR="LND-REST-API"
|
||||
forceTOR=0
|
||||
extraparameter=""
|
||||
host="${ip2torREST_IP}"
|
||||
port="${ip2torREST_PORT}"
|
||||
fi
|
||||
forceTOR=1
|
||||
host=$(sudo cat /mnt/hdd/tor/lndrest8080/hostname)
|
||||
|
||||
elif [ "${targetWallet}" = "sendmany-android" ]; then
|
||||
|
||||
@ -159,8 +106,8 @@ elif [ "${targetWallet}" = "sendmany-android" ]; then
|
||||
if [ ${forceTOR} -eq 1 ]; then
|
||||
# echo "error='no tor support'"
|
||||
# exit 1
|
||||
#port="8080"
|
||||
#extraparameter="--nocert"
|
||||
# port="8080"
|
||||
# addcert=0
|
||||
# deactivate TOR for now, because address is too long QR code is too big to be scanned by
|
||||
# app and so just make it possible to use local.
|
||||
forceTOR=0
|
||||
@ -170,45 +117,10 @@ elif [ "${targetWallet}" = "sendmany-android" ]; then
|
||||
# when IP2TOR bridge is available - force using that
|
||||
usingIP2TOR="LND-GRPC-API"
|
||||
forceTOR=0
|
||||
extraparameter=""
|
||||
host="${ip2torGRPC_IP}"
|
||||
port="${ip2torGRPC_PORT}"
|
||||
fi
|
||||
|
||||
elif [ "${targetWallet}" = "shango-ios" ]; then
|
||||
|
||||
connector="shango"
|
||||
port="10009"
|
||||
if [ ${#ip2torGRPC_IP} -gt 0 ]; then
|
||||
# when IP2TOR bridge is available - force using that
|
||||
usingIP2TOR="LND-GRPC-API"
|
||||
forceTOR=0
|
||||
extraparameter=""
|
||||
host="${ip2torGRPC_IP}"
|
||||
port="${ip2torGRPC_PORT}"
|
||||
fi
|
||||
if [ ${forceTOR} -eq 1 ]; then
|
||||
echo "error='no tor support'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elif [ "${targetWallet}" = "shango-android" ]; then
|
||||
|
||||
connector="shango"
|
||||
port="10009"
|
||||
if [ ${#ip2torGRPC_IP} -gt 0 ]; then
|
||||
# when IP2TOR bridge is available - force using that
|
||||
usingIP2TOR="LND-GRPC-API"
|
||||
forceTOR=0
|
||||
extraparameter=""
|
||||
host="${ip2torGRPC_IP}"
|
||||
port="${ip2torGRPC_PORT}"
|
||||
fi
|
||||
if [ ${forceTOR} -eq 1 ]; then
|
||||
echo "error='no tor support'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo "error='unknown target wallet'"
|
||||
exit 1
|
||||
@ -256,51 +168,35 @@ if [ ${#sshtunnel} -gt 0 ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# special case: for Zeus android over TOR
|
||||
hostscreen="${host}"
|
||||
if [ "${targetWallet}" = "zeus-android" ] && [ ${forceTOR} -eq 1 ]; then
|
||||
# show TORv2 address on LCD (to make QR code smaller and scannable by Zeus)
|
||||
host=$(sudo cat /mnt/hdd/tor/lndrest8080fallback/hostname)
|
||||
# show TORv3 address on Screen
|
||||
hostscreen=$(sudo cat /mnt/hdd/tor/lndrest8080/hostname)
|
||||
fi
|
||||
|
||||
#### RUN LNDCONNECT
|
||||
|
||||
imagePath=""
|
||||
datastring=""
|
||||
# generate data parts
|
||||
macaroon=$(sudo base64 /mnt/hdd/app-data/lnd/data/chain/${network}/${chain}net/admin.macaroon | tr -d '=' | tr '/+' '_-' | tr -d '\n')
|
||||
cert=$(sudo grep -v 'CERTIFICATE' /mnt/hdd/lnd/tls.cert | tr -d '=' | tr '/+' '_-' | tr -d '\n')
|
||||
|
||||
if [ "${connector}" == "lndconnect" ]; then
|
||||
# generate URI parameters
|
||||
macaroonParameter="?macaroon=${macaroon}"
|
||||
certParameter="&cert=${cert}"
|
||||
|
||||
# get Go vars
|
||||
source /etc/profile
|
||||
|
||||
# write qr code data to an image
|
||||
cd /home/admin
|
||||
lndconnect --host=${host} --port=${port} --image ${extraparameter}
|
||||
|
||||
# display qr code image on LCD
|
||||
/home/admin/config.scripts/blitz.lcd.sh image /home/admin/lndconnect-qr.png
|
||||
|
||||
elif [ "${connector}" == "shango" ]; then
|
||||
|
||||
# write qr code data to text file
|
||||
datastring=$(echo -e "${host}:${port},\n$(xxd -p -c2000 /home/admin/.lnd/data/chain/${network}/${chain}net/admin.macaroon),\n$(openssl x509 -sha256 -fingerprint -in /home/admin/.lnd/tls.cert -noout)")
|
||||
|
||||
# display qr code on LCD
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr "${datastring}"
|
||||
|
||||
else
|
||||
echo "error='unknown connector'"
|
||||
exit 1
|
||||
# mute cert parameter (optional)
|
||||
if [ ${addcert} -eq 0 ]; then
|
||||
certParameter=""
|
||||
fi
|
||||
|
||||
# build lndconnect
|
||||
# see spec here: https://github.com/LN-Zap/lndconnect/blob/master/lnd_connect_uri.md
|
||||
lndconnect="lndconnect://${host}:${port}${macaroonParameter}${certParameter}"
|
||||
|
||||
# display qr code image on LCD
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr "${lndconnect}"
|
||||
|
||||
# show pairing info dialog
|
||||
msg=""
|
||||
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
|
||||
if [ ${#usingIP2TOR} -gt 0 ]; then
|
||||
if [ ${#usingIP2TOR} -gt 0 ] && [ ${forceTOR} -eq 0 ]; then
|
||||
msg="Your IP2TOR bridge '${usingIP2TOR}' is used for this connection.\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 <Console QRcode> to see it in this window."
|
||||
@ -311,19 +207,16 @@ whiptail --backtitle "Connecting Mobile Wallet" \
|
||||
--yesno "${msg}" 18 65
|
||||
if [ $? -eq 1 ]; then
|
||||
# backup - show QR code on screen (not LCD)
|
||||
if [ "${connector}" == "lndconnect" ]; then
|
||||
echo "lndconnect --host=${hostscreen} --port=${port} ${extraparameter}"
|
||||
lndconnect --host=${hostscreen} --port=${port} ${extraparameter}
|
||||
echo "Press ENTER when finished."
|
||||
read key
|
||||
elif [ "${connector}" == "shango" ]; then
|
||||
/home/admin/config.scripts/blitz.lcd.sh qr-console ${datastring}
|
||||
fi
|
||||
echo "##############"
|
||||
echo "qrencode -o - -t ANSIUTF8 -m2 "${lndconnect}""
|
||||
echo "##############"
|
||||
qrencode -o - -t ANSIUTF8 -m2 "${lndconnect}"
|
||||
echo "Press ENTER when finished."
|
||||
read key
|
||||
fi
|
||||
|
||||
# clean up
|
||||
/home/admin/config.scripts/blitz.lcd.sh hide
|
||||
shred -u ${imagePath} 2> /dev/null
|
||||
|
||||
echo "------------------------------"
|
||||
echo "If the connection was not working:"
|
||||
|
Loading…
x
Reference in New Issue
Block a user