From 0a7e78725a2a23fc42c0b312c68df370fe29ca87 Mon Sep 17 00:00:00 2001 From: Yadian Llada Lopez Date: Thu, 25 Jun 2026 10:37:05 -0400 Subject: [PATCH 1/4] feat(agent-manager): add FORWARDER collector module --- agent-manager/agent/agent.pb.go | 2 +- agent-manager/agent/agent_grpc.pb.go | 24 ++++++++++++------------ agent-manager/agent/collector.pb.go | 18 +++++++++++------- agent-manager/agent/collector_grpc.pb.go | 12 ++++++------ agent-manager/agent/common.pb.go | 2 +- agent-manager/agent/ping.pb.go | 2 +- agent-manager/agent/ping_grpc.pb.go | 6 +++--- agent-manager/models/collector.go | 5 +++-- agent-manager/protos/collector.proto | 1 + 9 files changed, 39 insertions(+), 33 deletions(-) diff --git a/agent-manager/agent/agent.pb.go b/agent-manager/agent/agent.pb.go index 00397b161..943117b73 100644 --- a/agent-manager/agent/agent.pb.go +++ b/agent-manager/agent/agent.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.29.3 // source: agent.proto diff --git a/agent-manager/agent/agent_grpc.pb.go b/agent-manager/agent/agent_grpc.pb.go index 217da3aed..9a9c24eb9 100644 --- a/agent-manager/agent/agent_grpc.pb.go +++ b/agent-manager/agent/agent_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.2 // - protoc v5.29.3 // source: agent.proto @@ -131,22 +131,22 @@ type AgentServiceServer interface { type UnimplementedAgentServiceServer struct{} func (UnimplementedAgentServiceServer) RegisterAgent(context.Context, *AgentRequest) (*AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterAgent not implemented") + return nil, status.Error(codes.Unimplemented, "method RegisterAgent not implemented") } func (UnimplementedAgentServiceServer) UpdateAgent(context.Context, *AgentRequest) (*AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateAgent not implemented") + return nil, status.Error(codes.Unimplemented, "method UpdateAgent not implemented") } func (UnimplementedAgentServiceServer) DeleteAgent(context.Context, *DeleteRequest) (*AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteAgent not implemented") + return nil, status.Error(codes.Unimplemented, "method DeleteAgent not implemented") } func (UnimplementedAgentServiceServer) ListAgents(context.Context, *ListRequest) (*ListAgentsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAgents not implemented") + return nil, status.Error(codes.Unimplemented, "method ListAgents not implemented") } func (UnimplementedAgentServiceServer) AgentStream(grpc.BidiStreamingServer[BidirectionalStream, BidirectionalStream]) error { - return status.Errorf(codes.Unimplemented, "method AgentStream not implemented") + return status.Error(codes.Unimplemented, "method AgentStream not implemented") } func (UnimplementedAgentServiceServer) ListAgentCommands(context.Context, *ListRequest) (*ListAgentsCommandsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAgentCommands not implemented") + return nil, status.Error(codes.Unimplemented, "method ListAgentCommands not implemented") } func (UnimplementedAgentServiceServer) mustEmbedUnimplementedAgentServiceServer() {} func (UnimplementedAgentServiceServer) testEmbeddedByValue() {} @@ -159,7 +159,7 @@ type UnsafeAgentServiceServer interface { } func RegisterAgentServiceServer(s grpc.ServiceRegistrar, srv AgentServiceServer) { - // If the following call pancis, it indicates UnimplementedAgentServiceServer was + // If the following call panics, it indicates UnimplementedAgentServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. @@ -379,13 +379,13 @@ type PanelServiceServer interface { type UnimplementedPanelServiceServer struct{} func (UnimplementedPanelServiceServer) ProcessCommand(grpc.BidiStreamingServer[UtmCommand, CommandResult]) error { - return status.Errorf(codes.Unimplemented, "method ProcessCommand not implemented") + return status.Error(codes.Unimplemented, "method ProcessCommand not implemented") } func (UnimplementedPanelServiceServer) GetConnectionKey(context.Context, *ConnectionKeyRequest) (*ConnectionKeyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetConnectionKey not implemented") + return nil, status.Error(codes.Unimplemented, "method GetConnectionKey not implemented") } func (UnimplementedPanelServiceServer) RotateConnectionKey(context.Context, *ConnectionKeyRequest) (*ConnectionKeyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RotateConnectionKey not implemented") + return nil, status.Error(codes.Unimplemented, "method RotateConnectionKey not implemented") } func (UnimplementedPanelServiceServer) mustEmbedUnimplementedPanelServiceServer() {} func (UnimplementedPanelServiceServer) testEmbeddedByValue() {} @@ -398,7 +398,7 @@ type UnsafePanelServiceServer interface { } func RegisterPanelServiceServer(s grpc.ServiceRegistrar, srv PanelServiceServer) { - // If the following call pancis, it indicates UnimplementedPanelServiceServer was + // If the following call panics, it indicates UnimplementedPanelServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/agent-manager/agent/collector.pb.go b/agent-manager/agent/collector.pb.go index 8c115ab7e..8aeec4a7f 100644 --- a/agent-manager/agent/collector.pb.go +++ b/agent-manager/agent/collector.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.29.3 // source: collector.proto @@ -24,8 +24,9 @@ const ( type CollectorModule int32 const ( - CollectorModule_AS_400 CollectorModule = 0 - CollectorModule_UTMSTACK CollectorModule = 1 + CollectorModule_AS_400 CollectorModule = 0 + CollectorModule_UTMSTACK CollectorModule = 1 + CollectorModule_FORWARDER CollectorModule = 2 ) // Enum value maps for CollectorModule. @@ -33,10 +34,12 @@ var ( CollectorModule_name = map[int32]string{ 0: "AS_400", 1: "UTMSTACK", + 2: "FORWARDER", } CollectorModule_value = map[string]int32{ - "AS_400": 0, - "UTMSTACK": 1, + "AS_400": 0, + "UTMSTACK": 1, + "FORWARDER": 2, } ) @@ -708,11 +711,12 @@ const file_collector_proto_rawDesc = "" + "\x0fConfigKnowledge\x12\x1a\n" + "\baccepted\x18\x01 \x01(\tR\baccepted\x12\x1d\n" + "\n" + - "request_id\x18\x02 \x01(\tR\trequestId*+\n" + + "request_id\x18\x02 \x01(\tR\trequestId*:\n" + "\x0fCollectorModule\x12\n" + "\n" + "\x06AS_400\x10\x00\x12\f\n" + - "\bUTMSTACK\x10\x012\xa8\x02\n" + + "\bUTMSTACK\x10\x01\x12\r\n" + + "\tFORWARDER\x10\x022\xa8\x02\n" + "\x10CollectorService\x12B\n" + "\x11RegisterCollector\x12\x16.agent.RegisterRequest\x1a\x13.agent.AuthResponse\"\x00\x12>\n" + "\x0fDeleteCollector\x12\x14.agent.DeleteRequest\x1a\x13.agent.AuthResponse\"\x00\x12C\n" + diff --git a/agent-manager/agent/collector_grpc.pb.go b/agent-manager/agent/collector_grpc.pb.go index fbac45422..78b424adf 100644 --- a/agent-manager/agent/collector_grpc.pb.go +++ b/agent-manager/agent/collector_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.2 // - protoc v5.29.3 // source: collector.proto @@ -105,16 +105,16 @@ type CollectorServiceServer interface { type UnimplementedCollectorServiceServer struct{} func (UnimplementedCollectorServiceServer) RegisterCollector(context.Context, *RegisterRequest) (*AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterCollector not implemented") + return nil, status.Error(codes.Unimplemented, "method RegisterCollector not implemented") } func (UnimplementedCollectorServiceServer) DeleteCollector(context.Context, *DeleteRequest) (*AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteCollector not implemented") + return nil, status.Error(codes.Unimplemented, "method DeleteCollector not implemented") } func (UnimplementedCollectorServiceServer) ListCollector(context.Context, *ListRequest) (*ListCollectorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListCollector not implemented") + return nil, status.Error(codes.Unimplemented, "method ListCollector not implemented") } func (UnimplementedCollectorServiceServer) CollectorStream(grpc.BidiStreamingServer[CollectorMessages, CollectorMessages]) error { - return status.Errorf(codes.Unimplemented, "method CollectorStream not implemented") + return status.Error(codes.Unimplemented, "method CollectorStream not implemented") } func (UnimplementedCollectorServiceServer) mustEmbedUnimplementedCollectorServiceServer() {} func (UnimplementedCollectorServiceServer) testEmbeddedByValue() {} @@ -127,7 +127,7 @@ type UnsafeCollectorServiceServer interface { } func RegisterCollectorServiceServer(s grpc.ServiceRegistrar, srv CollectorServiceServer) { - // If the following call pancis, it indicates UnimplementedCollectorServiceServer was + // If the following call panics, it indicates UnimplementedCollectorServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/agent-manager/agent/common.pb.go b/agent-manager/agent/common.pb.go index 4407bccf4..17f83c2e7 100644 --- a/agent-manager/agent/common.pb.go +++ b/agent-manager/agent/common.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.29.3 // source: common.proto diff --git a/agent-manager/agent/ping.pb.go b/agent-manager/agent/ping.pb.go index b6f9787b9..cf4c0928e 100644 --- a/agent-manager/agent/ping.pb.go +++ b/agent-manager/agent/ping.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.29.3 // source: ping.proto diff --git a/agent-manager/agent/ping_grpc.pb.go b/agent-manager/agent/ping_grpc.pb.go index f3213500c..82ba1c783 100644 --- a/agent-manager/agent/ping_grpc.pb.go +++ b/agent-manager/agent/ping_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.2 // - protoc v5.29.3 // source: ping.proto @@ -66,7 +66,7 @@ type PingServiceServer interface { type UnimplementedPingServiceServer struct{} func (UnimplementedPingServiceServer) Ping(grpc.ClientStreamingServer[PingRequest, PingResponse]) error { - return status.Errorf(codes.Unimplemented, "method Ping not implemented") + return status.Error(codes.Unimplemented, "method Ping not implemented") } func (UnimplementedPingServiceServer) mustEmbedUnimplementedPingServiceServer() {} func (UnimplementedPingServiceServer) testEmbeddedByValue() {} @@ -79,7 +79,7 @@ type UnsafePingServiceServer interface { } func RegisterPingServiceServer(s grpc.ServiceRegistrar, srv PingServiceServer) { - // If the following call pancis, it indicates UnimplementedPingServiceServer was + // If the following call panics, it indicates UnimplementedPingServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/agent-manager/models/collector.go b/agent-manager/models/collector.go index ff4b084c7..aa1758780 100644 --- a/agent-manager/models/collector.go +++ b/agent-manager/models/collector.go @@ -5,8 +5,9 @@ import "gorm.io/gorm" type CollectorModule string const ( - AS_400 CollectorModule = "AS_400" - UTMSTACK CollectorModule = "UTMSTACK" + AS_400 CollectorModule = "AS_400" + UTMSTACK CollectorModule = "UTMSTACK" + FORWARDER CollectorModule = "FORWARDER" ) type Collector struct { diff --git a/agent-manager/protos/collector.proto b/agent-manager/protos/collector.proto index edf903268..370a3225c 100644 --- a/agent-manager/protos/collector.proto +++ b/agent-manager/protos/collector.proto @@ -15,6 +15,7 @@ service CollectorService { enum CollectorModule{ AS_400 = 0; UTMSTACK = 1; + FORWARDER = 2; } message RegisterRequest { From 36f8665645964534e2afdb90eeb2f9aff46d1869 Mon Sep 17 00:00:00 2001 From: Yadian Llada Lopez Date: Thu, 25 Jun 2026 10:38:15 -0400 Subject: [PATCH 2/4] feat(forwarder): replace agent grpc with collector grpc --- collectors/forwarder/upstream/agent.pb.go | 1016 ----------------- .../forwarder/upstream/agent_grpc.pb.go | 402 ------- collectors/forwarder/upstream/collector.pb.go | 807 +++++++++++++ .../forwarder/upstream/collector_grpc.pb.go | 230 ++++ collectors/forwarder/upstream/common.pb.go | 2 +- collectors/forwarder/upstream/ping.pb.go | 2 +- collectors/forwarder/upstream/ping_grpc.pb.go | 6 +- collectors/forwarder/upstream/register.go | 46 +- 8 files changed, 1074 insertions(+), 1437 deletions(-) delete mode 100644 collectors/forwarder/upstream/agent.pb.go delete mode 100644 collectors/forwarder/upstream/agent_grpc.pb.go create mode 100644 collectors/forwarder/upstream/collector.pb.go create mode 100644 collectors/forwarder/upstream/collector_grpc.pb.go diff --git a/collectors/forwarder/upstream/agent.pb.go b/collectors/forwarder/upstream/agent.pb.go deleted file mode 100644 index 9b74817ff..000000000 --- a/collectors/forwarder/upstream/agent.pb.go +++ /dev/null @@ -1,1016 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.10 -// protoc v5.29.3 -// source: agent.proto - -package upstream - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -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 AgentCommandStatus int32 - -const ( - AgentCommandStatus_NOT_EXECUTED AgentCommandStatus = 0 - AgentCommandStatus_QUEUE AgentCommandStatus = 1 - AgentCommandStatus_PENDING AgentCommandStatus = 2 - AgentCommandStatus_EXECUTED AgentCommandStatus = 3 - AgentCommandStatus_ERROR AgentCommandStatus = 4 -) - -// Enum value maps for AgentCommandStatus. -var ( - AgentCommandStatus_name = map[int32]string{ - 0: "NOT_EXECUTED", - 1: "QUEUE", - 2: "PENDING", - 3: "EXECUTED", - 4: "ERROR", - } - AgentCommandStatus_value = map[string]int32{ - "NOT_EXECUTED": 0, - "QUEUE": 1, - "PENDING": 2, - "EXECUTED": 3, - "ERROR": 4, - } -) - -func (x AgentCommandStatus) Enum() *AgentCommandStatus { - p := new(AgentCommandStatus) - *p = x - return p -} - -func (x AgentCommandStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (AgentCommandStatus) Descriptor() protoreflect.EnumDescriptor { - return file_agent_proto_enumTypes[0].Descriptor() -} - -func (AgentCommandStatus) Type() protoreflect.EnumType { - return &file_agent_proto_enumTypes[0] -} - -func (x AgentCommandStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use AgentCommandStatus.Descriptor instead. -func (AgentCommandStatus) EnumDescriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{0} -} - -type AgentRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` - Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"` - Os string `protobuf:"bytes,3,opt,name=os,proto3" json:"os,omitempty"` - Platform string `protobuf:"bytes,4,opt,name=platform,proto3" json:"platform,omitempty"` - Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` - RegisterBy string `protobuf:"bytes,6,opt,name=register_by,json=registerBy,proto3" json:"register_by,omitempty"` - Mac string `protobuf:"bytes,7,opt,name=mac,proto3" json:"mac,omitempty"` - OsMajorVersion string `protobuf:"bytes,8,opt,name=os_major_version,json=osMajorVersion,proto3" json:"os_major_version,omitempty"` - OsMinorVersion string `protobuf:"bytes,9,opt,name=os_minor_version,json=osMinorVersion,proto3" json:"os_minor_version,omitempty"` - Aliases string `protobuf:"bytes,10,opt,name=aliases,proto3" json:"aliases,omitempty"` - Addresses string `protobuf:"bytes,11,opt,name=addresses,proto3" json:"addresses,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AgentRequest) Reset() { - *x = AgentRequest{} - mi := &file_agent_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AgentRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AgentRequest) ProtoMessage() {} - -func (x *AgentRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AgentRequest.ProtoReflect.Descriptor instead. -func (*AgentRequest) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{0} -} - -func (x *AgentRequest) GetIp() string { - if x != nil { - return x.Ip - } - return "" -} - -func (x *AgentRequest) GetHostname() string { - if x != nil { - return x.Hostname - } - return "" -} - -func (x *AgentRequest) GetOs() string { - if x != nil { - return x.Os - } - return "" -} - -func (x *AgentRequest) GetPlatform() string { - if x != nil { - return x.Platform - } - return "" -} - -func (x *AgentRequest) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *AgentRequest) GetRegisterBy() string { - if x != nil { - return x.RegisterBy - } - return "" -} - -func (x *AgentRequest) GetMac() string { - if x != nil { - return x.Mac - } - return "" -} - -func (x *AgentRequest) GetOsMajorVersion() string { - if x != nil { - return x.OsMajorVersion - } - return "" -} - -func (x *AgentRequest) GetOsMinorVersion() string { - if x != nil { - return x.OsMinorVersion - } - return "" -} - -func (x *AgentRequest) GetAliases() string { - if x != nil { - return x.Aliases - } - return "" -} - -func (x *AgentRequest) GetAddresses() string { - if x != nil { - return x.Addresses - } - return "" -} - -type ListAgentsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Rows []*Agent `protobuf:"bytes,1,rep,name=rows,proto3" json:"rows,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAgentsResponse) Reset() { - *x = ListAgentsResponse{} - mi := &file_agent_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAgentsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAgentsResponse) ProtoMessage() {} - -func (x *ListAgentsResponse) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAgentsResponse.ProtoReflect.Descriptor instead. -func (*ListAgentsResponse) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{1} -} - -func (x *ListAgentsResponse) GetRows() []*Agent { - if x != nil { - return x.Rows - } - return nil -} - -func (x *ListAgentsResponse) GetTotal() int32 { - if x != nil { - return x.Total - } - return 0 -} - -type Agent struct { - state protoimpl.MessageState `protogen:"open.v1"` - Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` - Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"` - Os string `protobuf:"bytes,3,opt,name=os,proto3" json:"os,omitempty"` - Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=agent.Status" json:"status,omitempty"` - Platform string `protobuf:"bytes,5,opt,name=platform,proto3" json:"platform,omitempty"` - Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` - AgentKey string `protobuf:"bytes,7,opt,name=agent_key,json=agentKey,proto3" json:"agent_key,omitempty"` - Id uint32 `protobuf:"varint,8,opt,name=id,proto3" json:"id,omitempty"` - LastSeen string `protobuf:"bytes,9,opt,name=last_seen,json=lastSeen,proto3" json:"last_seen,omitempty"` - Mac string `protobuf:"bytes,10,opt,name=mac,proto3" json:"mac,omitempty"` - OsMajorVersion string `protobuf:"bytes,11,opt,name=os_major_version,json=osMajorVersion,proto3" json:"os_major_version,omitempty"` - OsMinorVersion string `protobuf:"bytes,12,opt,name=os_minor_version,json=osMinorVersion,proto3" json:"os_minor_version,omitempty"` - Aliases string `protobuf:"bytes,13,opt,name=aliases,proto3" json:"aliases,omitempty"` - Addresses string `protobuf:"bytes,14,opt,name=addresses,proto3" json:"addresses,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Agent) Reset() { - *x = Agent{} - mi := &file_agent_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Agent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Agent) ProtoMessage() {} - -func (x *Agent) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Agent.ProtoReflect.Descriptor instead. -func (*Agent) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{2} -} - -func (x *Agent) GetIp() string { - if x != nil { - return x.Ip - } - return "" -} - -func (x *Agent) GetHostname() string { - if x != nil { - return x.Hostname - } - return "" -} - -func (x *Agent) GetOs() string { - if x != nil { - return x.Os - } - return "" -} - -func (x *Agent) GetStatus() Status { - if x != nil { - return x.Status - } - return Status_ONLINE -} - -func (x *Agent) GetPlatform() string { - if x != nil { - return x.Platform - } - return "" -} - -func (x *Agent) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *Agent) GetAgentKey() string { - if x != nil { - return x.AgentKey - } - return "" -} - -func (x *Agent) GetId() uint32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Agent) GetLastSeen() string { - if x != nil { - return x.LastSeen - } - return "" -} - -func (x *Agent) GetMac() string { - if x != nil { - return x.Mac - } - return "" -} - -func (x *Agent) GetOsMajorVersion() string { - if x != nil { - return x.OsMajorVersion - } - return "" -} - -func (x *Agent) GetOsMinorVersion() string { - if x != nil { - return x.OsMinorVersion - } - return "" -} - -func (x *Agent) GetAliases() string { - if x != nil { - return x.Aliases - } - return "" -} - -func (x *Agent) GetAddresses() string { - if x != nil { - return x.Addresses - } - return "" -} - -type BidirectionalStream struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to StreamMessage: - // - // *BidirectionalStream_Command - // *BidirectionalStream_Result - StreamMessage isBidirectionalStream_StreamMessage `protobuf_oneof:"stream_message"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BidirectionalStream) Reset() { - *x = BidirectionalStream{} - mi := &file_agent_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BidirectionalStream) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BidirectionalStream) ProtoMessage() {} - -func (x *BidirectionalStream) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BidirectionalStream.ProtoReflect.Descriptor instead. -func (*BidirectionalStream) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{3} -} - -func (x *BidirectionalStream) GetStreamMessage() isBidirectionalStream_StreamMessage { - if x != nil { - return x.StreamMessage - } - return nil -} - -func (x *BidirectionalStream) GetCommand() *UtmCommand { - if x != nil { - if x, ok := x.StreamMessage.(*BidirectionalStream_Command); ok { - return x.Command - } - } - return nil -} - -func (x *BidirectionalStream) GetResult() *CommandResult { - if x != nil { - if x, ok := x.StreamMessage.(*BidirectionalStream_Result); ok { - return x.Result - } - } - return nil -} - -type isBidirectionalStream_StreamMessage interface { - isBidirectionalStream_StreamMessage() -} - -type BidirectionalStream_Command struct { - Command *UtmCommand `protobuf:"bytes,1,opt,name=command,proto3,oneof"` -} - -type BidirectionalStream_Result struct { - Result *CommandResult `protobuf:"bytes,2,opt,name=result,proto3,oneof"` -} - -func (*BidirectionalStream_Command) isBidirectionalStream_StreamMessage() {} - -func (*BidirectionalStream_Result) isBidirectionalStream_StreamMessage() {} - -type UtmCommand struct { - state protoimpl.MessageState `protogen:"open.v1"` - AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` - Command string `protobuf:"bytes,2,opt,name=command,proto3" json:"command,omitempty"` - ExecutedBy string `protobuf:"bytes,3,opt,name=executed_by,json=executedBy,proto3" json:"executed_by,omitempty"` - CmdId string `protobuf:"bytes,4,opt,name=cmd_id,json=cmdId,proto3" json:"cmd_id,omitempty"` - OriginType string `protobuf:"bytes,5,opt,name=origin_type,json=originType,proto3" json:"origin_type,omitempty"` - OriginId string `protobuf:"bytes,6,opt,name=origin_id,json=originId,proto3" json:"origin_id,omitempty"` - Reason string `protobuf:"bytes,7,opt,name=reason,proto3" json:"reason,omitempty"` - Shell string `protobuf:"bytes,8,opt,name=shell,proto3" json:"shell,omitempty"` // Shell to execute command - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *UtmCommand) Reset() { - *x = UtmCommand{} - mi := &file_agent_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *UtmCommand) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UtmCommand) ProtoMessage() {} - -func (x *UtmCommand) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UtmCommand.ProtoReflect.Descriptor instead. -func (*UtmCommand) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{4} -} - -func (x *UtmCommand) GetAgentId() string { - if x != nil { - return x.AgentId - } - return "" -} - -func (x *UtmCommand) GetCommand() string { - if x != nil { - return x.Command - } - return "" -} - -func (x *UtmCommand) GetExecutedBy() string { - if x != nil { - return x.ExecutedBy - } - return "" -} - -func (x *UtmCommand) GetCmdId() string { - if x != nil { - return x.CmdId - } - return "" -} - -func (x *UtmCommand) GetOriginType() string { - if x != nil { - return x.OriginType - } - return "" -} - -func (x *UtmCommand) GetOriginId() string { - if x != nil { - return x.OriginId - } - return "" -} - -func (x *UtmCommand) GetReason() string { - if x != nil { - return x.Reason - } - return "" -} - -func (x *UtmCommand) GetShell() string { - if x != nil { - return x.Shell - } - return "" -} - -type CommandResult struct { - state protoimpl.MessageState `protogen:"open.v1"` - AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` - Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` - ExecutedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=executed_at,json=executedAt,proto3" json:"executed_at,omitempty"` - CmdId string `protobuf:"bytes,4,opt,name=cmd_id,json=cmdId,proto3" json:"cmd_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CommandResult) Reset() { - *x = CommandResult{} - mi := &file_agent_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CommandResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommandResult) ProtoMessage() {} - -func (x *CommandResult) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommandResult.ProtoReflect.Descriptor instead. -func (*CommandResult) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{5} -} - -func (x *CommandResult) GetAgentId() string { - if x != nil { - return x.AgentId - } - return "" -} - -func (x *CommandResult) GetResult() string { - if x != nil { - return x.Result - } - return "" -} - -func (x *CommandResult) GetExecutedAt() *timestamppb.Timestamp { - if x != nil { - return x.ExecutedAt - } - return nil -} - -func (x *CommandResult) GetCmdId() string { - if x != nil { - return x.CmdId - } - return "" -} - -type ListAgentsCommandsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Rows []*AgentCommand `protobuf:"bytes,1,rep,name=rows,proto3" json:"rows,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ListAgentsCommandsResponse) Reset() { - *x = ListAgentsCommandsResponse{} - mi := &file_agent_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ListAgentsCommandsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListAgentsCommandsResponse) ProtoMessage() {} - -func (x *ListAgentsCommandsResponse) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListAgentsCommandsResponse.ProtoReflect.Descriptor instead. -func (*ListAgentsCommandsResponse) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{6} -} - -func (x *ListAgentsCommandsResponse) GetRows() []*AgentCommand { - if x != nil { - return x.Rows - } - return nil -} - -func (x *ListAgentsCommandsResponse) GetTotal() int32 { - if x != nil { - return x.Total - } - return 0 -} - -type AgentCommand struct { - state protoimpl.MessageState `protogen:"open.v1"` - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` - AgentId uint32 `protobuf:"varint,3,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` - Command string `protobuf:"bytes,4,opt,name=command,proto3" json:"command,omitempty"` - CommandStatus AgentCommandStatus `protobuf:"varint,5,opt,name=command_status,json=commandStatus,proto3,enum=agent.AgentCommandStatus" json:"command_status,omitempty"` - Result string `protobuf:"bytes,6,opt,name=result,proto3" json:"result,omitempty"` - ExecutedBy string `protobuf:"bytes,7,opt,name=executed_by,json=executedBy,proto3" json:"executed_by,omitempty"` - CmdId string `protobuf:"bytes,8,opt,name=cmd_id,json=cmdId,proto3" json:"cmd_id,omitempty"` - Reason string `protobuf:"bytes,9,opt,name=reason,proto3" json:"reason,omitempty"` - OriginType string `protobuf:"bytes,10,opt,name=origin_type,json=originType,proto3" json:"origin_type,omitempty"` - OriginId string `protobuf:"bytes,11,opt,name=origin_id,json=originId,proto3" json:"origin_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AgentCommand) Reset() { - *x = AgentCommand{} - mi := &file_agent_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AgentCommand) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AgentCommand) ProtoMessage() {} - -func (x *AgentCommand) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AgentCommand.ProtoReflect.Descriptor instead. -func (*AgentCommand) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{7} -} - -func (x *AgentCommand) GetCreatedAt() *timestamppb.Timestamp { - if x != nil { - return x.CreatedAt - } - return nil -} - -func (x *AgentCommand) GetUpdatedAt() *timestamppb.Timestamp { - if x != nil { - return x.UpdatedAt - } - return nil -} - -func (x *AgentCommand) GetAgentId() uint32 { - if x != nil { - return x.AgentId - } - return 0 -} - -func (x *AgentCommand) GetCommand() string { - if x != nil { - return x.Command - } - return "" -} - -func (x *AgentCommand) GetCommandStatus() AgentCommandStatus { - if x != nil { - return x.CommandStatus - } - return AgentCommandStatus_NOT_EXECUTED -} - -func (x *AgentCommand) GetResult() string { - if x != nil { - return x.Result - } - return "" -} - -func (x *AgentCommand) GetExecutedBy() string { - if x != nil { - return x.ExecutedBy - } - return "" -} - -func (x *AgentCommand) GetCmdId() string { - if x != nil { - return x.CmdId - } - return "" -} - -func (x *AgentCommand) GetReason() string { - if x != nil { - return x.Reason - } - return "" -} - -func (x *AgentCommand) GetOriginType() string { - if x != nil { - return x.OriginType - } - return "" -} - -func (x *AgentCommand) GetOriginId() string { - if x != nil { - return x.OriginId - } - return "" -} - -var File_agent_proto protoreflect.FileDescriptor - -const file_agent_proto_rawDesc = "" + - "\n" + - "\vagent.proto\x12\x05agent\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\fcommon.proto\"\xbf\x02\n" + - "\fAgentRequest\x12\x0e\n" + - "\x02ip\x18\x01 \x01(\tR\x02ip\x12\x1a\n" + - "\bhostname\x18\x02 \x01(\tR\bhostname\x12\x0e\n" + - "\x02os\x18\x03 \x01(\tR\x02os\x12\x1a\n" + - "\bplatform\x18\x04 \x01(\tR\bplatform\x12\x18\n" + - "\aversion\x18\x05 \x01(\tR\aversion\x12\x1f\n" + - "\vregister_by\x18\x06 \x01(\tR\n" + - "registerBy\x12\x10\n" + - "\x03mac\x18\a \x01(\tR\x03mac\x12(\n" + - "\x10os_major_version\x18\b \x01(\tR\x0eosMajorVersion\x12(\n" + - "\x10os_minor_version\x18\t \x01(\tR\x0eosMinorVersion\x12\x18\n" + - "\aaliases\x18\n" + - " \x01(\tR\aaliases\x12\x1c\n" + - "\taddresses\x18\v \x01(\tR\taddresses\"L\n" + - "\x12ListAgentsResponse\x12 \n" + - "\x04rows\x18\x01 \x03(\v2\f.agent.AgentR\x04rows\x12\x14\n" + - "\x05total\x18\x02 \x01(\x05R\x05total\"\x88\x03\n" + - "\x05Agent\x12\x0e\n" + - "\x02ip\x18\x01 \x01(\tR\x02ip\x12\x1a\n" + - "\bhostname\x18\x02 \x01(\tR\bhostname\x12\x0e\n" + - "\x02os\x18\x03 \x01(\tR\x02os\x12%\n" + - "\x06status\x18\x04 \x01(\x0e2\r.agent.StatusR\x06status\x12\x1a\n" + - "\bplatform\x18\x05 \x01(\tR\bplatform\x12\x18\n" + - "\aversion\x18\x06 \x01(\tR\aversion\x12\x1b\n" + - "\tagent_key\x18\a \x01(\tR\bagentKey\x12\x0e\n" + - "\x02id\x18\b \x01(\rR\x02id\x12\x1b\n" + - "\tlast_seen\x18\t \x01(\tR\blastSeen\x12\x10\n" + - "\x03mac\x18\n" + - " \x01(\tR\x03mac\x12(\n" + - "\x10os_major_version\x18\v \x01(\tR\x0eosMajorVersion\x12(\n" + - "\x10os_minor_version\x18\f \x01(\tR\x0eosMinorVersion\x12\x18\n" + - "\aaliases\x18\r \x01(\tR\aaliases\x12\x1c\n" + - "\taddresses\x18\x0e \x01(\tR\taddresses\"\x86\x01\n" + - "\x13BidirectionalStream\x12-\n" + - "\acommand\x18\x01 \x01(\v2\x11.agent.UtmCommandH\x00R\acommand\x12.\n" + - "\x06result\x18\x02 \x01(\v2\x14.agent.CommandResultH\x00R\x06resultB\x10\n" + - "\x0estream_message\"\xe5\x01\n" + - "\n" + - "UtmCommand\x12\x19\n" + - "\bagent_id\x18\x01 \x01(\tR\aagentId\x12\x18\n" + - "\acommand\x18\x02 \x01(\tR\acommand\x12\x1f\n" + - "\vexecuted_by\x18\x03 \x01(\tR\n" + - "executedBy\x12\x15\n" + - "\x06cmd_id\x18\x04 \x01(\tR\x05cmdId\x12\x1f\n" + - "\vorigin_type\x18\x05 \x01(\tR\n" + - "originType\x12\x1b\n" + - "\torigin_id\x18\x06 \x01(\tR\boriginId\x12\x16\n" + - "\x06reason\x18\a \x01(\tR\x06reason\x12\x14\n" + - "\x05shell\x18\b \x01(\tR\x05shell\"\x96\x01\n" + - "\rCommandResult\x12\x19\n" + - "\bagent_id\x18\x01 \x01(\tR\aagentId\x12\x16\n" + - "\x06result\x18\x02 \x01(\tR\x06result\x12;\n" + - "\vexecuted_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\n" + - "executedAt\x12\x15\n" + - "\x06cmd_id\x18\x04 \x01(\tR\x05cmdId\"[\n" + - "\x1aListAgentsCommandsResponse\x12'\n" + - "\x04rows\x18\x01 \x03(\v2\x13.agent.AgentCommandR\x04rows\x12\x14\n" + - "\x05total\x18\x02 \x01(\x05R\x05total\"\xa1\x03\n" + - "\fAgentCommand\x129\n" + - "\n" + - "created_at\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + - "\n" + - "updated_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\x12\x19\n" + - "\bagent_id\x18\x03 \x01(\rR\aagentId\x12\x18\n" + - "\acommand\x18\x04 \x01(\tR\acommand\x12@\n" + - "\x0ecommand_status\x18\x05 \x01(\x0e2\x19.agent.AgentCommandStatusR\rcommandStatus\x12\x16\n" + - "\x06result\x18\x06 \x01(\tR\x06result\x12\x1f\n" + - "\vexecuted_by\x18\a \x01(\tR\n" + - "executedBy\x12\x15\n" + - "\x06cmd_id\x18\b \x01(\tR\x05cmdId\x12\x16\n" + - "\x06reason\x18\t \x01(\tR\x06reason\x12\x1f\n" + - "\vorigin_type\x18\n" + - " \x01(\tR\n" + - "originType\x12\x1b\n" + - "\torigin_id\x18\v \x01(\tR\boriginId*W\n" + - "\x12AgentCommandStatus\x12\x10\n" + - "\fNOT_EXECUTED\x10\x00\x12\t\n" + - "\x05QUEUE\x10\x01\x12\v\n" + - "\aPENDING\x10\x02\x12\f\n" + - "\bEXECUTED\x10\x03\x12\t\n" + - "\x05ERROR\x10\x042\x9c\x03\n" + - "\fAgentService\x12;\n" + - "\rRegisterAgent\x12\x13.agent.AgentRequest\x1a\x13.agent.AuthResponse\"\x00\x129\n" + - "\vUpdateAgent\x12\x13.agent.AgentRequest\x1a\x13.agent.AuthResponse\"\x00\x12:\n" + - "\vDeleteAgent\x12\x14.agent.DeleteRequest\x1a\x13.agent.AuthResponse\"\x00\x12=\n" + - "\n" + - "ListAgents\x12\x12.agent.ListRequest\x1a\x19.agent.ListAgentsResponse\"\x00\x12K\n" + - "\vAgentStream\x12\x1a.agent.BidirectionalStream\x1a\x1a.agent.BidirectionalStream\"\x00(\x010\x01\x12L\n" + - "\x11ListAgentCommands\x12\x12.agent.ListRequest\x1a!.agent.ListAgentsCommandsResponse\"\x002O\n" + - "\fPanelService\x12?\n" + - "\x0eProcessCommand\x12\x11.agent.UtmCommand\x1a\x14.agent.CommandResult\"\x00(\x010\x01B2Z0github.com/utmstack/UTMStack/agent-manager/agentb\x06proto3" - -var ( - file_agent_proto_rawDescOnce sync.Once - file_agent_proto_rawDescData []byte -) - -func file_agent_proto_rawDescGZIP() []byte { - file_agent_proto_rawDescOnce.Do(func() { - file_agent_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_agent_proto_rawDesc), len(file_agent_proto_rawDesc))) - }) - return file_agent_proto_rawDescData -} - -var file_agent_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_agent_proto_goTypes = []any{ - (AgentCommandStatus)(0), // 0: agent.AgentCommandStatus - (*AgentRequest)(nil), // 1: agent.AgentRequest - (*ListAgentsResponse)(nil), // 2: agent.ListAgentsResponse - (*Agent)(nil), // 3: agent.Agent - (*BidirectionalStream)(nil), // 4: agent.BidirectionalStream - (*UtmCommand)(nil), // 5: agent.UtmCommand - (*CommandResult)(nil), // 6: agent.CommandResult - (*ListAgentsCommandsResponse)(nil), // 7: agent.ListAgentsCommandsResponse - (*AgentCommand)(nil), // 8: agent.AgentCommand - (Status)(0), // 9: agent.Status - (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp - (*DeleteRequest)(nil), // 11: agent.DeleteRequest - (*ListRequest)(nil), // 12: agent.ListRequest - (*AuthResponse)(nil), // 13: agent.AuthResponse -} -var file_agent_proto_depIdxs = []int32{ - 3, // 0: agent.ListAgentsResponse.rows:type_name -> agent.Agent - 9, // 1: agent.Agent.status:type_name -> agent.Status - 5, // 2: agent.BidirectionalStream.command:type_name -> agent.UtmCommand - 6, // 3: agent.BidirectionalStream.result:type_name -> agent.CommandResult - 10, // 4: agent.CommandResult.executed_at:type_name -> google.protobuf.Timestamp - 8, // 5: agent.ListAgentsCommandsResponse.rows:type_name -> agent.AgentCommand - 10, // 6: agent.AgentCommand.created_at:type_name -> google.protobuf.Timestamp - 10, // 7: agent.AgentCommand.updated_at:type_name -> google.protobuf.Timestamp - 0, // 8: agent.AgentCommand.command_status:type_name -> agent.AgentCommandStatus - 1, // 9: agent.AgentService.RegisterAgent:input_type -> agent.AgentRequest - 1, // 10: agent.AgentService.UpdateAgent:input_type -> agent.AgentRequest - 11, // 11: agent.AgentService.DeleteAgent:input_type -> agent.DeleteRequest - 12, // 12: agent.AgentService.ListAgents:input_type -> agent.ListRequest - 4, // 13: agent.AgentService.AgentStream:input_type -> agent.BidirectionalStream - 12, // 14: agent.AgentService.ListAgentCommands:input_type -> agent.ListRequest - 5, // 15: agent.PanelService.ProcessCommand:input_type -> agent.UtmCommand - 13, // 16: agent.AgentService.RegisterAgent:output_type -> agent.AuthResponse - 13, // 17: agent.AgentService.UpdateAgent:output_type -> agent.AuthResponse - 13, // 18: agent.AgentService.DeleteAgent:output_type -> agent.AuthResponse - 2, // 19: agent.AgentService.ListAgents:output_type -> agent.ListAgentsResponse - 4, // 20: agent.AgentService.AgentStream:output_type -> agent.BidirectionalStream - 7, // 21: agent.AgentService.ListAgentCommands:output_type -> agent.ListAgentsCommandsResponse - 6, // 22: agent.PanelService.ProcessCommand:output_type -> agent.CommandResult - 16, // [16:23] is the sub-list for method output_type - 9, // [9:16] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_agent_proto_init() } -func file_agent_proto_init() { - if File_agent_proto != nil { - return - } - file_common_proto_init() - file_agent_proto_msgTypes[3].OneofWrappers = []any{ - (*BidirectionalStream_Command)(nil), - (*BidirectionalStream_Result)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_agent_proto_rawDesc), len(file_agent_proto_rawDesc)), - NumEnums: 1, - NumMessages: 8, - NumExtensions: 0, - NumServices: 2, - }, - GoTypes: file_agent_proto_goTypes, - DependencyIndexes: file_agent_proto_depIdxs, - EnumInfos: file_agent_proto_enumTypes, - MessageInfos: file_agent_proto_msgTypes, - }.Build() - File_agent_proto = out.File - file_agent_proto_goTypes = nil - file_agent_proto_depIdxs = nil -} diff --git a/collectors/forwarder/upstream/agent_grpc.pb.go b/collectors/forwarder/upstream/agent_grpc.pb.go deleted file mode 100644 index 92a8f78a0..000000000 --- a/collectors/forwarder/upstream/agent_grpc.pb.go +++ /dev/null @@ -1,402 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc v5.29.3 -// source: agent.proto - -package upstream - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - AgentService_RegisterAgent_FullMethodName = "/agent.AgentService/RegisterAgent" - AgentService_UpdateAgent_FullMethodName = "/agent.AgentService/UpdateAgent" - AgentService_DeleteAgent_FullMethodName = "/agent.AgentService/DeleteAgent" - AgentService_ListAgents_FullMethodName = "/agent.AgentService/ListAgents" - AgentService_AgentStream_FullMethodName = "/agent.AgentService/AgentStream" - AgentService_ListAgentCommands_FullMethodName = "/agent.AgentService/ListAgentCommands" -) - -// AgentServiceClient is the client API for AgentService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type AgentServiceClient interface { - RegisterAgent(ctx context.Context, in *AgentRequest, opts ...grpc.CallOption) (*AuthResponse, error) - UpdateAgent(ctx context.Context, in *AgentRequest, opts ...grpc.CallOption) (*AuthResponse, error) - DeleteAgent(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*AuthResponse, error) - ListAgents(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListAgentsResponse, error) - AgentStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BidirectionalStream, BidirectionalStream], error) - ListAgentCommands(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListAgentsCommandsResponse, error) -} - -type agentServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewAgentServiceClient(cc grpc.ClientConnInterface) AgentServiceClient { - return &agentServiceClient{cc} -} - -func (c *agentServiceClient) RegisterAgent(ctx context.Context, in *AgentRequest, opts ...grpc.CallOption) (*AuthResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AuthResponse) - err := c.cc.Invoke(ctx, AgentService_RegisterAgent_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *agentServiceClient) UpdateAgent(ctx context.Context, in *AgentRequest, opts ...grpc.CallOption) (*AuthResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AuthResponse) - err := c.cc.Invoke(ctx, AgentService_UpdateAgent_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *agentServiceClient) DeleteAgent(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*AuthResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AuthResponse) - err := c.cc.Invoke(ctx, AgentService_DeleteAgent_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *agentServiceClient) ListAgents(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListAgentsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListAgentsResponse) - err := c.cc.Invoke(ctx, AgentService_ListAgents_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *agentServiceClient) AgentStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BidirectionalStream, BidirectionalStream], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &AgentService_ServiceDesc.Streams[0], AgentService_AgentStream_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &grpc.GenericClientStream[BidirectionalStream, BidirectionalStream]{ClientStream: stream} - return x, nil -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type AgentService_AgentStreamClient = grpc.BidiStreamingClient[BidirectionalStream, BidirectionalStream] - -func (c *agentServiceClient) ListAgentCommands(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListAgentsCommandsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ListAgentsCommandsResponse) - err := c.cc.Invoke(ctx, AgentService_ListAgentCommands_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AgentServiceServer is the server API for AgentService service. -// All implementations must embed UnimplementedAgentServiceServer -// for forward compatibility. -type AgentServiceServer interface { - RegisterAgent(context.Context, *AgentRequest) (*AuthResponse, error) - UpdateAgent(context.Context, *AgentRequest) (*AuthResponse, error) - DeleteAgent(context.Context, *DeleteRequest) (*AuthResponse, error) - ListAgents(context.Context, *ListRequest) (*ListAgentsResponse, error) - AgentStream(grpc.BidiStreamingServer[BidirectionalStream, BidirectionalStream]) error - ListAgentCommands(context.Context, *ListRequest) (*ListAgentsCommandsResponse, error) - mustEmbedUnimplementedAgentServiceServer() -} - -// UnimplementedAgentServiceServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedAgentServiceServer struct{} - -func (UnimplementedAgentServiceServer) RegisterAgent(context.Context, *AgentRequest) (*AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterAgent not implemented") -} -func (UnimplementedAgentServiceServer) UpdateAgent(context.Context, *AgentRequest) (*AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateAgent not implemented") -} -func (UnimplementedAgentServiceServer) DeleteAgent(context.Context, *DeleteRequest) (*AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteAgent not implemented") -} -func (UnimplementedAgentServiceServer) ListAgents(context.Context, *ListRequest) (*ListAgentsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAgents not implemented") -} -func (UnimplementedAgentServiceServer) AgentStream(grpc.BidiStreamingServer[BidirectionalStream, BidirectionalStream]) error { - return status.Errorf(codes.Unimplemented, "method AgentStream not implemented") -} -func (UnimplementedAgentServiceServer) ListAgentCommands(context.Context, *ListRequest) (*ListAgentsCommandsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAgentCommands not implemented") -} -func (UnimplementedAgentServiceServer) mustEmbedUnimplementedAgentServiceServer() {} -func (UnimplementedAgentServiceServer) testEmbeddedByValue() {} - -// UnsafeAgentServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to AgentServiceServer will -// result in compilation errors. -type UnsafeAgentServiceServer interface { - mustEmbedUnimplementedAgentServiceServer() -} - -func RegisterAgentServiceServer(s grpc.ServiceRegistrar, srv AgentServiceServer) { - // If the following call pancis, it indicates UnimplementedAgentServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&AgentService_ServiceDesc, srv) -} - -func _AgentService_RegisterAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AgentRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AgentServiceServer).RegisterAgent(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AgentService_RegisterAgent_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServiceServer).RegisterAgent(ctx, req.(*AgentRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AgentService_UpdateAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AgentRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AgentServiceServer).UpdateAgent(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AgentService_UpdateAgent_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServiceServer).UpdateAgent(ctx, req.(*AgentRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AgentService_DeleteAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AgentServiceServer).DeleteAgent(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AgentService_DeleteAgent_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServiceServer).DeleteAgent(ctx, req.(*DeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AgentService_ListAgents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AgentServiceServer).ListAgents(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AgentService_ListAgents_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServiceServer).ListAgents(ctx, req.(*ListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AgentService_AgentStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AgentServiceServer).AgentStream(&grpc.GenericServerStream[BidirectionalStream, BidirectionalStream]{ServerStream: stream}) -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type AgentService_AgentStreamServer = grpc.BidiStreamingServer[BidirectionalStream, BidirectionalStream] - -func _AgentService_ListAgentCommands_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AgentServiceServer).ListAgentCommands(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AgentService_ListAgentCommands_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServiceServer).ListAgentCommands(ctx, req.(*ListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// AgentService_ServiceDesc is the grpc.ServiceDesc for AgentService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var AgentService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "agent.AgentService", - HandlerType: (*AgentServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "RegisterAgent", - Handler: _AgentService_RegisterAgent_Handler, - }, - { - MethodName: "UpdateAgent", - Handler: _AgentService_UpdateAgent_Handler, - }, - { - MethodName: "DeleteAgent", - Handler: _AgentService_DeleteAgent_Handler, - }, - { - MethodName: "ListAgents", - Handler: _AgentService_ListAgents_Handler, - }, - { - MethodName: "ListAgentCommands", - Handler: _AgentService_ListAgentCommands_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "AgentStream", - Handler: _AgentService_AgentStream_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "agent.proto", -} - -const ( - PanelService_ProcessCommand_FullMethodName = "/agent.PanelService/ProcessCommand" -) - -// PanelServiceClient is the client API for PanelService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type PanelServiceClient interface { - ProcessCommand(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[UtmCommand, CommandResult], error) -} - -type panelServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewPanelServiceClient(cc grpc.ClientConnInterface) PanelServiceClient { - return &panelServiceClient{cc} -} - -func (c *panelServiceClient) ProcessCommand(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[UtmCommand, CommandResult], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &PanelService_ServiceDesc.Streams[0], PanelService_ProcessCommand_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &grpc.GenericClientStream[UtmCommand, CommandResult]{ClientStream: stream} - return x, nil -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type PanelService_ProcessCommandClient = grpc.BidiStreamingClient[UtmCommand, CommandResult] - -// PanelServiceServer is the server API for PanelService service. -// All implementations must embed UnimplementedPanelServiceServer -// for forward compatibility. -type PanelServiceServer interface { - ProcessCommand(grpc.BidiStreamingServer[UtmCommand, CommandResult]) error - mustEmbedUnimplementedPanelServiceServer() -} - -// UnimplementedPanelServiceServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedPanelServiceServer struct{} - -func (UnimplementedPanelServiceServer) ProcessCommand(grpc.BidiStreamingServer[UtmCommand, CommandResult]) error { - return status.Errorf(codes.Unimplemented, "method ProcessCommand not implemented") -} -func (UnimplementedPanelServiceServer) mustEmbedUnimplementedPanelServiceServer() {} -func (UnimplementedPanelServiceServer) testEmbeddedByValue() {} - -// UnsafePanelServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to PanelServiceServer will -// result in compilation errors. -type UnsafePanelServiceServer interface { - mustEmbedUnimplementedPanelServiceServer() -} - -func RegisterPanelServiceServer(s grpc.ServiceRegistrar, srv PanelServiceServer) { - // If the following call pancis, it indicates UnimplementedPanelServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&PanelService_ServiceDesc, srv) -} - -func _PanelService_ProcessCommand_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(PanelServiceServer).ProcessCommand(&grpc.GenericServerStream[UtmCommand, CommandResult]{ServerStream: stream}) -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type PanelService_ProcessCommandServer = grpc.BidiStreamingServer[UtmCommand, CommandResult] - -// PanelService_ServiceDesc is the grpc.ServiceDesc for PanelService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var PanelService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "agent.PanelService", - HandlerType: (*PanelServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "ProcessCommand", - Handler: _PanelService_ProcessCommand_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "agent.proto", -} diff --git a/collectors/forwarder/upstream/collector.pb.go b/collectors/forwarder/upstream/collector.pb.go new file mode 100644 index 000000000..52b3e0a1d --- /dev/null +++ b/collectors/forwarder/upstream/collector.pb.go @@ -0,0 +1,807 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v5.29.3 +// source: collector.proto + +package upstream + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +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 CollectorModule int32 + +const ( + CollectorModule_AS_400 CollectorModule = 0 + CollectorModule_UTMSTACK CollectorModule = 1 + CollectorModule_FORWARDER CollectorModule = 2 +) + +// Enum value maps for CollectorModule. +var ( + CollectorModule_name = map[int32]string{ + 0: "AS_400", + 1: "UTMSTACK", + 2: "FORWARDER", + } + CollectorModule_value = map[string]int32{ + "AS_400": 0, + "UTMSTACK": 1, + "FORWARDER": 2, + } +) + +func (x CollectorModule) Enum() *CollectorModule { + p := new(CollectorModule) + *p = x + return p +} + +func (x CollectorModule) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CollectorModule) Descriptor() protoreflect.EnumDescriptor { + return file_collector_proto_enumTypes[0].Descriptor() +} + +func (CollectorModule) Type() protoreflect.EnumType { + return &file_collector_proto_enumTypes[0] +} + +func (x CollectorModule) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CollectorModule.Descriptor instead. +func (CollectorModule) EnumDescriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{0} +} + +type RegisterRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` + Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + Collector CollectorModule `protobuf:"varint,4,opt,name=collector,proto3,enum=agent.CollectorModule" json:"collector,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterRequest) Reset() { + *x = RegisterRequest{} + mi := &file_collector_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterRequest) ProtoMessage() {} + +func (x *RegisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_collector_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead. +func (*RegisterRequest) Descriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{0} +} + +func (x *RegisterRequest) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *RegisterRequest) GetHostname() string { + if x != nil { + return x.Hostname + } + return "" +} + +func (x *RegisterRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *RegisterRequest) GetCollector() CollectorModule { + if x != nil { + return x.Collector + } + return CollectorModule_AS_400 +} + +type ListCollectorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Rows []*Collector `protobuf:"bytes,1,rep,name=rows,proto3" json:"rows,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListCollectorResponse) Reset() { + *x = ListCollectorResponse{} + mi := &file_collector_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListCollectorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCollectorResponse) ProtoMessage() {} + +func (x *ListCollectorResponse) ProtoReflect() protoreflect.Message { + mi := &file_collector_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListCollectorResponse.ProtoReflect.Descriptor instead. +func (*ListCollectorResponse) Descriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{1} +} + +func (x *ListCollectorResponse) GetRows() []*Collector { + if x != nil { + return x.Rows + } + return nil +} + +func (x *ListCollectorResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +type Collector struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=agent.Status" json:"status,omitempty"` + CollectorKey string `protobuf:"bytes,3,opt,name=collector_key,json=collectorKey,proto3" json:"collector_key,omitempty"` + Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"` + Hostname string `protobuf:"bytes,5,opt,name=hostname,proto3" json:"hostname,omitempty"` + Version string `protobuf:"bytes,6,opt,name=version,proto3" json:"version,omitempty"` + Module CollectorModule `protobuf:"varint,7,opt,name=module,proto3,enum=agent.CollectorModule" json:"module,omitempty"` + LastSeen string `protobuf:"bytes,8,opt,name=last_seen,json=lastSeen,proto3" json:"last_seen,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Collector) Reset() { + *x = Collector{} + mi := &file_collector_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Collector) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Collector) ProtoMessage() {} + +func (x *Collector) ProtoReflect() protoreflect.Message { + mi := &file_collector_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Collector.ProtoReflect.Descriptor instead. +func (*Collector) Descriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{2} +} + +func (x *Collector) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Collector) GetStatus() Status { + if x != nil { + return x.Status + } + return Status_ONLINE +} + +func (x *Collector) GetCollectorKey() string { + if x != nil { + return x.CollectorKey + } + return "" +} + +func (x *Collector) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *Collector) GetHostname() string { + if x != nil { + return x.Hostname + } + return "" +} + +func (x *Collector) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Collector) GetModule() CollectorModule { + if x != nil { + return x.Module + } + return CollectorModule_AS_400 +} + +func (x *Collector) GetLastSeen() string { + if x != nil { + return x.LastSeen + } + return "" +} + +type CollectorMessages struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to StreamMessage: + // + // *CollectorMessages_Config + // *CollectorMessages_Result + StreamMessage isCollectorMessages_StreamMessage `protobuf_oneof:"stream_message"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectorMessages) Reset() { + *x = CollectorMessages{} + mi := &file_collector_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectorMessages) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectorMessages) ProtoMessage() {} + +func (x *CollectorMessages) ProtoReflect() protoreflect.Message { + mi := &file_collector_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectorMessages.ProtoReflect.Descriptor instead. +func (*CollectorMessages) Descriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{3} +} + +func (x *CollectorMessages) GetStreamMessage() isCollectorMessages_StreamMessage { + if x != nil { + return x.StreamMessage + } + return nil +} + +func (x *CollectorMessages) GetConfig() *CollectorConfig { + if x != nil { + if x, ok := x.StreamMessage.(*CollectorMessages_Config); ok { + return x.Config + } + } + return nil +} + +func (x *CollectorMessages) GetResult() *ConfigKnowledge { + if x != nil { + if x, ok := x.StreamMessage.(*CollectorMessages_Result); ok { + return x.Result + } + } + return nil +} + +type isCollectorMessages_StreamMessage interface { + isCollectorMessages_StreamMessage() +} + +type CollectorMessages_Config struct { + Config *CollectorConfig `protobuf:"bytes,1,opt,name=config,proto3,oneof"` +} + +type CollectorMessages_Result struct { + Result *ConfigKnowledge `protobuf:"bytes,2,opt,name=result,proto3,oneof"` +} + +func (*CollectorMessages_Config) isCollectorMessages_StreamMessage() {} + +func (*CollectorMessages_Result) isCollectorMessages_StreamMessage() {} + +type CollectorConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + CollectorId string `protobuf:"bytes,1,opt,name=collector_id,json=collectorId,proto3" json:"collector_id,omitempty"` + Groups []*CollectorConfigGroup `protobuf:"bytes,2,rep,name=groups,proto3" json:"groups,omitempty"` + RequestId string `protobuf:"bytes,3,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectorConfig) Reset() { + *x = CollectorConfig{} + mi := &file_collector_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectorConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectorConfig) ProtoMessage() {} + +func (x *CollectorConfig) ProtoReflect() protoreflect.Message { + mi := &file_collector_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectorConfig.ProtoReflect.Descriptor instead. +func (*CollectorConfig) Descriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{4} +} + +func (x *CollectorConfig) GetCollectorId() string { + if x != nil { + return x.CollectorId + } + return "" +} + +func (x *CollectorConfig) GetGroups() []*CollectorConfigGroup { + if x != nil { + return x.Groups + } + return nil +} + +func (x *CollectorConfig) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +type CollectorConfigGroup struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` + GroupDescription string `protobuf:"bytes,3,opt,name=group_description,json=groupDescription,proto3" json:"group_description,omitempty"` + Configurations []*CollectorGroupConfigurations `protobuf:"bytes,4,rep,name=configurations,proto3" json:"configurations,omitempty"` + CollectorId int32 `protobuf:"varint,5,opt,name=collector_id,json=collectorId,proto3" json:"collector_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectorConfigGroup) Reset() { + *x = CollectorConfigGroup{} + mi := &file_collector_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectorConfigGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectorConfigGroup) ProtoMessage() {} + +func (x *CollectorConfigGroup) ProtoReflect() protoreflect.Message { + mi := &file_collector_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectorConfigGroup.ProtoReflect.Descriptor instead. +func (*CollectorConfigGroup) Descriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{5} +} + +func (x *CollectorConfigGroup) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *CollectorConfigGroup) GetGroupName() string { + if x != nil { + return x.GroupName + } + return "" +} + +func (x *CollectorConfigGroup) GetGroupDescription() string { + if x != nil { + return x.GroupDescription + } + return "" +} + +func (x *CollectorConfigGroup) GetConfigurations() []*CollectorGroupConfigurations { + if x != nil { + return x.Configurations + } + return nil +} + +func (x *CollectorConfigGroup) GetCollectorId() int32 { + if x != nil { + return x.CollectorId + } + return 0 +} + +type CollectorGroupConfigurations struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + GroupId int32 `protobuf:"varint,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + ConfKey string `protobuf:"bytes,3,opt,name=conf_key,json=confKey,proto3" json:"conf_key,omitempty"` + ConfValue string `protobuf:"bytes,4,opt,name=conf_value,json=confValue,proto3" json:"conf_value,omitempty"` + ConfName string `protobuf:"bytes,5,opt,name=conf_name,json=confName,proto3" json:"conf_name,omitempty"` + ConfDescription string `protobuf:"bytes,6,opt,name=conf_description,json=confDescription,proto3" json:"conf_description,omitempty"` + ConfDataType string `protobuf:"bytes,7,opt,name=conf_data_type,json=confDataType,proto3" json:"conf_data_type,omitempty"` + ConfRequired bool `protobuf:"varint,8,opt,name=conf_required,json=confRequired,proto3" json:"conf_required,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CollectorGroupConfigurations) Reset() { + *x = CollectorGroupConfigurations{} + mi := &file_collector_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CollectorGroupConfigurations) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectorGroupConfigurations) ProtoMessage() {} + +func (x *CollectorGroupConfigurations) ProtoReflect() protoreflect.Message { + mi := &file_collector_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectorGroupConfigurations.ProtoReflect.Descriptor instead. +func (*CollectorGroupConfigurations) Descriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{6} +} + +func (x *CollectorGroupConfigurations) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *CollectorGroupConfigurations) GetGroupId() int32 { + if x != nil { + return x.GroupId + } + return 0 +} + +func (x *CollectorGroupConfigurations) GetConfKey() string { + if x != nil { + return x.ConfKey + } + return "" +} + +func (x *CollectorGroupConfigurations) GetConfValue() string { + if x != nil { + return x.ConfValue + } + return "" +} + +func (x *CollectorGroupConfigurations) GetConfName() string { + if x != nil { + return x.ConfName + } + return "" +} + +func (x *CollectorGroupConfigurations) GetConfDescription() string { + if x != nil { + return x.ConfDescription + } + return "" +} + +func (x *CollectorGroupConfigurations) GetConfDataType() string { + if x != nil { + return x.ConfDataType + } + return "" +} + +func (x *CollectorGroupConfigurations) GetConfRequired() bool { + if x != nil { + return x.ConfRequired + } + return false +} + +type ConfigKnowledge struct { + state protoimpl.MessageState `protogen:"open.v1"` + Accepted string `protobuf:"bytes,1,opt,name=accepted,proto3" json:"accepted,omitempty"` + RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConfigKnowledge) Reset() { + *x = ConfigKnowledge{} + mi := &file_collector_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfigKnowledge) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigKnowledge) ProtoMessage() {} + +func (x *ConfigKnowledge) ProtoReflect() protoreflect.Message { + mi := &file_collector_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigKnowledge.ProtoReflect.Descriptor instead. +func (*ConfigKnowledge) Descriptor() ([]byte, []int) { + return file_collector_proto_rawDescGZIP(), []int{7} +} + +func (x *ConfigKnowledge) GetAccepted() string { + if x != nil { + return x.Accepted + } + return "" +} + +func (x *ConfigKnowledge) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +var File_collector_proto protoreflect.FileDescriptor + +const file_collector_proto_rawDesc = "" + + "\n" + + "\x0fcollector.proto\x12\x05agent\x1a\fcommon.proto\"\x8d\x01\n" + + "\x0fRegisterRequest\x12\x0e\n" + + "\x02ip\x18\x01 \x01(\tR\x02ip\x12\x1a\n" + + "\bhostname\x18\x02 \x01(\tR\bhostname\x12\x18\n" + + "\aversion\x18\x03 \x01(\tR\aversion\x124\n" + + "\tcollector\x18\x04 \x01(\x0e2\x16.agent.CollectorModuleR\tcollector\"S\n" + + "\x15ListCollectorResponse\x12$\n" + + "\x04rows\x18\x01 \x03(\v2\x10.agent.CollectorR\x04rows\x12\x14\n" + + "\x05total\x18\x02 \x01(\x05R\x05total\"\xfa\x01\n" + + "\tCollector\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x05R\x02id\x12%\n" + + "\x06status\x18\x02 \x01(\x0e2\r.agent.StatusR\x06status\x12#\n" + + "\rcollector_key\x18\x03 \x01(\tR\fcollectorKey\x12\x0e\n" + + "\x02ip\x18\x04 \x01(\tR\x02ip\x12\x1a\n" + + "\bhostname\x18\x05 \x01(\tR\bhostname\x12\x18\n" + + "\aversion\x18\x06 \x01(\tR\aversion\x12.\n" + + "\x06module\x18\a \x01(\x0e2\x16.agent.CollectorModuleR\x06module\x12\x1b\n" + + "\tlast_seen\x18\b \x01(\tR\blastSeen\"\x89\x01\n" + + "\x11CollectorMessages\x120\n" + + "\x06config\x18\x01 \x01(\v2\x16.agent.CollectorConfigH\x00R\x06config\x120\n" + + "\x06result\x18\x02 \x01(\v2\x16.agent.ConfigKnowledgeH\x00R\x06resultB\x10\n" + + "\x0estream_message\"\x88\x01\n" + + "\x0fCollectorConfig\x12!\n" + + "\fcollector_id\x18\x01 \x01(\tR\vcollectorId\x123\n" + + "\x06groups\x18\x02 \x03(\v2\x1b.agent.CollectorConfigGroupR\x06groups\x12\x1d\n" + + "\n" + + "request_id\x18\x03 \x01(\tR\trequestId\"\xe2\x01\n" + + "\x14CollectorConfigGroup\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x05R\x02id\x12\x1d\n" + + "\n" + + "group_name\x18\x02 \x01(\tR\tgroupName\x12+\n" + + "\x11group_description\x18\x03 \x01(\tR\x10groupDescription\x12K\n" + + "\x0econfigurations\x18\x04 \x03(\v2#.agent.CollectorGroupConfigurationsR\x0econfigurations\x12!\n" + + "\fcollector_id\x18\x05 \x01(\x05R\vcollectorId\"\x96\x02\n" + + "\x1cCollectorGroupConfigurations\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x05R\x02id\x12\x19\n" + + "\bgroup_id\x18\x02 \x01(\x05R\agroupId\x12\x19\n" + + "\bconf_key\x18\x03 \x01(\tR\aconfKey\x12\x1d\n" + + "\n" + + "conf_value\x18\x04 \x01(\tR\tconfValue\x12\x1b\n" + + "\tconf_name\x18\x05 \x01(\tR\bconfName\x12)\n" + + "\x10conf_description\x18\x06 \x01(\tR\x0fconfDescription\x12$\n" + + "\x0econf_data_type\x18\a \x01(\tR\fconfDataType\x12#\n" + + "\rconf_required\x18\b \x01(\bR\fconfRequired\"L\n" + + "\x0fConfigKnowledge\x12\x1a\n" + + "\baccepted\x18\x01 \x01(\tR\baccepted\x12\x1d\n" + + "\n" + + "request_id\x18\x02 \x01(\tR\trequestId*:\n" + + "\x0fCollectorModule\x12\n" + + "\n" + + "\x06AS_400\x10\x00\x12\f\n" + + "\bUTMSTACK\x10\x01\x12\r\n" + + "\tFORWARDER\x10\x022\xa8\x02\n" + + "\x10CollectorService\x12B\n" + + "\x11RegisterCollector\x12\x16.agent.RegisterRequest\x1a\x13.agent.AuthResponse\"\x00\x12>\n" + + "\x0fDeleteCollector\x12\x14.agent.DeleteRequest\x1a\x13.agent.AuthResponse\"\x00\x12C\n" + + "\rListCollector\x12\x12.agent.ListRequest\x1a\x1c.agent.ListCollectorResponse\"\x00\x12K\n" + + "\x0fCollectorStream\x12\x18.agent.CollectorMessages\x1a\x18.agent.CollectorMessages\"\x00(\x010\x01B2Z0github.com/utmstack/UTMStack/agent-manager/agentb\x06proto3" + +var ( + file_collector_proto_rawDescOnce sync.Once + file_collector_proto_rawDescData []byte +) + +func file_collector_proto_rawDescGZIP() []byte { + file_collector_proto_rawDescOnce.Do(func() { + file_collector_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_collector_proto_rawDesc), len(file_collector_proto_rawDesc))) + }) + return file_collector_proto_rawDescData +} + +var file_collector_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_collector_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_collector_proto_goTypes = []any{ + (CollectorModule)(0), // 0: agent.CollectorModule + (*RegisterRequest)(nil), // 1: agent.RegisterRequest + (*ListCollectorResponse)(nil), // 2: agent.ListCollectorResponse + (*Collector)(nil), // 3: agent.Collector + (*CollectorMessages)(nil), // 4: agent.CollectorMessages + (*CollectorConfig)(nil), // 5: agent.CollectorConfig + (*CollectorConfigGroup)(nil), // 6: agent.CollectorConfigGroup + (*CollectorGroupConfigurations)(nil), // 7: agent.CollectorGroupConfigurations + (*ConfigKnowledge)(nil), // 8: agent.ConfigKnowledge + (Status)(0), // 9: agent.Status + (*DeleteRequest)(nil), // 10: agent.DeleteRequest + (*ListRequest)(nil), // 11: agent.ListRequest + (*AuthResponse)(nil), // 12: agent.AuthResponse +} +var file_collector_proto_depIdxs = []int32{ + 0, // 0: agent.RegisterRequest.collector:type_name -> agent.CollectorModule + 3, // 1: agent.ListCollectorResponse.rows:type_name -> agent.Collector + 9, // 2: agent.Collector.status:type_name -> agent.Status + 0, // 3: agent.Collector.module:type_name -> agent.CollectorModule + 5, // 4: agent.CollectorMessages.config:type_name -> agent.CollectorConfig + 8, // 5: agent.CollectorMessages.result:type_name -> agent.ConfigKnowledge + 6, // 6: agent.CollectorConfig.groups:type_name -> agent.CollectorConfigGroup + 7, // 7: agent.CollectorConfigGroup.configurations:type_name -> agent.CollectorGroupConfigurations + 1, // 8: agent.CollectorService.RegisterCollector:input_type -> agent.RegisterRequest + 10, // 9: agent.CollectorService.DeleteCollector:input_type -> agent.DeleteRequest + 11, // 10: agent.CollectorService.ListCollector:input_type -> agent.ListRequest + 4, // 11: agent.CollectorService.CollectorStream:input_type -> agent.CollectorMessages + 12, // 12: agent.CollectorService.RegisterCollector:output_type -> agent.AuthResponse + 12, // 13: agent.CollectorService.DeleteCollector:output_type -> agent.AuthResponse + 2, // 14: agent.CollectorService.ListCollector:output_type -> agent.ListCollectorResponse + 4, // 15: agent.CollectorService.CollectorStream:output_type -> agent.CollectorMessages + 12, // [12:16] is the sub-list for method output_type + 8, // [8:12] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_collector_proto_init() } +func file_collector_proto_init() { + if File_collector_proto != nil { + return + } + file_common_proto_init() + file_collector_proto_msgTypes[3].OneofWrappers = []any{ + (*CollectorMessages_Config)(nil), + (*CollectorMessages_Result)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_collector_proto_rawDesc), len(file_collector_proto_rawDesc)), + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_collector_proto_goTypes, + DependencyIndexes: file_collector_proto_depIdxs, + EnumInfos: file_collector_proto_enumTypes, + MessageInfos: file_collector_proto_msgTypes, + }.Build() + File_collector_proto = out.File + file_collector_proto_goTypes = nil + file_collector_proto_depIdxs = nil +} diff --git a/collectors/forwarder/upstream/collector_grpc.pb.go b/collectors/forwarder/upstream/collector_grpc.pb.go new file mode 100644 index 000000000..900172906 --- /dev/null +++ b/collectors/forwarder/upstream/collector_grpc.pb.go @@ -0,0 +1,230 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v5.29.3 +// source: collector.proto + +package upstream + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + CollectorService_RegisterCollector_FullMethodName = "/agent.CollectorService/RegisterCollector" + CollectorService_DeleteCollector_FullMethodName = "/agent.CollectorService/DeleteCollector" + CollectorService_ListCollector_FullMethodName = "/agent.CollectorService/ListCollector" + CollectorService_CollectorStream_FullMethodName = "/agent.CollectorService/CollectorStream" +) + +// CollectorServiceClient is the client API for CollectorService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CollectorServiceClient interface { + RegisterCollector(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*AuthResponse, error) + DeleteCollector(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*AuthResponse, error) + ListCollector(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListCollectorResponse, error) + CollectorStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CollectorMessages, CollectorMessages], error) +} + +type collectorServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCollectorServiceClient(cc grpc.ClientConnInterface) CollectorServiceClient { + return &collectorServiceClient{cc} +} + +func (c *collectorServiceClient) RegisterCollector(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*AuthResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthResponse) + err := c.cc.Invoke(ctx, CollectorService_RegisterCollector_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *collectorServiceClient) DeleteCollector(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*AuthResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthResponse) + err := c.cc.Invoke(ctx, CollectorService_DeleteCollector_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *collectorServiceClient) ListCollector(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListCollectorResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListCollectorResponse) + err := c.cc.Invoke(ctx, CollectorService_ListCollector_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *collectorServiceClient) CollectorStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CollectorMessages, CollectorMessages], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &CollectorService_ServiceDesc.Streams[0], CollectorService_CollectorStream_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[CollectorMessages, CollectorMessages]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type CollectorService_CollectorStreamClient = grpc.BidiStreamingClient[CollectorMessages, CollectorMessages] + +// CollectorServiceServer is the server API for CollectorService service. +// All implementations must embed UnimplementedCollectorServiceServer +// for forward compatibility. +type CollectorServiceServer interface { + RegisterCollector(context.Context, *RegisterRequest) (*AuthResponse, error) + DeleteCollector(context.Context, *DeleteRequest) (*AuthResponse, error) + ListCollector(context.Context, *ListRequest) (*ListCollectorResponse, error) + CollectorStream(grpc.BidiStreamingServer[CollectorMessages, CollectorMessages]) error + mustEmbedUnimplementedCollectorServiceServer() +} + +// UnimplementedCollectorServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedCollectorServiceServer struct{} + +func (UnimplementedCollectorServiceServer) RegisterCollector(context.Context, *RegisterRequest) (*AuthResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RegisterCollector not implemented") +} +func (UnimplementedCollectorServiceServer) DeleteCollector(context.Context, *DeleteRequest) (*AuthResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteCollector not implemented") +} +func (UnimplementedCollectorServiceServer) ListCollector(context.Context, *ListRequest) (*ListCollectorResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListCollector not implemented") +} +func (UnimplementedCollectorServiceServer) CollectorStream(grpc.BidiStreamingServer[CollectorMessages, CollectorMessages]) error { + return status.Error(codes.Unimplemented, "method CollectorStream not implemented") +} +func (UnimplementedCollectorServiceServer) mustEmbedUnimplementedCollectorServiceServer() {} +func (UnimplementedCollectorServiceServer) testEmbeddedByValue() {} + +// UnsafeCollectorServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CollectorServiceServer will +// result in compilation errors. +type UnsafeCollectorServiceServer interface { + mustEmbedUnimplementedCollectorServiceServer() +} + +func RegisterCollectorServiceServer(s grpc.ServiceRegistrar, srv CollectorServiceServer) { + // If the following call panics, it indicates UnimplementedCollectorServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&CollectorService_ServiceDesc, srv) +} + +func _CollectorService_RegisterCollector_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CollectorServiceServer).RegisterCollector(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CollectorService_RegisterCollector_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CollectorServiceServer).RegisterCollector(ctx, req.(*RegisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CollectorService_DeleteCollector_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CollectorServiceServer).DeleteCollector(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CollectorService_DeleteCollector_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CollectorServiceServer).DeleteCollector(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CollectorService_ListCollector_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CollectorServiceServer).ListCollector(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CollectorService_ListCollector_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CollectorServiceServer).ListCollector(ctx, req.(*ListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CollectorService_CollectorStream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(CollectorServiceServer).CollectorStream(&grpc.GenericServerStream[CollectorMessages, CollectorMessages]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type CollectorService_CollectorStreamServer = grpc.BidiStreamingServer[CollectorMessages, CollectorMessages] + +// CollectorService_ServiceDesc is the grpc.ServiceDesc for CollectorService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CollectorService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "agent.CollectorService", + HandlerType: (*CollectorServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterCollector", + Handler: _CollectorService_RegisterCollector_Handler, + }, + { + MethodName: "DeleteCollector", + Handler: _CollectorService_DeleteCollector_Handler, + }, + { + MethodName: "ListCollector", + Handler: _CollectorService_ListCollector_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "CollectorStream", + Handler: _CollectorService_CollectorStream_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "collector.proto", +} diff --git a/collectors/forwarder/upstream/common.pb.go b/collectors/forwarder/upstream/common.pb.go index 42740beec..656aaa607 100644 --- a/collectors/forwarder/upstream/common.pb.go +++ b/collectors/forwarder/upstream/common.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.29.3 // source: common.proto diff --git a/collectors/forwarder/upstream/ping.pb.go b/collectors/forwarder/upstream/ping.pb.go index 88af52b2f..c3ac92e4f 100644 --- a/collectors/forwarder/upstream/ping.pb.go +++ b/collectors/forwarder/upstream/ping.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.10 +// protoc-gen-go v1.36.11 // protoc v5.29.3 // source: ping.proto diff --git a/collectors/forwarder/upstream/ping_grpc.pb.go b/collectors/forwarder/upstream/ping_grpc.pb.go index cdf3b428f..b67f0940a 100644 --- a/collectors/forwarder/upstream/ping_grpc.pb.go +++ b/collectors/forwarder/upstream/ping_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.2 // - protoc v5.29.3 // source: ping.proto @@ -66,7 +66,7 @@ type PingServiceServer interface { type UnimplementedPingServiceServer struct{} func (UnimplementedPingServiceServer) Ping(grpc.ClientStreamingServer[PingRequest, PingResponse]) error { - return status.Errorf(codes.Unimplemented, "method Ping not implemented") + return status.Error(codes.Unimplemented, "method Ping not implemented") } func (UnimplementedPingServiceServer) mustEmbedUnimplementedPingServiceServer() {} func (UnimplementedPingServiceServer) testEmbeddedByValue() {} @@ -79,7 +79,7 @@ type UnsafePingServiceServer interface { } func RegisterPingServiceServer(s grpc.ServiceRegistrar, srv PingServiceServer) { - // If the following call pancis, it indicates UnimplementedPingServiceServer was + // If the following call panics, it indicates UnimplementedPingServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/collectors/forwarder/upstream/register.go b/collectors/forwarder/upstream/register.go index 37d35096b..6fd428965 100644 --- a/collectors/forwarder/upstream/register.go +++ b/collectors/forwarder/upstream/register.go @@ -2,20 +2,39 @@ package upstream import ( "context" + "encoding/json" "fmt" + "os" "github.com/utmstack/UTMStack/collectors/forwarder/config" "github.com/utmstack/UTMStack/collectors/forwarder/utils" "google.golang.org/grpc/metadata" ) +type versionFile struct { + Version string `json:"version"` +} + +func getForwarderVersion() (string, error) { + versionPath := "version.json" + data, err := os.ReadFile(versionPath) + if err != nil { + return "1.0.0", nil + } + var v versionFile + if err := json.Unmarshal(data, &v); err != nil { + return "1.0.0", nil + } + return v.Version, nil +} + func RegisterCollector(cnf *config.Config, UTMKey string) error { connection, err := GetAgentManagerConnection(cnf) if err != nil { return fmt.Errorf("error connecting to Agent Manager: %v", err) } - agentClient := NewAgentServiceClient(connection) + client := NewCollectorServiceClient(connection) ctx, cancel := context.WithCancel(context.Background()) ctx = metadata.AppendToOutgoingContext(ctx, "connection-key", UTMKey) defer cancel() @@ -30,22 +49,21 @@ func RegisterCollector(cnf *config.Config, UTMKey string) error { return fmt.Errorf("error getting os info: %v", err) } - request := &AgentRequest{ - Ip: ip, - Hostname: osInfo.Hostname, - Os: osInfo.OsType, - Platform: osInfo.Platform, - RegisterBy: osInfo.CurrentUser, - Mac: osInfo.Mac, - OsMajorVersion: osInfo.OsMajorVersion, - OsMinorVersion: osInfo.OsMinorVersion, - Aliases: osInfo.Aliases, - Addresses: osInfo.Addresses, + version, err := getForwarderVersion() + if err != nil { + return fmt.Errorf("error getting version: %v", err) + } + + request := &RegisterRequest{ + Ip: ip, + Hostname: osInfo.Hostname, + Version: version, + Collector: CollectorModule_FORWARDER, } - response, err := agentClient.RegisterAgent(ctx, request) + response, err := client.RegisterCollector(ctx, request) if err != nil { - return fmt.Errorf("failed to register agent: %v", err) + return fmt.Errorf("failed to register collector: %v", err) } cnf.CollectorID = uint(response.Id) From 4c1f05b52db41aa5d0ca25a49a0f9f78f4fd27f2 Mon Sep 17 00:00:00 2001 From: Yadian Llada Lopez Date: Thu, 25 Jun 2026 11:22:14 -0400 Subject: [PATCH 3/4] fix: create certs dir before writing integration token file --- collectors/forwarder/listeners/auth.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collectors/forwarder/listeners/auth.go b/collectors/forwarder/listeners/auth.go index be4cb2056..3d892c574 100644 --- a/collectors/forwarder/listeners/auth.go +++ b/collectors/forwarder/listeners/auth.go @@ -9,6 +9,7 @@ import ( "fmt" stdhttp "net/http" "os" + "path/filepath" "strings" ) @@ -88,6 +89,11 @@ func GenerateTokenFile(path string) (string, error) { return "", fmt.Errorf("generate token: %w", err) } token := hex.EncodeToString(b) + if dir := filepath.Dir(path); dir != "" { + if err := os.MkdirAll(dir, 0700); err != nil { + return "", fmt.Errorf("write token file: create dir: %w", err) + } + } if err := os.WriteFile(path, []byte(token+"\n"), 0600); err != nil { return "", fmt.Errorf("write token file: %w", err) } From 453385d9d08ddaad93ee836c07f3c36aabd236e7 Mon Sep 17 00:00:00 2001 From: Yadian Llada Lopez Date: Thu, 25 Jun 2026 15:51:02 -0400 Subject: [PATCH 4/4] feat(forwarder): download version.json from server before registering collector --- collectors/forwarder/cmd/install.go | 8 ++++++ collectors/forwarder/config/const.go | 7 +++-- collectors/forwarder/updates/dependencies.go | 17 ++++++++++++ collectors/forwarder/upstream/register.go | 29 ++++++-------------- 4 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 collectors/forwarder/updates/dependencies.go diff --git a/collectors/forwarder/cmd/install.go b/collectors/forwarder/cmd/install.go index 14a47f6a1..7dc314168 100644 --- a/collectors/forwarder/cmd/install.go +++ b/collectors/forwarder/cmd/install.go @@ -7,6 +7,7 @@ import ( "github.com/spf13/cobra" "github.com/utmstack/UTMStack/collectors/forwarder/config" "github.com/utmstack/UTMStack/collectors/forwarder/serv" + "github.com/utmstack/UTMStack/collectors/forwarder/updates" "github.com/utmstack/UTMStack/collectors/forwarder/upstream" "github.com/utmstack/UTMStack/collectors/forwarder/utils" ) @@ -33,6 +34,13 @@ var installCmd = &cobra.Command{ } fmt.Println("[OK]") + fmt.Print("Downloading version info ... ") + if err := updates.DownloadVersion(cnf.Server, cnf.SkipCertValidation); err != nil { + fmt.Println("\nError downloading version info: ", err) + os.Exit(1) + } + fmt.Println("[OK]") + fmt.Print("Configuring collector ... ") if err := upstream.RegisterCollector(cnf, utmKey); err != nil { fmt.Println("\nError registering collector: ", err) diff --git a/collectors/forwarder/config/const.go b/collectors/forwarder/config/const.go index 77cab57af..c53f01e61 100644 --- a/collectors/forwarder/config/const.go +++ b/collectors/forwarder/config/const.go @@ -10,8 +10,11 @@ import ( var REPLACE_KEY string var ( - AgentManagerPort = "9000" - LogAuthProxyPort = "50051" + AgentManagerPort = "9000" + LogAuthProxyPort = "50051" + DependenciesPort = "9001" + DependUrl = "https://%s:%s/private/dependencies/collector/%s" + VersionPath = filepath.Join(fs.GetExecutablePath(), "version.json") CollectorLogFile = filepath.Join(fs.GetExecutablePath(), "logs", "utmstack_forwarder.log") UUIDFileName = filepath.Join(fs.GetExecutablePath(), "collector-uuid.yml") diff --git a/collectors/forwarder/updates/dependencies.go b/collectors/forwarder/updates/dependencies.go new file mode 100644 index 000000000..5668680ed --- /dev/null +++ b/collectors/forwarder/updates/dependencies.go @@ -0,0 +1,17 @@ +package updates + +import ( + "fmt" + + "github.com/utmstack/UTMStack/collectors/forwarder/config" + sharedhttp "github.com/utmstack/UTMStack/shared/http" + "github.com/utmstack/UTMStack/shared/fs" +) + +func DownloadVersion(address string, insecure bool) error { + url := fmt.Sprintf(config.DependUrl, address, config.DependenciesPort, "version.json") + if err := sharedhttp.DownloadFile(url, map[string]string{}, "version.json", fs.GetExecutablePath(), insecure); err != nil { + return fmt.Errorf("error downloading version.json: %v", err) + } + return nil +} diff --git a/collectors/forwarder/upstream/register.go b/collectors/forwarder/upstream/register.go index 6fd428965..a99d7859a 100644 --- a/collectors/forwarder/upstream/register.go +++ b/collectors/forwarder/upstream/register.go @@ -11,23 +11,6 @@ import ( "google.golang.org/grpc/metadata" ) -type versionFile struct { - Version string `json:"version"` -} - -func getForwarderVersion() (string, error) { - versionPath := "version.json" - data, err := os.ReadFile(versionPath) - if err != nil { - return "1.0.0", nil - } - var v versionFile - if err := json.Unmarshal(data, &v); err != nil { - return "1.0.0", nil - } - return v.Version, nil -} - func RegisterCollector(cnf *config.Config, UTMKey string) error { connection, err := GetAgentManagerConnection(cnf) if err != nil { @@ -49,15 +32,21 @@ func RegisterCollector(cnf *config.Config, UTMKey string) error { return fmt.Errorf("error getting os info: %v", err) } - version, err := getForwarderVersion() + var v struct { + Version string `json:"version"` + } + data, err := os.ReadFile(config.VersionPath) if err != nil { - return fmt.Errorf("error getting version: %v", err) + return fmt.Errorf("error reading version file: %v", err) + } + if err := json.Unmarshal(data, &v); err != nil { + return fmt.Errorf("error parsing version file: %v", err) } request := &RegisterRequest{ Ip: ip, Hostname: osInfo.Hostname, - Version: version, + Version: v.Version, Collector: CollectorModule_FORWARDER, }