cln_plugin: custommsg support

This commit is contained in:
Jesse de Wit
2023-08-10 09:36:13 +02:00
parent 5c6f7da265
commit c23dc64df5
6 changed files with 454 additions and 42 deletions

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.12
// protoc v4.23.4
// source: cln_plugin.proto
package proto
@@ -549,6 +549,99 @@ func (x *HtlcResolve) GetPaymentKey() string {
return ""
}
type CustomMessageRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *CustomMessageRequest) Reset() {
*x = CustomMessageRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_cln_plugin_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CustomMessageRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CustomMessageRequest) ProtoMessage() {}
func (x *CustomMessageRequest) ProtoReflect() protoreflect.Message {
mi := &file_cln_plugin_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CustomMessageRequest.ProtoReflect.Descriptor instead.
func (*CustomMessageRequest) Descriptor() ([]byte, []int) {
return file_cln_plugin_proto_rawDescGZIP(), []int{7}
}
type CustomMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
}
func (x *CustomMessage) Reset() {
*x = CustomMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_cln_plugin_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CustomMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CustomMessage) ProtoMessage() {}
func (x *CustomMessage) ProtoReflect() protoreflect.Message {
mi := &file_cln_plugin_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CustomMessage.ProtoReflect.Descriptor instead.
func (*CustomMessage) Descriptor() ([]byte, []int) {
return file_cln_plugin_proto_rawDescGZIP(), []int{8}
}
func (x *CustomMessage) GetPeerId() string {
if x != nil {
return x.PeerId
}
return ""
}
func (x *CustomMessage) GetPayload() string {
if x != nil {
return x.Payload
}
return ""
}
var File_cln_plugin_proto protoreflect.FileDescriptor
var file_cln_plugin_proto_rawDesc = []byte{
@@ -618,14 +711,23 @@ var file_cln_plugin_proto_rawDesc = []byte{
0x75, 0x72, 0x65, 0x22, 0x2e, 0x0a, 0x0b, 0x48, 0x74, 0x6c, 0x63, 0x52, 0x65, 0x73, 0x6f, 0x6c,
0x76, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74,
0x4b, 0x65, 0x79, 0x32, 0x3d, 0x0a, 0x09, 0x43, 0x6c, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e,
0x12, 0x30, 0x0a, 0x0a, 0x48, 0x74, 0x6c, 0x63, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f,
0x2e, 0x48, 0x74, 0x6c, 0x63, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x1a,
0x0d, 0x2e, 0x48, 0x74, 0x6c, 0x63, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x28, 0x01,
0x30, 0x01, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x62, 0x72, 0x65, 0x65, 0x7a, 0x2f, 0x6c, 0x73, 0x70, 0x64, 0x2f, 0x63, 0x6c, 0x6e, 0x5f,
0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x4b, 0x65, 0x79, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x42, 0x0a, 0x0d, 0x43,
0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07,
0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70,
0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x32,
0x79, 0x0a, 0x09, 0x43, 0x6c, 0x6e, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x30, 0x0a, 0x0a,
0x48, 0x74, 0x6c, 0x63, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x0f, 0x2e, 0x48, 0x74, 0x6c,
0x63, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x0d, 0x2e, 0x48, 0x74,
0x6c, 0x63, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x28, 0x01, 0x30, 0x01, 0x12, 0x3a,
0x0a, 0x0f, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x12, 0x15, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f,
0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x30, 0x01, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x72, 0x65, 0x65, 0x7a, 0x2f, 0x6c,
0x73, 0x70, 0x64, 0x2f, 0x63, 0x6c, 0x6e, 0x5f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -640,15 +742,17 @@ func file_cln_plugin_proto_rawDescGZIP() []byte {
return file_cln_plugin_proto_rawDescData
}
var file_cln_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_cln_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_cln_plugin_proto_goTypes = []interface{}{
(*HtlcAccepted)(nil), // 0: HtlcAccepted
(*Onion)(nil), // 1: Onion
(*Htlc)(nil), // 2: Htlc
(*HtlcResolution)(nil), // 3: HtlcResolution
(*HtlcContinue)(nil), // 4: HtlcContinue
(*HtlcFail)(nil), // 5: HtlcFail
(*HtlcResolve)(nil), // 6: HtlcResolve
(*HtlcAccepted)(nil), // 0: HtlcAccepted
(*Onion)(nil), // 1: Onion
(*Htlc)(nil), // 2: Htlc
(*HtlcResolution)(nil), // 3: HtlcResolution
(*HtlcContinue)(nil), // 4: HtlcContinue
(*HtlcFail)(nil), // 5: HtlcFail
(*HtlcResolve)(nil), // 6: HtlcResolve
(*CustomMessageRequest)(nil), // 7: CustomMessageRequest
(*CustomMessage)(nil), // 8: CustomMessage
}
var file_cln_plugin_proto_depIdxs = []int32{
1, // 0: HtlcAccepted.onion:type_name -> Onion
@@ -657,9 +761,11 @@ var file_cln_plugin_proto_depIdxs = []int32{
4, // 3: HtlcResolution.continue:type_name -> HtlcContinue
6, // 4: HtlcResolution.resolve:type_name -> HtlcResolve
3, // 5: ClnPlugin.HtlcStream:input_type -> HtlcResolution
0, // 6: ClnPlugin.HtlcStream:output_type -> HtlcAccepted
6, // [6:7] is the sub-list for method output_type
5, // [5:6] is the sub-list for method input_type
7, // 6: ClnPlugin.CustomMsgStream:input_type -> CustomMessageRequest
0, // 7: ClnPlugin.HtlcStream:output_type -> HtlcAccepted
8, // 8: ClnPlugin.CustomMsgStream:output_type -> CustomMessage
7, // [7:9] is the sub-list for method output_type
5, // [5:7] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
@@ -755,6 +861,30 @@ func file_cln_plugin_proto_init() {
return nil
}
}
file_cln_plugin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CustomMessageRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cln_plugin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CustomMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_cln_plugin_proto_msgTypes[3].OneofWrappers = []interface{}{
(*HtlcResolution_Fail)(nil),
@@ -772,7 +902,7 @@ func file_cln_plugin_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cln_plugin_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},