Browse Source
refactor: rename json parameter to url
make_cert_optional
Otto Suess
6 years ago
No known key found for this signature in database
GPG Key ID: F7EFC44C2C240A11
3 changed files with
3 additions and
9 deletions
-
README.md
-
config.go
-
lndconnect.go
|
|
@ -25,6 +25,7 @@ lndconnect |
|
|
|
-l, --localhost Use 127.0.0.1 for ip |
|
|
|
--host= Use specific host name |
|
|
|
-p, --port= Use this port (default: 10009) |
|
|
|
-j, --url Display url instead of a QRCode |
|
|
|
-o, --image Output QRCode to file |
|
|
|
--invoice Use invoice macaroon |
|
|
|
--readonly Use readonly macaroon |
|
|
@ -36,5 +37,4 @@ lndconnect |
|
|
|
--adminmacaroonpath= Path to read the admin macaroon from |
|
|
|
--readonlymacaroonpath= Path to read the read-only macaroon from |
|
|
|
--invoicemacaroonpath= Path to read the invoice-only macaroon from |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
@ -47,7 +47,7 @@ type lndConnectConfig struct { |
|
|
|
Localhost bool `short:"l" long:"localhost" description:"Use 127.0.0.1 for ip"` |
|
|
|
Host string `long:"host" description:"Use specific host name"` |
|
|
|
Port uint16 `short:"p" long:"port" description:"Use this port"` |
|
|
|
Json bool `short:"j" long:"json" description:"Generate json instead of a QRCode"` |
|
|
|
Url bool `short:"j" long:"url" description:"Display url instead of a QRCode"` |
|
|
|
Image bool `short:"o" long:"image" description:"Output QRCode to file"` |
|
|
|
Invoice bool `long:"invoice" description:"use invoice macaroon"` |
|
|
|
Readonly bool `long:"readonly" description:"use readonly macaroon"` |
|
|
|
|
|
@ -13,12 +13,6 @@ import ( |
|
|
|
"github.com/skip2/go-qrcode" |
|
|
|
) |
|
|
|
|
|
|
|
type certificates struct { |
|
|
|
Cert string `json:"c"` |
|
|
|
Macaroon string `json:"m"` |
|
|
|
Ip string `json:"ip,omitempty"` |
|
|
|
} |
|
|
|
|
|
|
|
func getLocalIP() string { |
|
|
|
addrs, err := net.InterfaceAddrs() |
|
|
|
if err != nil { |
|
|
@ -98,7 +92,7 @@ func main() { |
|
|
|
|
|
|
|
urlString := fmt.Sprintf("lndconnect://%s?cert=%s&macaroon=%s", ipString, certificate, macaroonB64) |
|
|
|
|
|
|
|
if loadedConfig.LndConnect.Json { |
|
|
|
if loadedConfig.LndConnect.Url { |
|
|
|
fmt.Println(urlString) |
|
|
|
} else if loadedConfig.LndConnect.Image { |
|
|
|
qrcode.WriteFile(urlString, qrcode.Medium, 512, "lndconnect-qr.png") |
|
|
|