lncli: add "connect" command

usage: lncli connect <lnid>@host:port

Currently one must specify port since we haven’t yet chosen an
“official” p2p port
This commit is contained in:
Olaoluwa Osuntokun committed 2016-01-16 19:29:03 -08:00
1 parent 3cb1ce050c
commit 701de388a0
2 files changed
+23 -2

No files matched your search

+21
View File
@@ -70,3 +70,24 @@ func sendMany(ctx *cli.Context) {
printRespJson(txid)
}
var ConnectCommand = cli.Command{
Name: "connect",
Usage: "connect to a remote lnd peer: <lnid>@host",
Action: connectPeer,
}
func connectPeer(ctx *cli.Context) {
ctxb := context.Background()
client := getClient(ctx)
targetAddress := ctx.Args().Get(0)
req := &lnrpc.ConnectPeerRequest{targetAddress}
lnid, err := client.ConnectPeer(ctxb, req)
if err != nil {
fatal(err)
}
printRespJson(lnid)
}
+2 -2
View File
@@ -55,11 +55,11 @@ func main() {
app.Commands = []cli.Command{
NewAddressCommand,
SendManyCommand,
ConnectCommand,
ShellCommand,
}
if err := app.Run(os.Args); err != nil {
fatal(err)
}
// ctx := context.Background()
}