Browse Source

added option to output QRCode as a file

make_cert_optional
videah 6 years ago
parent
commit
eecce20971
  1. 1
      README.md
  2. 1
      config.go
  3. 4
      zapconnect.go

1
README.md

@ -22,6 +22,7 @@ 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

1
config.go

@ -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.

4
zapconnect.go

@ -10,6 +10,7 @@ import (
"os"
"encoding/pem"
"github.com/glendc/go-external-ip"
qrcode "github.com/skip2/go-qrcode"
)
type certificates struct {
@ -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("Outputed QRCode to file \"zapconnect-qr.png\"")
} else {
obj := qrcodeTerminal.New()
obj.Get(string(certB)).Print()

Loading…
Cancel
Save