diff --git a/.gitignore b/.gitignore index 7e5c6aa..899c4e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -__debug -/network \ No newline at end of file +__debug_bin +#/network \ No newline at end of file diff --git a/network/function.pb.go b/network/function.pb.go new file mode 100644 index 0000000..96abfb9 --- /dev/null +++ b/network/function.pb.go @@ -0,0 +1,192 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: protobuf/function.proto + +package network + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Function struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Metadata *Metadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` + ErrNo int32 `protobuf:"zigzag32,4,opt,name=errNo,proto3" json:"errNo,omitempty"` + Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *Function) Reset() { + *x = Function{} + if protoimpl.UnsafeEnabled { + mi := &file_protobuf_function_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Function) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Function) ProtoMessage() {} + +func (x *Function) ProtoReflect() protoreflect.Message { + mi := &file_protobuf_function_proto_msgTypes[0] + 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 Function.ProtoReflect.Descriptor instead. +func (*Function) Descriptor() ([]byte, []int) { + return file_protobuf_function_proto_rawDescGZIP(), []int{0} +} + +func (x *Function) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *Function) GetMetadata() *Metadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *Function) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *Function) GetErrNo() int32 { + if x != nil { + return x.ErrNo + } + return 0 +} + +func (x *Function) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +var File_protobuf_function_proto protoreflect.FileDescriptor + +var file_protobuf_function_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x75, 0x6e, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x1a, 0x15, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xa8, 0x01, 0x0a, 0x08, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x27, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, + 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x4e, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x11, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x4e, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, 0x0b, 0x5a, + 0x09, 0x2e, 0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_protobuf_function_proto_rawDescOnce sync.Once + file_protobuf_function_proto_rawDescData = file_protobuf_function_proto_rawDesc +) + +func file_protobuf_function_proto_rawDescGZIP() []byte { + file_protobuf_function_proto_rawDescOnce.Do(func() { + file_protobuf_function_proto_rawDescData = protoimpl.X.CompressGZIP(file_protobuf_function_proto_rawDescData) + }) + return file_protobuf_function_proto_rawDescData +} + +var file_protobuf_function_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_protobuf_function_proto_goTypes = []interface{}{ + (*Function)(nil), // 0: network.Function + (*Header)(nil), // 1: network.Header + (*Metadata)(nil), // 2: network.Metadata +} +var file_protobuf_function_proto_depIdxs = []int32{ + 1, // 0: network.Function.header:type_name -> network.Header + 2, // 1: network.Function.metadata:type_name -> network.Metadata + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_protobuf_function_proto_init() } +func file_protobuf_function_proto_init() { + if File_protobuf_function_proto != nil { + return + } + file_protobuf_header_proto_init() + file_protobuf_metadata_proto_init() + if !protoimpl.UnsafeEnabled { + file_protobuf_function_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Function); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_protobuf_function_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_protobuf_function_proto_goTypes, + DependencyIndexes: file_protobuf_function_proto_depIdxs, + MessageInfos: file_protobuf_function_proto_msgTypes, + }.Build() + File_protobuf_function_proto = out.File + file_protobuf_function_proto_rawDesc = nil + file_protobuf_function_proto_goTypes = nil + file_protobuf_function_proto_depIdxs = nil +} diff --git a/network/header.pb.go b/network/header.pb.go new file mode 100644 index 0000000..1441081 --- /dev/null +++ b/network/header.pb.go @@ -0,0 +1,255 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: protobuf/header.proto + +package network + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Header struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Headers map[string]string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + QueryArgs map[string]*ListOfStrings `protobuf:"bytes,2,rep,name=queryArgs,proto3" json:"queryArgs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + MultipartForm *MultipartForm `protobuf:"bytes,3,opt,name=multipartForm,proto3" json:"multipartForm,omitempty"` + Params map[string]string `protobuf:"bytes,4,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + ResponseHeaders map[string]string `protobuf:"bytes,5,rep,name=responseHeaders,proto3" json:"responseHeaders,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Path string `protobuf:"bytes,6,opt,name=path,proto3" json:"path,omitempty"` + Method string `protobuf:"bytes,7,opt,name=method,proto3" json:"method,omitempty"` + Domain string `protobuf:"bytes,8,opt,name=domain,proto3" json:"domain,omitempty"` +} + +func (x *Header) Reset() { + *x = Header{} + if protoimpl.UnsafeEnabled { + mi := &file_protobuf_header_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Header) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header) ProtoMessage() {} + +func (x *Header) ProtoReflect() protoreflect.Message { + mi := &file_protobuf_header_proto_msgTypes[0] + 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 Header.ProtoReflect.Descriptor instead. +func (*Header) Descriptor() ([]byte, []int) { + return file_protobuf_header_proto_rawDescGZIP(), []int{0} +} + +func (x *Header) GetHeaders() map[string]string { + if x != nil { + return x.Headers + } + return nil +} + +func (x *Header) GetQueryArgs() map[string]*ListOfStrings { + if x != nil { + return x.QueryArgs + } + return nil +} + +func (x *Header) GetMultipartForm() *MultipartForm { + if x != nil { + return x.MultipartForm + } + return nil +} + +func (x *Header) GetParams() map[string]string { + if x != nil { + return x.Params + } + return nil +} + +func (x *Header) GetResponseHeaders() map[string]string { + if x != nil { + return x.ResponseHeaders + } + return nil +} + +func (x *Header) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *Header) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *Header) GetDomain() string { + if x != nil { + return x.Domain + } + return "" +} + +var File_protobuf_header_proto protoreflect.FileDescriptor + +var file_protobuf_header_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x1a, 0x1a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x2d, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x61, 0x72, 0x74, + 0x2d, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x05, 0x0a, 0x06, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x3c, + 0x0a, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x41, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x72, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x09, 0x71, 0x75, 0x65, 0x72, 0x79, 0x41, 0x72, 0x67, 0x73, 0x12, 0x3c, 0x0a, 0x0d, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x61, 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x4d, 0x75, + 0x6c, 0x74, 0x69, 0x70, 0x61, 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x52, 0x0d, 0x6d, 0x75, 0x6c, + 0x74, 0x69, 0x70, 0x61, 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x12, 0x33, 0x0a, 0x06, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x4e, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, + 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, + 0x61, 0x69, 0x6e, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, + 0x54, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x72, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x4f, 0x66, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x1a, 0x42, 0x0a, 0x14, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_protobuf_header_proto_rawDescOnce sync.Once + file_protobuf_header_proto_rawDescData = file_protobuf_header_proto_rawDesc +) + +func file_protobuf_header_proto_rawDescGZIP() []byte { + file_protobuf_header_proto_rawDescOnce.Do(func() { + file_protobuf_header_proto_rawDescData = protoimpl.X.CompressGZIP(file_protobuf_header_proto_rawDescData) + }) + return file_protobuf_header_proto_rawDescData +} + +var file_protobuf_header_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_protobuf_header_proto_goTypes = []interface{}{ + (*Header)(nil), // 0: network.Header + nil, // 1: network.Header.HeadersEntry + nil, // 2: network.Header.QueryArgsEntry + nil, // 3: network.Header.ParamsEntry + nil, // 4: network.Header.ResponseHeadersEntry + (*MultipartForm)(nil), // 5: network.MultipartForm + (*ListOfStrings)(nil), // 6: network.ListOfStrings +} +var file_protobuf_header_proto_depIdxs = []int32{ + 1, // 0: network.Header.headers:type_name -> network.Header.HeadersEntry + 2, // 1: network.Header.queryArgs:type_name -> network.Header.QueryArgsEntry + 5, // 2: network.Header.multipartForm:type_name -> network.MultipartForm + 3, // 3: network.Header.params:type_name -> network.Header.ParamsEntry + 4, // 4: network.Header.responseHeaders:type_name -> network.Header.ResponseHeadersEntry + 6, // 5: network.Header.QueryArgsEntry.value:type_name -> network.ListOfStrings + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_protobuf_header_proto_init() } +func file_protobuf_header_proto_init() { + if File_protobuf_header_proto != nil { + return + } + file_protobuf_list_values_proto_init() + file_protobuf_multipart_form_proto_init() + if !protoimpl.UnsafeEnabled { + file_protobuf_header_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_protobuf_header_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_protobuf_header_proto_goTypes, + DependencyIndexes: file_protobuf_header_proto_depIdxs, + MessageInfos: file_protobuf_header_proto_msgTypes, + }.Build() + File_protobuf_header_proto = out.File + file_protobuf_header_proto_rawDesc = nil + file_protobuf_header_proto_goTypes = nil + file_protobuf_header_proto_depIdxs = nil +} diff --git a/network/list-values.pb.go b/network/list-values.pb.go new file mode 100644 index 0000000..e5ce953 --- /dev/null +++ b/network/list-values.pb.go @@ -0,0 +1,361 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: protobuf/list-values.proto + +package network + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ListOfStrings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` +} + +func (x *ListOfStrings) Reset() { + *x = ListOfStrings{} + if protoimpl.UnsafeEnabled { + mi := &file_protobuf_list_values_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOfStrings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOfStrings) ProtoMessage() {} + +func (x *ListOfStrings) ProtoReflect() protoreflect.Message { + mi := &file_protobuf_list_values_proto_msgTypes[0] + 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 ListOfStrings.ProtoReflect.Descriptor instead. +func (*ListOfStrings) Descriptor() ([]byte, []int) { + return file_protobuf_list_values_proto_rawDescGZIP(), []int{0} +} + +func (x *ListOfStrings) GetValue() []string { + if x != nil { + return x.Value + } + return nil +} + +type ListOfFiles struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + File []*ListOfFiles_File `protobuf:"bytes,1,rep,name=file,proto3" json:"file,omitempty"` +} + +func (x *ListOfFiles) Reset() { + *x = ListOfFiles{} + if protoimpl.UnsafeEnabled { + mi := &file_protobuf_list_values_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOfFiles) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOfFiles) ProtoMessage() {} + +func (x *ListOfFiles) ProtoReflect() protoreflect.Message { + mi := &file_protobuf_list_values_proto_msgTypes[1] + 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 ListOfFiles.ProtoReflect.Descriptor instead. +func (*ListOfFiles) Descriptor() ([]byte, []int) { + return file_protobuf_list_values_proto_rawDescGZIP(), []int{1} +} + +func (x *ListOfFiles) GetFile() []*ListOfFiles_File { + if x != nil { + return x.File + } + return nil +} + +type ListOfBinaryes struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Value [][]byte `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` +} + +func (x *ListOfBinaryes) Reset() { + *x = ListOfBinaryes{} + if protoimpl.UnsafeEnabled { + mi := &file_protobuf_list_values_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOfBinaryes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOfBinaryes) ProtoMessage() {} + +func (x *ListOfBinaryes) ProtoReflect() protoreflect.Message { + mi := &file_protobuf_list_values_proto_msgTypes[2] + 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 ListOfBinaryes.ProtoReflect.Descriptor instead. +func (*ListOfBinaryes) Descriptor() ([]byte, []int) { + return file_protobuf_list_values_proto_rawDescGZIP(), []int{2} +} + +func (x *ListOfBinaryes) GetValue() [][]byte { + if x != nil { + return x.Value + } + return nil +} + +type ListOfFiles_File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + ContentType []string `protobuf:"bytes,2,rep,name=contentType,proto3" json:"contentType,omitempty"` + Size int64 `protobuf:"zigzag64,3,opt,name=size,proto3" json:"size,omitempty"` + Content []byte `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *ListOfFiles_File) Reset() { + *x = ListOfFiles_File{} + if protoimpl.UnsafeEnabled { + mi := &file_protobuf_list_values_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListOfFiles_File) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListOfFiles_File) ProtoMessage() {} + +func (x *ListOfFiles_File) ProtoReflect() protoreflect.Message { + mi := &file_protobuf_list_values_proto_msgTypes[3] + 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 ListOfFiles_File.ProtoReflect.Descriptor instead. +func (*ListOfFiles_File) Descriptor() ([]byte, []int) { + return file_protobuf_list_values_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *ListOfFiles_File) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *ListOfFiles_File) GetContentType() []string { + if x != nil { + return x.ContentType + } + return nil +} + +func (x *ListOfFiles_File) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *ListOfFiles_File) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +var File_protobuf_list_values_proto protoreflect.FileDescriptor + +var file_protobuf_list_values_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x2d, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x22, 0x25, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x66, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb0, 0x01, 0x0a, + 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x04, + 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x66, 0x46, 0x69, 0x6c, 0x65, 0x73, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x1a, 0x72, 0x0a, 0x04, 0x46, + 0x69, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x12, 0x52, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, + 0x26, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x66, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x65, + 0x73, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_protobuf_list_values_proto_rawDescOnce sync.Once + file_protobuf_list_values_proto_rawDescData = file_protobuf_list_values_proto_rawDesc +) + +func file_protobuf_list_values_proto_rawDescGZIP() []byte { + file_protobuf_list_values_proto_rawDescOnce.Do(func() { + file_protobuf_list_values_proto_rawDescData = protoimpl.X.CompressGZIP(file_protobuf_list_values_proto_rawDescData) + }) + return file_protobuf_list_values_proto_rawDescData +} + +var file_protobuf_list_values_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_protobuf_list_values_proto_goTypes = []interface{}{ + (*ListOfStrings)(nil), // 0: network.ListOfStrings + (*ListOfFiles)(nil), // 1: network.ListOfFiles + (*ListOfBinaryes)(nil), // 2: network.ListOfBinaryes + (*ListOfFiles_File)(nil), // 3: network.ListOfFiles.File +} +var file_protobuf_list_values_proto_depIdxs = []int32{ + 3, // 0: network.ListOfFiles.file:type_name -> network.ListOfFiles.File + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_protobuf_list_values_proto_init() } +func file_protobuf_list_values_proto_init() { + if File_protobuf_list_values_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_protobuf_list_values_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOfStrings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_protobuf_list_values_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOfFiles); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_protobuf_list_values_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOfBinaryes); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_protobuf_list_values_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListOfFiles_File); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_protobuf_list_values_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_protobuf_list_values_proto_goTypes, + DependencyIndexes: file_protobuf_list_values_proto_depIdxs, + MessageInfos: file_protobuf_list_values_proto_msgTypes, + }.Build() + File_protobuf_list_values_proto = out.File + file_protobuf_list_values_proto_rawDesc = nil + file_protobuf_list_values_proto_goTypes = nil + file_protobuf_list_values_proto_depIdxs = nil +} diff --git a/network/metadata.pb.go b/network/metadata.pb.go new file mode 100644 index 0000000..ed3d5b7 --- /dev/null +++ b/network/metadata.pb.go @@ -0,0 +1,252 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: protobuf/metadata.proto + +package network + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Metadata_PackageType int32 + +const ( + Metadata_TYPE_REQUEST Metadata_PackageType = 0 // Пакет запроса + Metadata_TYPE_RESPONSE Metadata_PackageType = 1 // Пакет ответа + Metadata_TYPE_STREAM Metadata_PackageType = 2 // Пакет потока, который не требует возврата результата (обратного вызова) +) + +// Enum value maps for Metadata_PackageType. +var ( + Metadata_PackageType_name = map[int32]string{ + 0: "TYPE_REQUEST", + 1: "TYPE_RESPONSE", + 2: "TYPE_STREAM", + } + Metadata_PackageType_value = map[string]int32{ + "TYPE_REQUEST": 0, + "TYPE_RESPONSE": 1, + "TYPE_STREAM": 2, + } +) + +func (x Metadata_PackageType) Enum() *Metadata_PackageType { + p := new(Metadata_PackageType) + *p = x + return p +} + +func (x Metadata_PackageType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Metadata_PackageType) Descriptor() protoreflect.EnumDescriptor { + return file_protobuf_metadata_proto_enumTypes[0].Descriptor() +} + +func (Metadata_PackageType) Type() protoreflect.EnumType { + return &file_protobuf_metadata_proto_enumTypes[0] +} + +func (x Metadata_PackageType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Metadata_PackageType.Descriptor instead. +func (Metadata_PackageType) EnumDescriptor() ([]byte, []int) { + return file_protobuf_metadata_proto_rawDescGZIP(), []int{0, 0} +} + +type Metadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PackageType Metadata_PackageType `protobuf:"varint,1,opt,name=packageType,proto3,enum=network.Metadata_PackageType" json:"packageType,omitempty"` + FuncName string `protobuf:"bytes,2,opt,name=funcName,proto3" json:"funcName,omitempty"` + QueueCallback string `protobuf:"bytes,3,opt,name=queueCallback,proto3" json:"queueCallback,omitempty"` + CallResponseID string `protobuf:"bytes,4,opt,name=callResponseID,proto3" json:"callResponseID,omitempty"` + CallID string `protobuf:"bytes,5,opt,name=callID,proto3" json:"callID,omitempty"` + CallFrom string `protobuf:"bytes,6,opt,name=callFrom,proto3" json:"callFrom,omitempty"` +} + +func (x *Metadata) Reset() { + *x = Metadata{} + if protoimpl.UnsafeEnabled { + mi := &file_protobuf_metadata_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Metadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Metadata) ProtoMessage() {} + +func (x *Metadata) ProtoReflect() protoreflect.Message { + mi := &file_protobuf_metadata_proto_msgTypes[0] + 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 Metadata.ProtoReflect.Descriptor instead. +func (*Metadata) Descriptor() ([]byte, []int) { + return file_protobuf_metadata_proto_rawDescGZIP(), []int{0} +} + +func (x *Metadata) GetPackageType() Metadata_PackageType { + if x != nil { + return x.PackageType + } + return Metadata_TYPE_REQUEST +} + +func (x *Metadata) GetFuncName() string { + if x != nil { + return x.FuncName + } + return "" +} + +func (x *Metadata) GetQueueCallback() string { + if x != nil { + return x.QueueCallback + } + return "" +} + +func (x *Metadata) GetCallResponseID() string { + if x != nil { + return x.CallResponseID + } + return "" +} + +func (x *Metadata) GetCallID() string { + if x != nil { + return x.CallID + } + return "" +} + +func (x *Metadata) GetCallFrom() string { + if x != nil { + return x.CallFrom + } + return "" +} + +var File_protobuf_metadata_proto protoreflect.FileDescriptor + +var file_protobuf_metadata_proto_rawDesc = []byte{ + 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x22, 0xae, 0x02, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x3f, 0x0a, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6e, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6e, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, + 0x71, 0x75, 0x65, 0x75, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x71, 0x75, 0x65, 0x75, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, + 0x63, 0x6b, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x61, 0x6c, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, + 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x6c, 0x6c, + 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x46, 0x72, 0x6f, 0x6d, 0x22, 0x43, + 0x0a, 0x0b, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, + 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x00, 0x12, + 0x11, 0x0a, 0x0d, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, + 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x52, 0x45, 0x41, + 0x4d, 0x10, 0x02, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_protobuf_metadata_proto_rawDescOnce sync.Once + file_protobuf_metadata_proto_rawDescData = file_protobuf_metadata_proto_rawDesc +) + +func file_protobuf_metadata_proto_rawDescGZIP() []byte { + file_protobuf_metadata_proto_rawDescOnce.Do(func() { + file_protobuf_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_protobuf_metadata_proto_rawDescData) + }) + return file_protobuf_metadata_proto_rawDescData +} + +var file_protobuf_metadata_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_protobuf_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_protobuf_metadata_proto_goTypes = []interface{}{ + (Metadata_PackageType)(0), // 0: network.Metadata.PackageType + (*Metadata)(nil), // 1: network.Metadata +} +var file_protobuf_metadata_proto_depIdxs = []int32{ + 0, // 0: network.Metadata.packageType:type_name -> network.Metadata.PackageType + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_protobuf_metadata_proto_init() } +func file_protobuf_metadata_proto_init() { + if File_protobuf_metadata_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_protobuf_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Metadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_protobuf_metadata_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_protobuf_metadata_proto_goTypes, + DependencyIndexes: file_protobuf_metadata_proto_depIdxs, + EnumInfos: file_protobuf_metadata_proto_enumTypes, + MessageInfos: file_protobuf_metadata_proto_msgTypes, + }.Build() + File_protobuf_metadata_proto = out.File + file_protobuf_metadata_proto_rawDesc = nil + file_protobuf_metadata_proto_goTypes = nil + file_protobuf_metadata_proto_depIdxs = nil +} diff --git a/network/multipart-form.pb.go b/network/multipart-form.pb.go new file mode 100644 index 0000000..0f069c5 --- /dev/null +++ b/network/multipart-form.pb.go @@ -0,0 +1,178 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.12.4 +// source: protobuf/multipart-form.proto + +package network + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MultipartForm struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Values map[string]*ListOfStrings `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Files map[string]*ListOfFiles `protobuf:"bytes,2,rep,name=files,proto3" json:"files,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *MultipartForm) Reset() { + *x = MultipartForm{} + if protoimpl.UnsafeEnabled { + mi := &file_protobuf_multipart_form_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MultipartForm) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MultipartForm) ProtoMessage() {} + +func (x *MultipartForm) ProtoReflect() protoreflect.Message { + mi := &file_protobuf_multipart_form_proto_msgTypes[0] + 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 MultipartForm.ProtoReflect.Descriptor instead. +func (*MultipartForm) Descriptor() ([]byte, []int) { + return file_protobuf_multipart_form_proto_rawDescGZIP(), []int{0} +} + +func (x *MultipartForm) GetValues() map[string]*ListOfStrings { + if x != nil { + return x.Values + } + return nil +} + +func (x *MultipartForm) GetFiles() map[string]*ListOfFiles { + if x != nil { + return x.Files + } + return nil +} + +var File_protobuf_multipart_form_proto protoreflect.FileDescriptor + +var file_protobuf_multipart_form_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x70, 0x61, 0x72, 0x74, 0x2d, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x1a, 0x1a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x2d, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa7, 0x02, 0x0a, 0x0d, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x61, + 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x12, 0x3a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x61, 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x2e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x12, 0x37, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x4d, 0x75, 0x6c, 0x74, + 0x69, 0x70, 0x61, 0x72, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x1a, 0x51, 0x0a, 0x0b, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x66, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4e, + 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x66, 0x46, 0x69, + 0x6c, 0x65, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0b, + 0x5a, 0x09, 0x2e, 0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_protobuf_multipart_form_proto_rawDescOnce sync.Once + file_protobuf_multipart_form_proto_rawDescData = file_protobuf_multipart_form_proto_rawDesc +) + +func file_protobuf_multipart_form_proto_rawDescGZIP() []byte { + file_protobuf_multipart_form_proto_rawDescOnce.Do(func() { + file_protobuf_multipart_form_proto_rawDescData = protoimpl.X.CompressGZIP(file_protobuf_multipart_form_proto_rawDescData) + }) + return file_protobuf_multipart_form_proto_rawDescData +} + +var file_protobuf_multipart_form_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_protobuf_multipart_form_proto_goTypes = []interface{}{ + (*MultipartForm)(nil), // 0: network.MultipartForm + nil, // 1: network.MultipartForm.ValuesEntry + nil, // 2: network.MultipartForm.FilesEntry + (*ListOfStrings)(nil), // 3: network.ListOfStrings + (*ListOfFiles)(nil), // 4: network.ListOfFiles +} +var file_protobuf_multipart_form_proto_depIdxs = []int32{ + 1, // 0: network.MultipartForm.values:type_name -> network.MultipartForm.ValuesEntry + 2, // 1: network.MultipartForm.files:type_name -> network.MultipartForm.FilesEntry + 3, // 2: network.MultipartForm.ValuesEntry.value:type_name -> network.ListOfStrings + 4, // 3: network.MultipartForm.FilesEntry.value:type_name -> network.ListOfFiles + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_protobuf_multipart_form_proto_init() } +func file_protobuf_multipart_form_proto_init() { + if File_protobuf_multipart_form_proto != nil { + return + } + file_protobuf_list_values_proto_init() + if !protoimpl.UnsafeEnabled { + file_protobuf_multipart_form_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MultipartForm); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_protobuf_multipart_form_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_protobuf_multipart_form_proto_goTypes, + DependencyIndexes: file_protobuf_multipart_form_proto_depIdxs, + MessageInfos: file_protobuf_multipart_form_proto_msgTypes, + }.Build() + File_protobuf_multipart_form_proto = out.File + file_protobuf_multipart_form_proto_rawDesc = nil + file_protobuf_multipart_form_proto_goTypes = nil + file_protobuf_multipart_form_proto_depIdxs = nil +} diff --git a/ytfunction.go b/ytfunction.go index 726e751..2c7ebd8 100644 --- a/ytfunction.go +++ b/ytfunction.go @@ -101,6 +101,7 @@ type Serve struct { NatsHost string NatsPort string nc *nats.Conn + hasNats bool projectName string moduleName string funcs map[string]funcDesc @@ -112,7 +113,7 @@ type Serve struct { accept map[string]map[string]bool } -func NewServe(host string, port string, projectName string, moduleName string) *Serve { +func NewServe(host string, port string, projectName string, moduleName string, natsServ *nats.Conn) *Serve { if strings.Trim(moduleName, " ") == "" { moduleName = "default" } else { @@ -126,8 +127,12 @@ func NewServe(host string, port string, projectName string, moduleName string) * } serve := &Serve{} - serve.NatsHost = host - serve.NatsPort = port + if natsServ != nil { + serve.nc = natsServ + } else { + serve.NatsHost = host + serve.NatsPort = port + } serve.projectName = projectName serve.moduleName = moduleName serve.funcs = make(map[string]funcDesc) @@ -189,9 +194,12 @@ func (serve *Serve) AddAcceptBool(ruleName string, allow bool) bool { } func (serve *Serve) Run() (err error) { - serve.nc, err = nats.Connect(fmt.Sprintf("nats://%s:%s", serve.NatsHost, serve.NatsPort)) - if err != nil { - return + if serve.nc == nil { + serve.nc, err = nats.Connect(fmt.Sprintf("nats://%s:%s", serve.NatsHost, serve.NatsPort)) + if err != nil { + return + } + serve.hasNats = true } rnd := make([]byte, 16) _, err = rand.Read(rnd) @@ -238,7 +246,9 @@ func (serve *Serve) Shutdown() { panic(err) } close(serve.chanQueueCallback) - serve.nc.Close() + if !serve.hasNats { + serve.nc.Close() + } } diff --git a/ytfunction_test.go b/ytfunction_test.go index 180f9f6..f0e0e85 100644 --- a/ytfunction_test.go +++ b/ytfunction_test.go @@ -13,7 +13,7 @@ func setup() { host, _ := os.LookupEnv("NATS_HOST") port, _ := os.LookupEnv("NATS_PORT") - serve = NewServe(host, port, "", "test") + serve = NewServe(host, port, "", "test", nil) if serve == nil { panic(fmt.Errorf(`serve is not created`)) }