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:
parent
3cb1ce050c
commit
701de388a0
@ -70,3 +70,24 @@ func sendMany(ctx *cli.Context) {
|
|||||||
|
|
||||||
printRespJson(txid)
|
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)
|
||||||
|
}
|
||||||
|
@ -55,11 +55,11 @@ func main() {
|
|||||||
app.Commands = []cli.Command{
|
app.Commands = []cli.Command{
|
||||||
NewAddressCommand,
|
NewAddressCommand,
|
||||||
SendManyCommand,
|
SendManyCommand,
|
||||||
|
ConnectCommand,
|
||||||
ShellCommand,
|
ShellCommand,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ctx := context.Background()
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user