@@ -30,6 +30,7 @@ import (
30
30
mid "github.com/lightninglabs/lightning-terminal/rpcmiddleware"
31
31
"github.com/lightninglabs/lightning-terminal/rules"
32
32
"github.com/lightninglabs/lightning-terminal/session"
33
+ "github.com/lightninglabs/lightning-terminal/status"
33
34
"github.com/lightninglabs/lightning-terminal/subservers"
34
35
"github.com/lightninglabs/lndclient"
35
36
"github.com/lightningnetwork/lnd"
@@ -161,6 +162,7 @@ type LightningTerminal struct {
161
162
basicClient lnrpc.LightningClient
162
163
163
164
subServerMgr * subservers.Manager
165
+ statusMgr * status.Manager
164
166
165
167
autopilotClient autopilotserver.Autopilot
166
168
@@ -193,7 +195,9 @@ type LightningTerminal struct {
193
195
194
196
// New creates a new instance of the lightning-terminal daemon.
195
197
func New () * LightningTerminal {
196
- return & LightningTerminal {}
198
+ return & LightningTerminal {
199
+ statusMgr : status .NewStatusManager (),
200
+ }
197
201
}
198
202
199
203
// Run starts everything and then blocks until either the application is shut
@@ -245,6 +249,7 @@ func (g *LightningTerminal) Run() error {
245
249
// Register any gRPC services that should be served using LiT's
246
250
// gRPC server regardless of the LND mode being used.
247
251
litrpc .RegisterProxyServer (g .rpcProxy .grpcServer , g .rpcProxy )
252
+ litrpc .RegisterStatusServer (g .rpcProxy .grpcServer , g .statusMgr )
248
253
249
254
// Start the main web server that dispatches requests either to the
250
255
// static UI file server or the RPC proxy. This makes it possible to
@@ -385,7 +390,7 @@ func (g *LightningTerminal) start() error {
385
390
),
386
391
},
387
392
registerGrpcServers : func (server * grpc.Server ) {
388
- g .registerSubDaemonGrpcServers (server , false )
393
+ g .registerSubDaemonGrpcServers (server , true )
389
394
},
390
395
superMacBaker : superMacBaker ,
391
396
firstConnectionDeadline : g .cfg .FirstLNCConnDeadline ,
@@ -901,22 +906,24 @@ func (g *LightningTerminal) RegisterGrpcSubserver(server *grpc.Server) error {
901
906
902
907
// Register all other daemon RPC servers that are running in-process.
903
908
// The LiT session server should be enabled on the main interface.
904
- g .registerSubDaemonGrpcServers (server , true )
909
+ g .registerSubDaemonGrpcServers (server , false )
905
910
906
911
return nil
907
912
}
908
913
909
914
// registerSubDaemonGrpcServers registers the sub daemon (Faraday, Loop, Pool
910
915
// and LiT session) servers to a given gRPC server, given they are running in
911
- // the local process. The lit session server is gated by its own boolean because
912
- // we don't necessarily want to expose it on all listeners, given its security
913
- // implications .
916
+ // the local process. Some of LiT's own sub-servers should be registered with
917
+ // LNC sessions and some should not - the forLNCSession boolean can be used to
918
+ // control this .
914
919
func (g * LightningTerminal ) registerSubDaemonGrpcServers (server * grpc.Server ,
915
- withLitRPC bool ) {
920
+ forLNCSession bool ) {
916
921
917
922
g .subServerMgr .RegisterRPCServices (server )
918
923
919
- if withLitRPC {
924
+ if forLNCSession {
925
+ litrpc .RegisterStatusServer (server , g .statusMgr )
926
+ } else {
920
927
litrpc .RegisterSessionsServer (server , g .sessionRpcServer )
921
928
litrpc .RegisterAccountsServer (server , g .accountRpcServer )
922
929
}
@@ -980,6 +987,13 @@ func (g *LightningTerminal) RegisterRestSubserver(ctx context.Context,
980
987
return err
981
988
}
982
989
990
+ err = litrpc .RegisterStatusHandlerFromEndpoint (
991
+ ctx , mux , endpoint , dialOpts ,
992
+ )
993
+ if err != nil {
994
+ return err
995
+ }
996
+
983
997
return g .subServerMgr .RegisterRestServices (ctx , mux , endpoint , dialOpts )
984
998
}
985
999
0 commit comments