@@ -100,22 +100,25 @@ func newRpcProxy(cfg *Config, validator macaroons.MacaroonValidator,
100
100
// +---+----------------------+
101
101
// |
102
102
// v native gRPC call with macaroon
103
- // +---+----------------------+ registered call
104
- // | gRPC server +--------------+
105
- // +---+----------------------+ |
106
- // | |
107
- // v non-registered call |
108
- // +---+----------------------+ +---------v----------+
109
- // | director | | local subserver |
110
- // +---+----------------------+ | - faraday |
111
- // | | - loop |
112
- // v authenticated call | - pool |
113
- // +---+----------------------+ +--------------------+
114
- // | lnd (remote or local) |
115
- // | faraday remote |
116
- // | loop remote |
117
- // | pool remote |
118
- // +--------------------------+
103
+ // +---+----------------------+
104
+ // | gRPC server |
105
+ // +---+----------------------+
106
+ // |
107
+ // v unknown authenticated call, gRPC server is just a wrapper
108
+ // +---+----------------------+
109
+ // | director |
110
+ // +---+----------------------+
111
+ // |
112
+ // v authenticated call
113
+ // +---+----------------------+ call to lnd or integrated daemon
114
+ // | lnd (remote or local) +---------------+
115
+ // | faraday remote | |
116
+ // | loop remote | +----------v----------+
117
+ // | pool remote | | lnd local subserver |
118
+ // +--------------------------+ | - faraday |
119
+ // | - loop |
120
+ // | - pool |
121
+ // +---------------------+
119
122
//
120
123
type rpcProxy struct {
121
124
cfg * Config
@@ -263,16 +266,13 @@ func (p *rpcProxy) director(ctx context.Context,
263
266
264
267
outCtx := metadata .NewOutgoingContext (ctx , mdCopy )
265
268
266
- // Direct the call to the correct backend. For lnd we _always_ have a
267
- // client connection, no matter if it's running in integrated or remote
268
- // mode. For all other daemons the request shouldn't get here in
269
- // integrated mode (after all, the director only picks up calls that the
270
- // gRPC server itself would throw a 404 for) so we throw an error
271
- // message for them if they're not in remote mode .
269
+ // Direct the call to the correct backend. All gRPC calls end up here
270
+ // since our gRPC server instance doesn't have any handlers registered
271
+ // itself. So all daemon calls that are remote are forwarded to them
272
+ // directly. Everything else will go to lnd since it must either be an
273
+ // lnd call or something that'll be handled by the integrated daemons
274
+ // that are hooking into lnd's gRPC server .
272
275
switch {
273
- case isLndURI (requestURI ):
274
- return outCtx , p .lndConn , nil
275
-
276
276
case isFaradayURI (requestURI ) && p .cfg .faradayRemote :
277
277
return outCtx , p .faradayConn , nil
278
278
@@ -283,8 +283,7 @@ func (p *rpcProxy) director(ctx context.Context,
283
283
return outCtx , p .poolConn , nil
284
284
285
285
default :
286
- return ctx , nil , fmt .Errorf ("unknown gRPC web request: %v" ,
287
- requestURI )
286
+ return outCtx , p .lndConn , nil
288
287
}
289
288
}
290
289
0 commit comments