@@ -46,7 +46,7 @@ func (s *Manager) AddServer(ss SubServer) {
4646 defer s .mu .Unlock ()
4747
4848 s .servers = append (s .servers , & subServerWrapper {
49- subServer : ss ,
49+ SubServer : ss ,
5050 quit : make (chan struct {}),
5151 })
5252}
@@ -60,16 +60,16 @@ func (s *Manager) StartIntegratedServers(lndClient lnrpc.LightningClient,
6060 defer s .mu .Unlock ()
6161
6262 for _ , ss := range s .servers {
63- if ss .subServer . Remote () {
63+ if ss .Remote () {
6464 continue
6565 }
6666
6767 err := ss .startIntegrated (
6868 lndClient , lndGrpc , withMacaroonService ,
6969 )
7070 if err != nil {
71- return fmt .Errorf ("Unable to start %v in integrated " +
72- "mode: %v" , ss .subServer . Name (), err )
71+ return fmt .Errorf ("unable to start %v in integrated " +
72+ "mode: %v" , ss .Name (), err )
7373 }
7474 }
7575
@@ -83,14 +83,14 @@ func (s *Manager) ConnectRemoteSubServers() {
8383 defer s .mu .Unlock ()
8484
8585 for _ , ss := range s .servers {
86- if ! ss .subServer . Remote () {
86+ if ! ss .Remote () {
8787 continue
8888 }
8989
9090 err := ss .connectRemote ()
9191 if err != nil {
9292 log .Errorf ("Failed to connect to remote %s: %v" ,
93- ss .subServer . Name (), err )
93+ ss .Name (), err )
9494
9595 continue
9696 }
@@ -108,11 +108,11 @@ func (s *Manager) RegisterRPCServices(server grpc.ServiceRegistrar) {
108108 // a catch-all for any gRPC request that isn't known because we
109109 // didn't register any server for it. The director will then
110110 // forward the request to the remote service.
111- if ss .subServer . Remote () {
111+ if ss .Remote () {
112112 continue
113113 }
114114
115- ss .subServer . RegisterGrpcService (server )
115+ ss .RegisterGrpcService (server )
116116 }
117117}
118118
@@ -125,11 +125,11 @@ func (s *Manager) GetRemoteConn(uri string) (bool, *grpc.ClientConn) {
125125 defer s .mu .RUnlock ()
126126
127127 for _ , ss := range s .servers {
128- if ! s .permsMgr .IsSubServerURI (ss .subServer . Name (), uri ) {
128+ if ! s .permsMgr .IsSubServerURI (ss .Name (), uri ) {
129129 continue
130130 }
131131
132- if ! ss .subServer . Remote () {
132+ if ! ss .Remote () {
133133 return false , nil
134134 }
135135
@@ -151,15 +151,15 @@ func (s *Manager) ValidateMacaroon(ctx context.Context,
151151 defer s .mu .RUnlock ()
152152
153153 for _ , ss := range s .servers {
154- if ! s .permsMgr .IsSubServerURI (ss .subServer . Name (), uri ) {
154+ if ! s .permsMgr .IsSubServerURI (ss .Name (), uri ) {
155155 continue
156156 }
157157
158158 // If the sub-server is running in remote mode, then we don't
159159 // need to validate the macaroon here since the remote server
160160 // will do it when the request arrives. But we have handled the
161161 // request, as we were able to identify it.
162- if ss .subServer . Remote () {
162+ if ss .Remote () {
163163 return true , nil
164164 }
165165
@@ -170,14 +170,12 @@ func (s *Manager) ValidateMacaroon(ctx context.Context,
170170 return true , fmt .Errorf ("%s is not yet ready for " +
171171 "requests, the subserver has not started or " +
172172 "lnd still starting/syncing" ,
173- ss .subServer . Name ())
173+ ss .Name ())
174174 }
175175
176176 // Validate the macaroon with the integrated sub-server's own
177177 // validator.
178- err := ss .subServer .ValidateMacaroon (
179- ctx , requiredPermissions , uri ,
180- )
178+ err := ss .ValidateMacaroon (ctx , requiredPermissions , uri )
181179 if err != nil {
182180 return true , fmt .Errorf ("invalid macaroon: %v" , err )
183181 }
@@ -199,14 +197,13 @@ func (s *Manager) Stop() error {
199197 defer s .mu .RUnlock ()
200198
201199 for _ , ss := range s .servers {
202- if ss .subServer . Remote () {
200+ if ss .Remote () {
203201 continue
204202 }
205203
206204 err := ss .stop ()
207205 if err != nil {
208- log .Errorf ("Error stopping %s: %v" , ss .subServer .Name (),
209- err )
206+ log .Errorf ("Error stopping %s: %v" , ss .Name (), err )
210207 returnErr = err
211208 }
212209 }
0 commit comments