Otto Suess
6 years ago
No known key found for this signature in database
GPG Key ID: F7EFC44C2C240A11
3 changed files with
8 additions and
2 deletions
-
README.md
-
config.go
-
zapconnect.go
|
|
@ -22,11 +22,12 @@ zapconnect |
|
|
|
-i, --localip Use local ip instead of public ip. |
|
|
|
-l, --localhost Use 127.0.0.1 for ip. |
|
|
|
-j, --json Display json instead of a QRCode. |
|
|
|
-o, --image Output QRCode to file. |
|
|
|
--lnddir= The base directory that contains lnd's data, logs, configuration |
|
|
|
file, etc. |
|
|
|
--configfile= Path to configuration file |
|
|
|
-b, --datadir= The directory to store lnd's data within |
|
|
|
--tlscertpath= Path to write the TLS certificate for lnd's RPC and REST services |
|
|
|
--adminmacaroonpath= Path to write the admin macaroon for lnd's RPC and REST services |
|
|
|
--adminmacaroonpath= Path to write the admin macaroon for lnd's RPC and REST services |
|
|
|
if it doesn't exist |
|
|
|
``` |
|
|
|
|
|
@ -144,6 +144,7 @@ type zapConnectConfig struct { |
|
|
|
LocalIp bool `short:"i" long:"localip" description:"Include local ip in QRCode."` |
|
|
|
Localhost bool `short:"l" long:"localhost" description:"Use 127.0.0.1 for ip."` |
|
|
|
Json bool `short:"j" long:"json" description:"Generate json instead of a QRCode."` |
|
|
|
Image bool `short:"o" long:"image" description:"Output QRCode to file."` |
|
|
|
} |
|
|
|
|
|
|
|
// config defines the configuration options for lnd.
|
|
|
|
|
|
@ -10,6 +10,7 @@ import ( |
|
|
|
"os" |
|
|
|
"encoding/pem" |
|
|
|
"github.com/glendc/go-external-ip" |
|
|
|
qrcode "github.com/skip2/go-qrcode" |
|
|
|
) |
|
|
|
|
|
|
|
type certificates struct { |
|
|
@ -38,7 +39,7 @@ func getPublicIP() string { |
|
|
|
ip, err := consensus.ExternalIP() |
|
|
|
if err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
os.Exit(1) |
|
|
|
os.Exit(1) |
|
|
|
} |
|
|
|
|
|
|
|
return ip.String() |
|
|
@ -99,6 +100,9 @@ func main() { |
|
|
|
|
|
|
|
if loadedConfig.ZapConnect.Json { |
|
|
|
fmt.Println(string(certB)) |
|
|
|
} else if loadedConfig.ZapConnect.Image { |
|
|
|
qrcode.WriteFile(string(certB), qrcode.Medium, 512, "zapconnect-qr.png") |
|
|
|
fmt.Println("Wrote QR Code to file \"zapconnect-qr.png\"") |
|
|
|
} else { |
|
|
|
obj := qrcodeTerminal.New() |
|
|
|
obj.Get(string(certB)).Print() |
|
|
|