mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
993167f14e
The grpc-gateway library that is used to transform REST calls into gRPC uses a different method for reading a request body stream depending on whether the RPC is a request-streaming one or not. We can't really find out what kind of RPC the user is calling at runtime, so we add a new parameter to the proxy that lists all request-streaming RPC calls. In any case the client _has_ to send one request message initially to kick off the request processing. Normally this can just be an empty message. This can lead to problems if that empty message is not expected by the gRPC server. But for the currently existing two client-streaming RPCs this will only trigger a warning (HTLC interceptor) or be ignored (channel acceptor).
18 lines
659 B
Go
18 lines
659 B
Go
package lnrpc
|
|
|
|
import "regexp"
|
|
|
|
var (
|
|
// LndClientStreamingURIs is a list of all lnd RPCs that use a request-
|
|
// streaming interface. Those request-streaming RPCs need to be handled
|
|
// differently in the WebsocketProxy because of how the request body
|
|
// parsing is implemented in the grpc-gateway library. Unfortunately
|
|
// there is no straightforward way of obtaining this information on
|
|
// runtime so we need to keep a hard coded list here.
|
|
LndClientStreamingURIs = []*regexp.Regexp{
|
|
regexp.MustCompile("^/v1/channels/acceptor$"),
|
|
regexp.MustCompile("^/v1/channels/transaction-stream$"),
|
|
regexp.MustCompile("^/v2/router/htlcinterceptor$"),
|
|
}
|
|
)
|