mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
cmd/litcli: commands for status server
Note that the client connection for these commands does not require a macaroon.
This commit is contained in:
parent
143876d1ec
commit
4e2ec08767
2 changed files with 50 additions and 0 deletions
|
|
@ -77,6 +77,7 @@ func main() {
|
|||
app.Commands = append(app.Commands, autopilotCommands)
|
||||
app.Commands = append(app.Commands, litCommands...)
|
||||
app.Commands = append(app.Commands, helperCommands)
|
||||
app.Commands = append(app.Commands, statusCommands...)
|
||||
|
||||
err := app.Run(os.Args)
|
||||
if err != nil {
|
||||
|
|
|
|||
49
cmd/litcli/status.go
Normal file
49
cmd/litcli/status.go
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/lightninglabs/lightning-terminal/litrpc"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var statusCommands = []cli.Command{
|
||||
{
|
||||
Name: "status",
|
||||
Usage: "info about litd status",
|
||||
Category: "Status",
|
||||
Action: getStatus,
|
||||
},
|
||||
}
|
||||
|
||||
func getStatus(ctx *cli.Context) error {
|
||||
clientConn, cleanup, err := connectClient(ctx, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer cleanup()
|
||||
litClient := litrpc.NewStatusClient(clientConn)
|
||||
|
||||
// Get LiT's status.
|
||||
ctxb := context.Background()
|
||||
litResp, err := litClient.SubServerStatus(
|
||||
ctxb, &litrpc.SubServerStatusReq{},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJSON(litResp)
|
||||
|
||||
// Get LND's state.
|
||||
lndClient := lnrpc.NewStateClient(clientConn)
|
||||
lndResp, err := lndClient.GetState(ctxb, &lnrpc.GetStateRequest{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJSON(lndResp)
|
||||
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue