From 7d803007f967442a561994f62d7bf94ba4feb278 Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 20 Sep 2023 16:00:21 +0300 Subject: [PATCH] Add timestamp to APIAlert --- protocol/alert.pb.go | 40 +++++++++++++++++++++++++--------------- protocol/alert.proto | 1 + 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/protocol/alert.pb.go b/protocol/alert.pb.go index 37a6e8eb..ca7d273d 100644 --- a/protocol/alert.pb.go +++ b/protocol/alert.pb.go @@ -1188,10 +1188,11 @@ type APIAlert struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Type AlertType `protobuf:"varint,2,opt,name=type,proto3,enum=network.forta.AlertType" json:"type,omitempty"` - Finding *Finding `protobuf:"bytes,3,opt,name=finding,proto3" json:"finding,omitempty"` - Agent *APIAlert_APIAlertAgent `protobuf:"bytes,4,opt,name=agent,proto3" json:"agent,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type AlertType `protobuf:"varint,2,opt,name=type,proto3,enum=network.forta.AlertType" json:"type,omitempty"` + Finding *Finding `protobuf:"bytes,3,opt,name=finding,proto3" json:"finding,omitempty"` + Agent *APIAlert_APIAlertAgent `protobuf:"bytes,4,opt,name=agent,proto3" json:"agent,omitempty"` + Timestamp string `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } func (x *APIAlert) Reset() { @@ -1254,6 +1255,13 @@ func (x *APIAlert) GetAgent() *APIAlert_APIAlertAgent { return nil } +func (x *APIAlert) GetTimestamp() string { + if x != nil { + return x.Timestamp + } + return "" +} + type Source_TransactionSource struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1836,7 +1844,7 @@ var file_alert_proto_rawDesc = []byte{ 0x43, 0x49, 0x4f, 0x55, 0x53, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x47, 0x52, 0x41, 0x44, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x43, 0x41, 0x4d, 0x10, 0x05, - 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x22, 0xd8, 0x01, 0x0a, 0x08, 0x41, 0x50, 0x49, 0x41, 0x6c, + 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x22, 0xf6, 0x01, 0x0a, 0x08, 0x41, 0x50, 0x49, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, 0x74, @@ -1848,16 +1856,18 @@ var file_alert_proto_rawDesc = []byte{ 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, 0x74, 0x61, 0x2e, 0x41, 0x50, 0x49, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x2e, 0x41, 0x50, 0x49, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x61, 0x67, 0x65, 0x6e, 0x74, - 0x1a, 0x1f, 0x0a, 0x0d, 0x41, 0x50, 0x49, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x41, 0x67, 0x65, 0x6e, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x2a, 0x66, 0x0a, 0x09, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, - 0x0a, 0x12, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x41, 0x4c, 0x45, 0x52, 0x54, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x41, - 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x4c, 0x4f, 0x43, 0x4b, - 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, - 0x0f, 0x0a, 0x0b, 0x43, 0x4f, 0x4d, 0x42, 0x49, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, - 0x12, 0x07, 0x0a, 0x03, 0x41, 0x50, 0x49, 0x10, 0x05, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x1a, 0x1f, + 0x0a, 0x0d, 0x41, 0x50, 0x49, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x2a, + 0x66, 0x0a, 0x09, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x41, 0x4c, 0x45, 0x52, 0x54, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x41, 0x43, 0x54, + 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x10, 0x02, + 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0f, 0x0a, + 0x0b, 0x43, 0x4f, 0x4d, 0x42, 0x49, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x12, 0x07, + 0x0a, 0x03, 0x41, 0x50, 0x49, 0x10, 0x05, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protocol/alert.proto b/protocol/alert.proto index 83c9e622..ff80c853 100644 --- a/protocol/alert.proto +++ b/protocol/alert.proto @@ -174,4 +174,5 @@ message APIAlert { AlertType type = 2; Finding finding = 3; APIAlertAgent agent = 4; + string timestamp = 5; } \ No newline at end of file