Files
tyto/backend/internal/proto/tyto.pb.go
vikingowl 5e781c0e04 feat: implement lightweight agent with gRPC and mTLS support
Agent Package (internal/agent/):
- Agent struct with all collectors and memory-efficient pooling
- Run loop with configurable collection interval
- Graceful shutdown with context cancellation
- Auto-reconnection callback for re-registration

gRPC Client (internal/agent/client.go):
- mTLS support with CA, agent cert, and key
- Bidirectional streaming for metrics
- Heartbeat fallback when streaming fails
- Exponential backoff with jitter for reconnection
- Concurrent reconnection handling with mutex

Protocol Buffers (proto/tyto.proto):
- AgentService with Stream, Register, Heartbeat RPCs
- MetricsReport with summary fields for aggregation
- ConfigUpdate and Command messages for server control
- RegisterStatus enum for registration workflow

CLI Integration (cmd/tyto/main.go):
- Full agent subcommand with flag parsing
- Support for --id, --server, --interval, --ca-cert, etc.
- Environment variable overrides (TYTO_AGENT_*)
- Signal handling for graceful shutdown

Build System (Makefile):
- Cross-compilation for linux/amd64, arm64, armv7
- Stripped binaries with version info
- Proto generation target
- Test and coverage targets

Config Updates:
- DefaultConfig() and LoadFromPath() functions
- Agent config properly parsed from YAML

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 07:42:44 +01:00

1174 lines
35 KiB
Go

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v6.33.1
// source: tyto.proto
package proto
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 RegisterStatus int32
const (
RegisterStatus_REGISTER_STATUS_UNKNOWN RegisterStatus = 0
RegisterStatus_REGISTER_STATUS_ACCEPTED RegisterStatus = 1
RegisterStatus_REGISTER_STATUS_PENDING_APPROVAL RegisterStatus = 2
RegisterStatus_REGISTER_STATUS_REJECTED RegisterStatus = 3
RegisterStatus_REGISTER_STATUS_ALREADY_REGISTERED RegisterStatus = 4
)
// Enum value maps for RegisterStatus.
var (
RegisterStatus_name = map[int32]string{
0: "REGISTER_STATUS_UNKNOWN",
1: "REGISTER_STATUS_ACCEPTED",
2: "REGISTER_STATUS_PENDING_APPROVAL",
3: "REGISTER_STATUS_REJECTED",
4: "REGISTER_STATUS_ALREADY_REGISTERED",
}
RegisterStatus_value = map[string]int32{
"REGISTER_STATUS_UNKNOWN": 0,
"REGISTER_STATUS_ACCEPTED": 1,
"REGISTER_STATUS_PENDING_APPROVAL": 2,
"REGISTER_STATUS_REJECTED": 3,
"REGISTER_STATUS_ALREADY_REGISTERED": 4,
}
)
func (x RegisterStatus) Enum() *RegisterStatus {
p := new(RegisterStatus)
*p = x
return p
}
func (x RegisterStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (RegisterStatus) Descriptor() protoreflect.EnumDescriptor {
return file_tyto_proto_enumTypes[0].Descriptor()
}
func (RegisterStatus) Type() protoreflect.EnumType {
return &file_tyto_proto_enumTypes[0]
}
func (x RegisterStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use RegisterStatus.Descriptor instead.
func (RegisterStatus) EnumDescriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{0}
}
type CommandType int32
const (
CommandType_COMMAND_TYPE_UNKNOWN CommandType = 0
CommandType_COMMAND_TYPE_COLLECT_NOW CommandType = 1 // Force immediate collection
CommandType_COMMAND_TYPE_RESTART CommandType = 2 // Restart the agent
CommandType_COMMAND_TYPE_UPDATE_CONFIG CommandType = 3 // Apply new config
CommandType_COMMAND_TYPE_DISCONNECT CommandType = 4 // Graceful disconnect
)
// Enum value maps for CommandType.
var (
CommandType_name = map[int32]string{
0: "COMMAND_TYPE_UNKNOWN",
1: "COMMAND_TYPE_COLLECT_NOW",
2: "COMMAND_TYPE_RESTART",
3: "COMMAND_TYPE_UPDATE_CONFIG",
4: "COMMAND_TYPE_DISCONNECT",
}
CommandType_value = map[string]int32{
"COMMAND_TYPE_UNKNOWN": 0,
"COMMAND_TYPE_COLLECT_NOW": 1,
"COMMAND_TYPE_RESTART": 2,
"COMMAND_TYPE_UPDATE_CONFIG": 3,
"COMMAND_TYPE_DISCONNECT": 4,
}
)
func (x CommandType) Enum() *CommandType {
p := new(CommandType)
*p = x
return p
}
func (x CommandType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (CommandType) Descriptor() protoreflect.EnumDescriptor {
return file_tyto_proto_enumTypes[1].Descriptor()
}
func (CommandType) Type() protoreflect.EnumType {
return &file_tyto_proto_enumTypes[1]
}
func (x CommandType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use CommandType.Descriptor instead.
func (CommandType) EnumDescriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{1}
}
// AgentMessage is sent from agent to server.
type AgentMessage struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Payload:
//
// *AgentMessage_Metrics
// *AgentMessage_Heartbeat
// *AgentMessage_Info
Payload isAgentMessage_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AgentMessage) Reset() {
*x = AgentMessage{}
mi := &file_tyto_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AgentMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AgentMessage) ProtoMessage() {}
func (x *AgentMessage) ProtoReflect() protoreflect.Message {
mi := &file_tyto_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 AgentMessage.ProtoReflect.Descriptor instead.
func (*AgentMessage) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{0}
}
func (x *AgentMessage) GetPayload() isAgentMessage_Payload {
if x != nil {
return x.Payload
}
return nil
}
func (x *AgentMessage) GetMetrics() *MetricsReport {
if x != nil {
if x, ok := x.Payload.(*AgentMessage_Metrics); ok {
return x.Metrics
}
}
return nil
}
func (x *AgentMessage) GetHeartbeat() *HeartbeatRequest {
if x != nil {
if x, ok := x.Payload.(*AgentMessage_Heartbeat); ok {
return x.Heartbeat
}
}
return nil
}
func (x *AgentMessage) GetInfo() *AgentInfo {
if x != nil {
if x, ok := x.Payload.(*AgentMessage_Info); ok {
return x.Info
}
}
return nil
}
type isAgentMessage_Payload interface {
isAgentMessage_Payload()
}
type AgentMessage_Metrics struct {
Metrics *MetricsReport `protobuf:"bytes,1,opt,name=metrics,proto3,oneof"`
}
type AgentMessage_Heartbeat struct {
Heartbeat *HeartbeatRequest `protobuf:"bytes,2,opt,name=heartbeat,proto3,oneof"`
}
type AgentMessage_Info struct {
Info *AgentInfo `protobuf:"bytes,3,opt,name=info,proto3,oneof"`
}
func (*AgentMessage_Metrics) isAgentMessage_Payload() {}
func (*AgentMessage_Heartbeat) isAgentMessage_Payload() {}
func (*AgentMessage_Info) isAgentMessage_Payload() {}
// ServerMessage is sent from server to agent.
type ServerMessage struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Payload:
//
// *ServerMessage_Config
// *ServerMessage_Ack
// *ServerMessage_Command
Payload isServerMessage_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ServerMessage) Reset() {
*x = ServerMessage{}
mi := &file_tyto_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ServerMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ServerMessage) ProtoMessage() {}
func (x *ServerMessage) ProtoReflect() protoreflect.Message {
mi := &file_tyto_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 ServerMessage.ProtoReflect.Descriptor instead.
func (*ServerMessage) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{1}
}
func (x *ServerMessage) GetPayload() isServerMessage_Payload {
if x != nil {
return x.Payload
}
return nil
}
func (x *ServerMessage) GetConfig() *ConfigUpdate {
if x != nil {
if x, ok := x.Payload.(*ServerMessage_Config); ok {
return x.Config
}
}
return nil
}
func (x *ServerMessage) GetAck() *Ack {
if x != nil {
if x, ok := x.Payload.(*ServerMessage_Ack); ok {
return x.Ack
}
}
return nil
}
func (x *ServerMessage) GetCommand() *Command {
if x != nil {
if x, ok := x.Payload.(*ServerMessage_Command); ok {
return x.Command
}
}
return nil
}
type isServerMessage_Payload interface {
isServerMessage_Payload()
}
type ServerMessage_Config struct {
Config *ConfigUpdate `protobuf:"bytes,1,opt,name=config,proto3,oneof"`
}
type ServerMessage_Ack struct {
Ack *Ack `protobuf:"bytes,2,opt,name=ack,proto3,oneof"`
}
type ServerMessage_Command struct {
Command *Command `protobuf:"bytes,3,opt,name=command,proto3,oneof"`
}
func (*ServerMessage_Config) isServerMessage_Payload() {}
func (*ServerMessage_Ack) isServerMessage_Payload() {}
func (*ServerMessage_Command) isServerMessage_Payload() {}
// MetricsReport contains collected metrics from an agent.
type MetricsReport struct {
state protoimpl.MessageState `protogen:"open.v1"`
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
TimestampMs int64 `protobuf:"varint,2,opt,name=timestamp_ms,json=timestampMs,proto3" json:"timestamp_ms,omitempty"`
MetricsJson []byte `protobuf:"bytes,3,opt,name=metrics_json,json=metricsJson,proto3" json:"metrics_json,omitempty"` // AllMetrics serialized as JSON
// Optional individual metrics for server-side aggregation
CpuUsage float64 `protobuf:"fixed64,4,opt,name=cpu_usage,json=cpuUsage,proto3" json:"cpu_usage,omitempty"`
MemoryPercent float64 `protobuf:"fixed64,5,opt,name=memory_percent,json=memoryPercent,proto3" json:"memory_percent,omitempty"`
DiskPercent float64 `protobuf:"fixed64,6,opt,name=disk_percent,json=diskPercent,proto3" json:"disk_percent,omitempty"`
GpuUtilization int32 `protobuf:"varint,7,opt,name=gpu_utilization,json=gpuUtilization,proto3" json:"gpu_utilization,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *MetricsReport) Reset() {
*x = MetricsReport{}
mi := &file_tyto_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *MetricsReport) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MetricsReport) ProtoMessage() {}
func (x *MetricsReport) ProtoReflect() protoreflect.Message {
mi := &file_tyto_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 MetricsReport.ProtoReflect.Descriptor instead.
func (*MetricsReport) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{2}
}
func (x *MetricsReport) GetAgentId() string {
if x != nil {
return x.AgentId
}
return ""
}
func (x *MetricsReport) GetTimestampMs() int64 {
if x != nil {
return x.TimestampMs
}
return 0
}
func (x *MetricsReport) GetMetricsJson() []byte {
if x != nil {
return x.MetricsJson
}
return nil
}
func (x *MetricsReport) GetCpuUsage() float64 {
if x != nil {
return x.CpuUsage
}
return 0
}
func (x *MetricsReport) GetMemoryPercent() float64 {
if x != nil {
return x.MemoryPercent
}
return 0
}
func (x *MetricsReport) GetDiskPercent() float64 {
if x != nil {
return x.DiskPercent
}
return 0
}
func (x *MetricsReport) GetGpuUtilization() int32 {
if x != nil {
return x.GpuUtilization
}
return 0
}
// HeartbeatRequest is a lightweight keep-alive message.
type HeartbeatRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
TimestampMs int64 `protobuf:"varint,2,opt,name=timestamp_ms,json=timestampMs,proto3" json:"timestamp_ms,omitempty"`
UptimeSeconds int64 `protobuf:"varint,3,opt,name=uptime_seconds,json=uptimeSeconds,proto3" json:"uptime_seconds,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *HeartbeatRequest) Reset() {
*x = HeartbeatRequest{}
mi := &file_tyto_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *HeartbeatRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HeartbeatRequest) ProtoMessage() {}
func (x *HeartbeatRequest) ProtoReflect() protoreflect.Message {
mi := &file_tyto_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 HeartbeatRequest.ProtoReflect.Descriptor instead.
func (*HeartbeatRequest) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{3}
}
func (x *HeartbeatRequest) GetAgentId() string {
if x != nil {
return x.AgentId
}
return ""
}
func (x *HeartbeatRequest) GetTimestampMs() int64 {
if x != nil {
return x.TimestampMs
}
return 0
}
func (x *HeartbeatRequest) GetUptimeSeconds() int64 {
if x != nil {
return x.UptimeSeconds
}
return 0
}
// HeartbeatResponse acknowledges the heartbeat.
type HeartbeatResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
ServerTimeMs int64 `protobuf:"varint,1,opt,name=server_time_ms,json=serverTimeMs,proto3" json:"server_time_ms,omitempty"`
ConfigChanged bool `protobuf:"varint,2,opt,name=config_changed,json=configChanged,proto3" json:"config_changed,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *HeartbeatResponse) Reset() {
*x = HeartbeatResponse{}
mi := &file_tyto_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *HeartbeatResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HeartbeatResponse) ProtoMessage() {}
func (x *HeartbeatResponse) ProtoReflect() protoreflect.Message {
mi := &file_tyto_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 HeartbeatResponse.ProtoReflect.Descriptor instead.
func (*HeartbeatResponse) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{4}
}
func (x *HeartbeatResponse) GetServerTimeMs() int64 {
if x != nil {
return x.ServerTimeMs
}
return 0
}
func (x *HeartbeatResponse) GetConfigChanged() bool {
if x != nil {
return x.ConfigChanged
}
return false
}
// AgentInfo describes the agent's system.
type AgentInfo struct {
state protoimpl.MessageState `protogen:"open.v1"`
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,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"`
Architecture string `protobuf:"bytes,4,opt,name=architecture,proto3" json:"architecture,omitempty"`
Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"`
Capabilities []string `protobuf:"bytes,6,rep,name=capabilities,proto3" json:"capabilities,omitempty"` // e.g., "gpu", "docker", "systemd"
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AgentInfo) Reset() {
*x = AgentInfo{}
mi := &file_tyto_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AgentInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AgentInfo) ProtoMessage() {}
func (x *AgentInfo) ProtoReflect() protoreflect.Message {
mi := &file_tyto_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 AgentInfo.ProtoReflect.Descriptor instead.
func (*AgentInfo) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{5}
}
func (x *AgentInfo) GetAgentId() string {
if x != nil {
return x.AgentId
}
return ""
}
func (x *AgentInfo) GetHostname() string {
if x != nil {
return x.Hostname
}
return ""
}
func (x *AgentInfo) GetOs() string {
if x != nil {
return x.Os
}
return ""
}
func (x *AgentInfo) GetArchitecture() string {
if x != nil {
return x.Architecture
}
return ""
}
func (x *AgentInfo) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
func (x *AgentInfo) GetCapabilities() []string {
if x != nil {
return x.Capabilities
}
return nil
}
// RegisterRequest is sent when an agent first connects.
type RegisterRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
Info *AgentInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"`
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` // Optional registration token
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RegisterRequest) Reset() {
*x = RegisterRequest{}
mi := &file_tyto_proto_msgTypes[6]
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_tyto_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 RegisterRequest.ProtoReflect.Descriptor instead.
func (*RegisterRequest) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{6}
}
func (x *RegisterRequest) GetAgentId() string {
if x != nil {
return x.AgentId
}
return ""
}
func (x *RegisterRequest) GetInfo() *AgentInfo {
if x != nil {
return x.Info
}
return nil
}
func (x *RegisterRequest) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
// RegisterResponse indicates if registration was accepted.
type RegisterResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Accepted bool `protobuf:"varint,1,opt,name=accepted,proto3" json:"accepted,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
Status RegisterStatus `protobuf:"varint,3,opt,name=status,proto3,enum=tyto.RegisterStatus" json:"status,omitempty"`
Config *AgentConfig `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` // Initial config if accepted
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RegisterResponse) Reset() {
*x = RegisterResponse{}
mi := &file_tyto_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RegisterResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RegisterResponse) ProtoMessage() {}
func (x *RegisterResponse) ProtoReflect() protoreflect.Message {
mi := &file_tyto_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 RegisterResponse.ProtoReflect.Descriptor instead.
func (*RegisterResponse) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{7}
}
func (x *RegisterResponse) GetAccepted() bool {
if x != nil {
return x.Accepted
}
return false
}
func (x *RegisterResponse) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *RegisterResponse) GetStatus() RegisterStatus {
if x != nil {
return x.Status
}
return RegisterStatus_REGISTER_STATUS_UNKNOWN
}
func (x *RegisterResponse) GetConfig() *AgentConfig {
if x != nil {
return x.Config
}
return nil
}
// ConfigUpdate pushes configuration changes to an agent.
type ConfigUpdate struct {
state protoimpl.MessageState `protogen:"open.v1"`
CollectionIntervalSeconds int32 `protobuf:"varint,1,opt,name=collection_interval_seconds,json=collectionIntervalSeconds,proto3" json:"collection_interval_seconds,omitempty"`
EnabledCollectors []string `protobuf:"bytes,2,rep,name=enabled_collectors,json=enabledCollectors,proto3" json:"enabled_collectors,omitempty"`
Settings map[string]string `protobuf:"bytes,3,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ConfigUpdate) Reset() {
*x = ConfigUpdate{}
mi := &file_tyto_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ConfigUpdate) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ConfigUpdate) ProtoMessage() {}
func (x *ConfigUpdate) ProtoReflect() protoreflect.Message {
mi := &file_tyto_proto_msgTypes[8]
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 ConfigUpdate.ProtoReflect.Descriptor instead.
func (*ConfigUpdate) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{8}
}
func (x *ConfigUpdate) GetCollectionIntervalSeconds() int32 {
if x != nil {
return x.CollectionIntervalSeconds
}
return 0
}
func (x *ConfigUpdate) GetEnabledCollectors() []string {
if x != nil {
return x.EnabledCollectors
}
return nil
}
func (x *ConfigUpdate) GetSettings() map[string]string {
if x != nil {
return x.Settings
}
return nil
}
// AgentConfig is the full agent configuration.
type AgentConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
CollectionIntervalSeconds int32 `protobuf:"varint,1,opt,name=collection_interval_seconds,json=collectionIntervalSeconds,proto3" json:"collection_interval_seconds,omitempty"`
EnabledCollectors []string `protobuf:"bytes,2,rep,name=enabled_collectors,json=enabledCollectors,proto3" json:"enabled_collectors,omitempty"`
Settings map[string]string `protobuf:"bytes,3,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AgentConfig) Reset() {
*x = AgentConfig{}
mi := &file_tyto_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AgentConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AgentConfig) ProtoMessage() {}
func (x *AgentConfig) ProtoReflect() protoreflect.Message {
mi := &file_tyto_proto_msgTypes[9]
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 AgentConfig.ProtoReflect.Descriptor instead.
func (*AgentConfig) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{9}
}
func (x *AgentConfig) GetCollectionIntervalSeconds() int32 {
if x != nil {
return x.CollectionIntervalSeconds
}
return 0
}
func (x *AgentConfig) GetEnabledCollectors() []string {
if x != nil {
return x.EnabledCollectors
}
return nil
}
func (x *AgentConfig) GetSettings() map[string]string {
if x != nil {
return x.Settings
}
return nil
}
// Ack acknowledges receipt of a message.
type Ack struct {
state protoimpl.MessageState `protogen:"open.v1"`
MessageId int64 `protobuf:"varint,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"`
Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"`
Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Ack) Reset() {
*x = Ack{}
mi := &file_tyto_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Ack) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Ack) ProtoMessage() {}
func (x *Ack) ProtoReflect() protoreflect.Message {
mi := &file_tyto_proto_msgTypes[10]
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 Ack.ProtoReflect.Descriptor instead.
func (*Ack) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{10}
}
func (x *Ack) GetMessageId() int64 {
if x != nil {
return x.MessageId
}
return 0
}
func (x *Ack) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *Ack) GetError() string {
if x != nil {
return x.Error
}
return ""
}
// Command is sent from server to agent.
type Command struct {
state protoimpl.MessageState `protogen:"open.v1"`
Type CommandType `protobuf:"varint,1,opt,name=type,proto3,enum=tyto.CommandType" json:"type,omitempty"`
Params map[string]string `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Command) Reset() {
*x = Command{}
mi := &file_tyto_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Command) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Command) ProtoMessage() {}
func (x *Command) ProtoReflect() protoreflect.Message {
mi := &file_tyto_proto_msgTypes[11]
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 Command.ProtoReflect.Descriptor instead.
func (*Command) Descriptor() ([]byte, []int) {
return file_tyto_proto_rawDescGZIP(), []int{11}
}
func (x *Command) GetType() CommandType {
if x != nil {
return x.Type
}
return CommandType_COMMAND_TYPE_UNKNOWN
}
func (x *Command) GetParams() map[string]string {
if x != nil {
return x.Params
}
return nil
}
var File_tyto_proto protoreflect.FileDescriptor
const file_tyto_proto_rawDesc = "" +
"\n" +
"\n" +
"tyto.proto\x12\x04tyto\"\xa9\x01\n" +
"\fAgentMessage\x12/\n" +
"\ametrics\x18\x01 \x01(\v2\x13.tyto.MetricsReportH\x00R\ametrics\x126\n" +
"\theartbeat\x18\x02 \x01(\v2\x16.tyto.HeartbeatRequestH\x00R\theartbeat\x12%\n" +
"\x04info\x18\x03 \x01(\v2\x0f.tyto.AgentInfoH\x00R\x04infoB\t\n" +
"\apayload\"\x92\x01\n" +
"\rServerMessage\x12,\n" +
"\x06config\x18\x01 \x01(\v2\x12.tyto.ConfigUpdateH\x00R\x06config\x12\x1d\n" +
"\x03ack\x18\x02 \x01(\v2\t.tyto.AckH\x00R\x03ack\x12)\n" +
"\acommand\x18\x03 \x01(\v2\r.tyto.CommandH\x00R\acommandB\t\n" +
"\apayload\"\x80\x02\n" +
"\rMetricsReport\x12\x19\n" +
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12!\n" +
"\ftimestamp_ms\x18\x02 \x01(\x03R\vtimestampMs\x12!\n" +
"\fmetrics_json\x18\x03 \x01(\fR\vmetricsJson\x12\x1b\n" +
"\tcpu_usage\x18\x04 \x01(\x01R\bcpuUsage\x12%\n" +
"\x0ememory_percent\x18\x05 \x01(\x01R\rmemoryPercent\x12!\n" +
"\fdisk_percent\x18\x06 \x01(\x01R\vdiskPercent\x12'\n" +
"\x0fgpu_utilization\x18\a \x01(\x05R\x0egpuUtilization\"w\n" +
"\x10HeartbeatRequest\x12\x19\n" +
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12!\n" +
"\ftimestamp_ms\x18\x02 \x01(\x03R\vtimestampMs\x12%\n" +
"\x0euptime_seconds\x18\x03 \x01(\x03R\ruptimeSeconds\"`\n" +
"\x11HeartbeatResponse\x12$\n" +
"\x0eserver_time_ms\x18\x01 \x01(\x03R\fserverTimeMs\x12%\n" +
"\x0econfig_changed\x18\x02 \x01(\bR\rconfigChanged\"\xb4\x01\n" +
"\tAgentInfo\x12\x19\n" +
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12\x1a\n" +
"\bhostname\x18\x02 \x01(\tR\bhostname\x12\x0e\n" +
"\x02os\x18\x03 \x01(\tR\x02os\x12\"\n" +
"\farchitecture\x18\x04 \x01(\tR\farchitecture\x12\x18\n" +
"\aversion\x18\x05 \x01(\tR\aversion\x12\"\n" +
"\fcapabilities\x18\x06 \x03(\tR\fcapabilities\"g\n" +
"\x0fRegisterRequest\x12\x19\n" +
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12#\n" +
"\x04info\x18\x02 \x01(\v2\x0f.tyto.AgentInfoR\x04info\x12\x14\n" +
"\x05token\x18\x03 \x01(\tR\x05token\"\xa1\x01\n" +
"\x10RegisterResponse\x12\x1a\n" +
"\baccepted\x18\x01 \x01(\bR\baccepted\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12,\n" +
"\x06status\x18\x03 \x01(\x0e2\x14.tyto.RegisterStatusR\x06status\x12)\n" +
"\x06config\x18\x04 \x01(\v2\x11.tyto.AgentConfigR\x06config\"\xf8\x01\n" +
"\fConfigUpdate\x12>\n" +
"\x1bcollection_interval_seconds\x18\x01 \x01(\x05R\x19collectionIntervalSeconds\x12-\n" +
"\x12enabled_collectors\x18\x02 \x03(\tR\x11enabledCollectors\x12<\n" +
"\bsettings\x18\x03 \x03(\v2 .tyto.ConfigUpdate.SettingsEntryR\bsettings\x1a;\n" +
"\rSettingsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xf6\x01\n" +
"\vAgentConfig\x12>\n" +
"\x1bcollection_interval_seconds\x18\x01 \x01(\x05R\x19collectionIntervalSeconds\x12-\n" +
"\x12enabled_collectors\x18\x02 \x03(\tR\x11enabledCollectors\x12;\n" +
"\bsettings\x18\x03 \x03(\v2\x1f.tyto.AgentConfig.SettingsEntryR\bsettings\x1a;\n" +
"\rSettingsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"T\n" +
"\x03Ack\x12\x1d\n" +
"\n" +
"message_id\x18\x01 \x01(\x03R\tmessageId\x12\x18\n" +
"\asuccess\x18\x02 \x01(\bR\asuccess\x12\x14\n" +
"\x05error\x18\x03 \x01(\tR\x05error\"\x9e\x01\n" +
"\aCommand\x12%\n" +
"\x04type\x18\x01 \x01(\x0e2\x11.tyto.CommandTypeR\x04type\x121\n" +
"\x06params\x18\x02 \x03(\v2\x19.tyto.Command.ParamsEntryR\x06params\x1a9\n" +
"\vParamsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01*\xb7\x01\n" +
"\x0eRegisterStatus\x12\x1b\n" +
"\x17REGISTER_STATUS_UNKNOWN\x10\x00\x12\x1c\n" +
"\x18REGISTER_STATUS_ACCEPTED\x10\x01\x12$\n" +
" REGISTER_STATUS_PENDING_APPROVAL\x10\x02\x12\x1c\n" +
"\x18REGISTER_STATUS_REJECTED\x10\x03\x12&\n" +
"\"REGISTER_STATUS_ALREADY_REGISTERED\x10\x04*\x9c\x01\n" +
"\vCommandType\x12\x18\n" +
"\x14COMMAND_TYPE_UNKNOWN\x10\x00\x12\x1c\n" +
"\x18COMMAND_TYPE_COLLECT_NOW\x10\x01\x12\x18\n" +
"\x14COMMAND_TYPE_RESTART\x10\x02\x12\x1e\n" +
"\x1aCOMMAND_TYPE_UPDATE_CONFIG\x10\x03\x12\x1b\n" +
"\x17COMMAND_TYPE_DISCONNECT\x10\x042\xbe\x01\n" +
"\fAgentService\x125\n" +
"\x06Stream\x12\x12.tyto.AgentMessage\x1a\x13.tyto.ServerMessage(\x010\x01\x129\n" +
"\bRegister\x12\x15.tyto.RegisterRequest\x1a\x16.tyto.RegisterResponse\x12<\n" +
"\tHeartbeat\x12\x16.tyto.HeartbeatRequest\x1a\x17.tyto.HeartbeatResponseB\x15Z\x13tyto/internal/protob\x06proto3"
var (
file_tyto_proto_rawDescOnce sync.Once
file_tyto_proto_rawDescData []byte
)
func file_tyto_proto_rawDescGZIP() []byte {
file_tyto_proto_rawDescOnce.Do(func() {
file_tyto_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_tyto_proto_rawDesc), len(file_tyto_proto_rawDesc)))
})
return file_tyto_proto_rawDescData
}
var file_tyto_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_tyto_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_tyto_proto_goTypes = []any{
(RegisterStatus)(0), // 0: tyto.RegisterStatus
(CommandType)(0), // 1: tyto.CommandType
(*AgentMessage)(nil), // 2: tyto.AgentMessage
(*ServerMessage)(nil), // 3: tyto.ServerMessage
(*MetricsReport)(nil), // 4: tyto.MetricsReport
(*HeartbeatRequest)(nil), // 5: tyto.HeartbeatRequest
(*HeartbeatResponse)(nil), // 6: tyto.HeartbeatResponse
(*AgentInfo)(nil), // 7: tyto.AgentInfo
(*RegisterRequest)(nil), // 8: tyto.RegisterRequest
(*RegisterResponse)(nil), // 9: tyto.RegisterResponse
(*ConfigUpdate)(nil), // 10: tyto.ConfigUpdate
(*AgentConfig)(nil), // 11: tyto.AgentConfig
(*Ack)(nil), // 12: tyto.Ack
(*Command)(nil), // 13: tyto.Command
nil, // 14: tyto.ConfigUpdate.SettingsEntry
nil, // 15: tyto.AgentConfig.SettingsEntry
nil, // 16: tyto.Command.ParamsEntry
}
var file_tyto_proto_depIdxs = []int32{
4, // 0: tyto.AgentMessage.metrics:type_name -> tyto.MetricsReport
5, // 1: tyto.AgentMessage.heartbeat:type_name -> tyto.HeartbeatRequest
7, // 2: tyto.AgentMessage.info:type_name -> tyto.AgentInfo
10, // 3: tyto.ServerMessage.config:type_name -> tyto.ConfigUpdate
12, // 4: tyto.ServerMessage.ack:type_name -> tyto.Ack
13, // 5: tyto.ServerMessage.command:type_name -> tyto.Command
7, // 6: tyto.RegisterRequest.info:type_name -> tyto.AgentInfo
0, // 7: tyto.RegisterResponse.status:type_name -> tyto.RegisterStatus
11, // 8: tyto.RegisterResponse.config:type_name -> tyto.AgentConfig
14, // 9: tyto.ConfigUpdate.settings:type_name -> tyto.ConfigUpdate.SettingsEntry
15, // 10: tyto.AgentConfig.settings:type_name -> tyto.AgentConfig.SettingsEntry
1, // 11: tyto.Command.type:type_name -> tyto.CommandType
16, // 12: tyto.Command.params:type_name -> tyto.Command.ParamsEntry
2, // 13: tyto.AgentService.Stream:input_type -> tyto.AgentMessage
8, // 14: tyto.AgentService.Register:input_type -> tyto.RegisterRequest
5, // 15: tyto.AgentService.Heartbeat:input_type -> tyto.HeartbeatRequest
3, // 16: tyto.AgentService.Stream:output_type -> tyto.ServerMessage
9, // 17: tyto.AgentService.Register:output_type -> tyto.RegisterResponse
6, // 18: tyto.AgentService.Heartbeat:output_type -> tyto.HeartbeatResponse
16, // [16:19] is the sub-list for method output_type
13, // [13:16] is the sub-list for method input_type
13, // [13:13] is the sub-list for extension type_name
13, // [13:13] is the sub-list for extension extendee
0, // [0:13] is the sub-list for field type_name
}
func init() { file_tyto_proto_init() }
func file_tyto_proto_init() {
if File_tyto_proto != nil {
return
}
file_tyto_proto_msgTypes[0].OneofWrappers = []any{
(*AgentMessage_Metrics)(nil),
(*AgentMessage_Heartbeat)(nil),
(*AgentMessage_Info)(nil),
}
file_tyto_proto_msgTypes[1].OneofWrappers = []any{
(*ServerMessage_Config)(nil),
(*ServerMessage_Ack)(nil),
(*ServerMessage_Command)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_tyto_proto_rawDesc), len(file_tyto_proto_rawDesc)),
NumEnums: 2,
NumMessages: 15,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_tyto_proto_goTypes,
DependencyIndexes: file_tyto_proto_depIdxs,
EnumInfos: file_tyto_proto_enumTypes,
MessageInfos: file_tyto_proto_msgTypes,
}.Build()
File_tyto_proto = out.File
file_tyto_proto_goTypes = nil
file_tyto_proto_depIdxs = nil
}