lnrpc: SendOnionMessage rpc endpoint
This commit is contained in:
1 parent
cb2d8abe40
commit
2ee0702942
7 files changed
+5364
-4557
No files matched your search
+4873
-4554
File diff suppressed because it is too large.
Load diff
@@ -2523,6 +2523,57 @@ func request_Lightning_SubscribeCustomMessages_0(ctx context.Context, marshaler
|
||||
|
||||
}
|
||||
|
||||
func request_Lightning_SendOnionMessage_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq SendOnionMessageRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.SendOnionMessage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_Lightning_SendOnionMessage_0(ctx context.Context, marshaler runtime.Marshaler, server LightningServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq SendOnionMessageRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
newReader, berr := utilities.IOReaderFactory(req.Body)
|
||||
if berr != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
|
||||
}
|
||||
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.SendOnionMessage(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_Lightning_SubscribeOnionMessages_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (Lightning_SubscribeOnionMessagesClient, runtime.ServerMetadata, error) {
|
||||
var protoReq SubscribeOnionMessagesRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
stream, err := client.SubscribeOnionMessages(ctx, &protoReq)
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
header, err := stream.Header()
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
metadata.HeaderMD = header
|
||||
return stream, metadata, nil
|
||||
|
||||
}
|
||||
|
||||
func request_Lightning_ListAliases_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListAliasesRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -4078,6 +4129,38 @@ func RegisterLightningHandlerServer(ctx context.Context, mux *runtime.ServeMux,
|
||||
return
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Lightning_SendOnionMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/lnrpc.Lightning/SendOnionMessage", runtime.WithHTTPPathPattern("/v1/onionmessage"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Lightning_SendOnionMessage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Lightning_SendOnionMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Lightning_SubscribeOnionMessages_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport")
|
||||
_, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Lightning_ListAliases_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -5643,6 +5726,50 @@ func RegisterLightningHandlerClient(ctx context.Context, mux *runtime.ServeMux,
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_Lightning_SendOnionMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/lnrpc.Lightning/SendOnionMessage", runtime.WithHTTPPathPattern("/v1/onionmessage"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Lightning_SendOnionMessage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Lightning_SendOnionMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Lightning_SubscribeOnionMessages_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/lnrpc.Lightning/SubscribeOnionMessages", runtime.WithHTTPPathPattern("/v1/onionmessage/subscribe"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Lightning_SubscribeOnionMessages_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_Lightning_SubscribeOnionMessages_0(annotatedContext, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_Lightning_ListAliases_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -5825,6 +5952,10 @@ var (
|
||||
|
||||
pattern_Lightning_SubscribeCustomMessages_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "custommessage", "subscribe"}, ""))
|
||||
|
||||
pattern_Lightning_SendOnionMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "onionmessage"}, ""))
|
||||
|
||||
pattern_Lightning_SubscribeOnionMessages_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "onionmessage", "subscribe"}, ""))
|
||||
|
||||
pattern_Lightning_ListAliases_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "aliases", "list"}, ""))
|
||||
|
||||
pattern_Lightning_LookupHtlcResolution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "htlc-resolution", "chan_id", "htlc_index"}, ""))
|
||||
@@ -5965,6 +6096,10 @@ var (
|
||||
|
||||
forward_Lightning_SubscribeCustomMessages_0 = runtime.ForwardResponseStream
|
||||
|
||||
forward_Lightning_SendOnionMessage_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Lightning_SubscribeOnionMessages_0 = runtime.ForwardResponseStream
|
||||
|
||||
forward_Lightning_ListAliases_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_Lightning_LookupHtlcResolution_0 = runtime.ForwardResponseMessage
|
||||
|
||||
@@ -1749,6 +1749,73 @@ func RegisterLightningJSONCallbacks(registry map[string]func(ctx context.Context
|
||||
}()
|
||||
}
|
||||
|
||||
registry["lnrpc.Lightning.SendOnionMessage"] = func(ctx context.Context,
|
||||
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
||||
|
||||
req := &SendOnionMessageRequest{}
|
||||
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
client := NewLightningClient(conn)
|
||||
resp, err := client.SendOnionMessage(ctx, req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
respBytes, err := marshaler.Marshal(resp)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
callback(string(respBytes), nil)
|
||||
}
|
||||
|
||||
registry["lnrpc.Lightning.SubscribeOnionMessages"] = func(ctx context.Context,
|
||||
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
||||
|
||||
req := &SubscribeOnionMessagesRequest{}
|
||||
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
client := NewLightningClient(conn)
|
||||
stream, err := client.SubscribeOnionMessages(ctx, req)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-stream.Context().Done():
|
||||
callback("", stream.Context().Err())
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
resp, err := stream.Recv()
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
|
||||
respBytes, err := marshaler.Marshal(resp)
|
||||
if err != nil {
|
||||
callback("", err)
|
||||
return
|
||||
}
|
||||
callback(string(respBytes), nil)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
registry["lnrpc.Lightning.ListAliases"] = func(ctx context.Context,
|
||||
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
||||
|
||||
|
||||
+61
-1
@@ -597,6 +597,18 @@ service Lightning {
|
||||
rpc SubscribeCustomMessages (SubscribeCustomMessagesRequest)
|
||||
returns (stream CustomMessage);
|
||||
|
||||
/* lncli: `sendonion`
|
||||
SendOnionMessage sends an onion message to a peer.
|
||||
*/
|
||||
rpc SendOnionMessage (SendOnionMessageRequest)
|
||||
returns (SendOnionMessageResponse);
|
||||
|
||||
/* lncli: `subscribeonion`
|
||||
SubscribeOnionMessages subscribes to a stream of incoming onion messages.
|
||||
*/
|
||||
rpc SubscribeOnionMessages (SubscribeOnionMessagesRequest)
|
||||
returns (stream OnionMessage);
|
||||
|
||||
/* lncli: `listaliases`
|
||||
ListAliases returns the set of all aliases that have ever existed with
|
||||
their confirmed SCID (if it exists) and/or the base SCID (in the case of
|
||||
@@ -642,7 +654,8 @@ message CustomMessage {
|
||||
}
|
||||
|
||||
message SendCustomMessageRequest {
|
||||
// Peer to send the message to
|
||||
// Peer to which the message will be sent. Represented as a byte-encoded
|
||||
// public key
|
||||
bytes peer = 1;
|
||||
|
||||
// Message type. This value needs to be in the custom range (>= 32768).
|
||||
@@ -660,6 +673,53 @@ message SendCustomMessageResponse {
|
||||
string status = 1;
|
||||
}
|
||||
|
||||
message SubscribeOnionMessagesRequest {
|
||||
}
|
||||
|
||||
message OnionMessage {
|
||||
// Peer from which this message originates. Represented as a byte-encoded
|
||||
// public key.
|
||||
bytes peer = 1;
|
||||
|
||||
// PathKey is used to derive the blinded node id by tweaking the hop's
|
||||
// static public key. The hop uses the corresponding blinded private key
|
||||
// together with the sender's ephemeral key to perform ECDH and obtain the
|
||||
// shared secret for decrypting the onion payload. Separately, for
|
||||
// decrypting `encrypted_recipient_data`, the recipient performs ECDH
|
||||
// between its static node private key and the path_key to derive the
|
||||
// decryption key.
|
||||
bytes path_key = 2;
|
||||
|
||||
// Serialized Sphinx onion packet (BOLT 4) containing the layered, per-hop
|
||||
// encrypted payloads and routing instructions used to forward this message
|
||||
// along its designated path.
|
||||
bytes onion = 3;
|
||||
}
|
||||
|
||||
message SendOnionMessageRequest {
|
||||
// Peer to send the message to
|
||||
bytes peer = 1;
|
||||
|
||||
// PathKey is used to derive the blinded node id by tweaking the hop's
|
||||
// static public key. The hop uses the corresponding blinded private key
|
||||
// together with the sender's ephemeral key to perform ECDH and obtain the
|
||||
// shared secret for decrypting the onion payload. Separately, for
|
||||
// decrypting `encrypted_recipient_data`, the recipient performs ECDH
|
||||
// between its static node private key and the path_key to derive the
|
||||
// decryption key.
|
||||
bytes path_key = 2;
|
||||
|
||||
// Serialized Sphinx onion packet (BOLT 4) containing the layered, per-hop
|
||||
// encrypted payloads and routing instructions used to forward this message
|
||||
// along its designated path.
|
||||
bytes onion = 3;
|
||||
}
|
||||
|
||||
message SendOnionMessageResponse {
|
||||
// The status of the onion message send operation.
|
||||
string status = 1;
|
||||
}
|
||||
|
||||
message Utxo {
|
||||
// The type of address
|
||||
AddressType address_type = 1;
|
||||
|
||||
@@ -2264,6 +2264,71 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/onionmessage": {
|
||||
"post": {
|
||||
"summary": "lncli: `sendonion`\nSendOnionMessage sends an onion message to a peer.",
|
||||
"operationId": "Lightning_SendOnionMessage",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/lnrpcSendOnionMessageResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/lnrpcSendOnionMessageRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Lightning"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/onionmessage/subscribe": {
|
||||
"get": {
|
||||
"summary": "lncli: `subscribeonion`\nSubscribeOnionMessages subscribes to a stream of incoming onion messages.",
|
||||
"operationId": "Lightning_SubscribeOnionMessages",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.(streaming responses)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/definitions/lnrpcOnionMessage"
|
||||
},
|
||||
"error": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
},
|
||||
"title": "Stream result of lnrpcOnionMessage"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Lightning"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/payment": {
|
||||
"delete": {
|
||||
"summary": "lncli: `deletepayments`\nDeletePayment deletes an outgoing payment from DB. Note that it will not\nattempt to delete an In-Flight payment, since that would be unsafe.",
|
||||
@@ -6477,6 +6542,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"lnrpcOnionMessage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"peer": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "Peer from which this message originates. Represented as a byte-encoded\npublic key."
|
||||
},
|
||||
"path_key": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "PathKey is used to derive the blinded node id by tweaking the hop's\nstatic public key. The hop uses the corresponding blinded private key\ntogether with the sender's ephemeral key to perform ECDH and obtain the\nshared secret for decrypting the onion payload. Separately, for\ndecrypting `encrypted_recipient_data`, the recipient performs ECDH\nbetween its static node private key and the path_key to derive the\ndecryption key."
|
||||
},
|
||||
"onion": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "Serialized Sphinx onion packet (BOLT 4) containing the layered, per-hop\nencrypted payloads and routing instructions used to forward this message\nalong its designated path."
|
||||
}
|
||||
}
|
||||
},
|
||||
"lnrpcOpenChannelRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -7515,7 +7600,7 @@
|
||||
"peer": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"title": "Peer to send the message to"
|
||||
"title": "Peer to which the message will be sent. Represented as a byte-encoded\npublic key"
|
||||
},
|
||||
"type": {
|
||||
"type": "integer",
|
||||
@@ -7592,6 +7677,35 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"lnrpcSendOnionMessageRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"peer": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"title": "Peer to send the message to"
|
||||
},
|
||||
"path_key": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "PathKey is used to derive the blinded node id by tweaking the hop's\nstatic public key. The hop uses the corresponding blinded private key\ntogether with the sender's ephemeral key to perform ECDH and obtain the\nshared secret for decrypting the onion payload. Separately, for\ndecrypting `encrypted_recipient_data`, the recipient performs ECDH\nbetween its static node private key and the path_key to derive the\ndecryption key."
|
||||
},
|
||||
"onion": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"description": "Serialized Sphinx onion packet (BOLT 4) containing the layered, per-hop\nencrypted payloads and routing instructions used to forward this message\nalong its designated path."
|
||||
}
|
||||
}
|
||||
},
|
||||
"lnrpcSendOnionMessageResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"status": {
|
||||
"type": "string",
|
||||
"description": "The status of the onion message send operation."
|
||||
}
|
||||
}
|
||||
},
|
||||
"lnrpcSendRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -166,7 +166,12 @@ http:
|
||||
post: "/v1/custommessage"
|
||||
body: "*"
|
||||
- selector: lnrpc.Lightning.SubscribeCustomMessages
|
||||
get: "/v1/custommessage/subscribe"
|
||||
get: "/v1/custommessage/subscribe"
|
||||
- selector: lnrpc.Lightning.SendOnionMessage
|
||||
post: "/v1/onionmessage"
|
||||
body: "*"
|
||||
- selector: lnrpc.Lightning.SubscribeOnionMessages
|
||||
get: "/v1/onionmessage/subscribe"
|
||||
- selector: lnrpc.Lightning.ListAliases
|
||||
get: "/v1/aliases/list"
|
||||
- selector: lnrpc.Lightning.LookupHtlcResolution
|
||||
|
||||
@@ -417,6 +417,12 @@ type LightningClient interface {
|
||||
// needs to be compiled with the `dev` build tag, and the message type to
|
||||
// override should be specified in lnd's experimental protocol configuration.
|
||||
SubscribeCustomMessages(ctx context.Context, in *SubscribeCustomMessagesRequest, opts ...grpc.CallOption) (Lightning_SubscribeCustomMessagesClient, error)
|
||||
// lncli: `sendonion`
|
||||
// SendOnionMessage sends an onion message to a peer.
|
||||
SendOnionMessage(ctx context.Context, in *SendOnionMessageRequest, opts ...grpc.CallOption) (*SendOnionMessageResponse, error)
|
||||
// lncli: `subscribeonion`
|
||||
// SubscribeOnionMessages subscribes to a stream of incoming onion messages.
|
||||
SubscribeOnionMessages(ctx context.Context, in *SubscribeOnionMessagesRequest, opts ...grpc.CallOption) (Lightning_SubscribeOnionMessagesClient, error)
|
||||
// lncli: `listaliases`
|
||||
// ListAliases returns the set of all aliases that have ever existed with
|
||||
// their confirmed SCID (if it exists) and/or the base SCID (in the case of
|
||||
@@ -1338,6 +1344,47 @@ func (x *lightningSubscribeCustomMessagesClient) Recv() (*CustomMessage, error)
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *lightningClient) SendOnionMessage(ctx context.Context, in *SendOnionMessageRequest, opts ...grpc.CallOption) (*SendOnionMessageResponse, error) {
|
||||
out := new(SendOnionMessageResponse)
|
||||
err := c.cc.Invoke(ctx, "/lnrpc.Lightning/SendOnionMessage", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *lightningClient) SubscribeOnionMessages(ctx context.Context, in *SubscribeOnionMessagesRequest, opts ...grpc.CallOption) (Lightning_SubscribeOnionMessagesClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &Lightning_ServiceDesc.Streams[13], "/lnrpc.Lightning/SubscribeOnionMessages", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &lightningSubscribeOnionMessagesClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type Lightning_SubscribeOnionMessagesClient interface {
|
||||
Recv() (*OnionMessage, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type lightningSubscribeOnionMessagesClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *lightningSubscribeOnionMessagesClient) Recv() (*OnionMessage, error) {
|
||||
m := new(OnionMessage)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *lightningClient) ListAliases(ctx context.Context, in *ListAliasesRequest, opts ...grpc.CallOption) (*ListAliasesResponse, error) {
|
||||
out := new(ListAliasesResponse)
|
||||
err := c.cc.Invoke(ctx, "/lnrpc.Lightning/ListAliases", in, out, opts...)
|
||||
@@ -1759,6 +1806,12 @@ type LightningServer interface {
|
||||
// needs to be compiled with the `dev` build tag, and the message type to
|
||||
// override should be specified in lnd's experimental protocol configuration.
|
||||
SubscribeCustomMessages(*SubscribeCustomMessagesRequest, Lightning_SubscribeCustomMessagesServer) error
|
||||
// lncli: `sendonion`
|
||||
// SendOnionMessage sends an onion message to a peer.
|
||||
SendOnionMessage(context.Context, *SendOnionMessageRequest) (*SendOnionMessageResponse, error)
|
||||
// lncli: `subscribeonion`
|
||||
// SubscribeOnionMessages subscribes to a stream of incoming onion messages.
|
||||
SubscribeOnionMessages(*SubscribeOnionMessagesRequest, Lightning_SubscribeOnionMessagesServer) error
|
||||
// lncli: `listaliases`
|
||||
// ListAliases returns the set of all aliases that have ever existed with
|
||||
// their confirmed SCID (if it exists) and/or the base SCID (in the case of
|
||||
@@ -1976,6 +2029,12 @@ func (UnimplementedLightningServer) SendCustomMessage(context.Context, *SendCust
|
||||
func (UnimplementedLightningServer) SubscribeCustomMessages(*SubscribeCustomMessagesRequest, Lightning_SubscribeCustomMessagesServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method SubscribeCustomMessages not implemented")
|
||||
}
|
||||
func (UnimplementedLightningServer) SendOnionMessage(context.Context, *SendOnionMessageRequest) (*SendOnionMessageResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SendOnionMessage not implemented")
|
||||
}
|
||||
func (UnimplementedLightningServer) SubscribeOnionMessages(*SubscribeOnionMessagesRequest, Lightning_SubscribeOnionMessagesServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method SubscribeOnionMessages not implemented")
|
||||
}
|
||||
func (UnimplementedLightningServer) ListAliases(context.Context, *ListAliasesRequest) (*ListAliasesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListAliases not implemented")
|
||||
}
|
||||
@@ -3260,6 +3319,45 @@ func (x *lightningSubscribeCustomMessagesServer) Send(m *CustomMessage) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _Lightning_SendOnionMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SendOnionMessageRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LightningServer).SendOnionMessage(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/lnrpc.Lightning/SendOnionMessage",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LightningServer).SendOnionMessage(ctx, req.(*SendOnionMessageRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Lightning_SubscribeOnionMessages_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(SubscribeOnionMessagesRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(LightningServer).SubscribeOnionMessages(m, &lightningSubscribeOnionMessagesServer{stream})
|
||||
}
|
||||
|
||||
type Lightning_SubscribeOnionMessagesServer interface {
|
||||
Send(*OnionMessage) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type lightningSubscribeOnionMessagesServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *lightningSubscribeOnionMessagesServer) Send(m *OnionMessage) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _Lightning_ListAliases_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListAliasesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -3519,6 +3617,10 @@ var Lightning_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "SendCustomMessage",
|
||||
Handler: _Lightning_SendCustomMessage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SendOnionMessage",
|
||||
Handler: _Lightning_SendOnionMessage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListAliases",
|
||||
Handler: _Lightning_ListAliases_Handler,
|
||||
@@ -3598,6 +3700,11 @@ var Lightning_ServiceDesc = grpc.ServiceDesc{
|
||||
Handler: _Lightning_SubscribeCustomMessages_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "SubscribeOnionMessages",
|
||||
Handler: _Lightning_SubscribeOnionMessages_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "lightning.proto",
|
||||
}
|
||||
Reference in new issue
Block a user