WIP: implemented Ping, implemented Set and Shutdown in agent, and added umask

This commit is contained in:
2025-06-23 16:43:53 +10:00
parent cfdfcb6ed5
commit b22529be7b
10 changed files with 243 additions and 60 deletions

View File

@@ -1,8 +1,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v6.31.1
// source: gitea.suyono.dev/suyono/go-agent/proto/agent.proto
// protoc v5.29.3
// source: agent.proto
package proto
@@ -31,7 +31,7 @@ type CacheGetRequest struct {
func (x *CacheGetRequest) Reset() {
*x = CacheGetRequest{}
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[0]
mi := &file_agent_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -43,7 +43,7 @@ func (x *CacheGetRequest) String() string {
func (*CacheGetRequest) ProtoMessage() {}
func (x *CacheGetRequest) ProtoReflect() protoreflect.Message {
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[0]
mi := &file_agent_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -56,7 +56,7 @@ func (x *CacheGetRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CacheGetRequest.ProtoReflect.Descriptor instead.
func (*CacheGetRequest) Descriptor() ([]byte, []int) {
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP(), []int{0}
return file_agent_proto_rawDescGZIP(), []int{0}
}
func (x *CacheGetRequest) GetKey() string {
@@ -77,7 +77,7 @@ type CacheValue struct {
func (x *CacheValue) Reset() {
*x = CacheValue{}
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[1]
mi := &file_agent_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -89,7 +89,7 @@ func (x *CacheValue) String() string {
func (*CacheValue) ProtoMessage() {}
func (x *CacheValue) ProtoReflect() protoreflect.Message {
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[1]
mi := &file_agent_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -102,7 +102,7 @@ func (x *CacheValue) ProtoReflect() protoreflect.Message {
// Deprecated: Use CacheValue.ProtoReflect.Descriptor instead.
func (*CacheValue) Descriptor() ([]byte, []int) {
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP(), []int{1}
return file_agent_proto_rawDescGZIP(), []int{1}
}
func (x *CacheValue) GetStatus() string {
@@ -136,7 +136,7 @@ type CacheSetRequest struct {
func (x *CacheSetRequest) Reset() {
*x = CacheSetRequest{}
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[2]
mi := &file_agent_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -148,7 +148,7 @@ func (x *CacheSetRequest) String() string {
func (*CacheSetRequest) ProtoMessage() {}
func (x *CacheSetRequest) ProtoReflect() protoreflect.Message {
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[2]
mi := &file_agent_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -161,7 +161,7 @@ func (x *CacheSetRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CacheSetRequest.ProtoReflect.Descriptor instead.
func (*CacheSetRequest) Descriptor() ([]byte, []int) {
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP(), []int{2}
return file_agent_proto_rawDescGZIP(), []int{2}
}
func (x *CacheSetRequest) GetKey() string {
@@ -188,7 +188,7 @@ type SetStatus struct {
func (x *SetStatus) Reset() {
*x = SetStatus{}
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[3]
mi := &file_agent_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -200,7 +200,7 @@ func (x *SetStatus) String() string {
func (*SetStatus) ProtoMessage() {}
func (x *SetStatus) ProtoReflect() protoreflect.Message {
mi := &file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes[3]
mi := &file_agent_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -213,7 +213,7 @@ func (x *SetStatus) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetStatus.ProtoReflect.Descriptor instead.
func (*SetStatus) Descriptor() ([]byte, []int) {
return file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP(), []int{3}
return file_agent_proto_rawDescGZIP(), []int{3}
}
func (x *SetStatus) GetStatus() string {
@@ -230,11 +230,11 @@ func (x *SetStatus) GetMessage() string {
return ""
}
var File_gitea_suyono_dev_suyono_go_agent_proto_agent_proto protoreflect.FileDescriptor
var File_agent_proto protoreflect.FileDescriptor
const file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc = "" +
const file_agent_proto_rawDesc = "" +
"\n" +
"2gitea.suyono.dev/suyono/go-agent/proto/agent.proto\x12\x05proto\x1a\x1bgoogle/protobuf/empty.proto\"#\n" +
"\vagent.proto\x12\x05proto\x1a\x1bgoogle/protobuf/empty.proto\"#\n" +
"\x0fCacheGetRequest\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\"T\n" +
"\n" +
@@ -247,66 +247,69 @@ const file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc = "" +
"\x05value\x18\x02 \x01(\tR\x05value\"=\n" +
"\tSetStatus\x12\x16\n" +
"\x06status\x18\x01 \x01(\tR\x06status\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage2\xa6\x01\n" +
"\amessage\x18\x02 \x01(\tR\amessage2\xde\x01\n" +
"\x05Agent\x120\n" +
"\x03Get\x12\x16.proto.CacheGetRequest\x1a\x11.proto.CacheValue\x12/\n" +
"\x03Set\x12\x16.proto.CacheSetRequest\x1a\x10.proto.SetStatus\x12:\n" +
"\bShutdown\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.EmptyB.Z,gitea.suyono.dev/suyono/go-agent/proto;protob\x06proto3"
"\bShutdown\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\x126\n" +
"\x04Ping\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.EmptyB.Z,gitea.suyono.dev/suyono/go-agent/proto;protob\x06proto3"
var (
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescOnce sync.Once
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescData []byte
file_agent_proto_rawDescOnce sync.Once
file_agent_proto_rawDescData []byte
)
func file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescGZIP() []byte {
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescOnce.Do(func() {
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc), len(file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc)))
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_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDescData
return file_agent_proto_rawDescData
}
var file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_goTypes = []any{
var file_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_agent_proto_goTypes = []any{
(*CacheGetRequest)(nil), // 0: proto.CacheGetRequest
(*CacheValue)(nil), // 1: proto.CacheValue
(*CacheSetRequest)(nil), // 2: proto.CacheSetRequest
(*SetStatus)(nil), // 3: proto.SetStatus
(*emptypb.Empty)(nil), // 4: google.protobuf.Empty
}
var file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_depIdxs = []int32{
var file_agent_proto_depIdxs = []int32{
0, // 0: proto.Agent.Get:input_type -> proto.CacheGetRequest
2, // 1: proto.Agent.Set:input_type -> proto.CacheSetRequest
4, // 2: proto.Agent.Shutdown:input_type -> google.protobuf.Empty
1, // 3: proto.Agent.Get:output_type -> proto.CacheValue
3, // 4: proto.Agent.Set:output_type -> proto.SetStatus
4, // 5: proto.Agent.Shutdown:output_type -> google.protobuf.Empty
3, // [3:6] is the sub-list for method output_type
0, // [0:3] is the sub-list for method input_type
4, // 3: proto.Agent.Ping:input_type -> google.protobuf.Empty
1, // 4: proto.Agent.Get:output_type -> proto.CacheValue
3, // 5: proto.Agent.Set:output_type -> proto.SetStatus
4, // 6: proto.Agent.Shutdown:output_type -> google.protobuf.Empty
4, // 7: proto.Agent.Ping:output_type -> google.protobuf.Empty
4, // [4:8] is the sub-list for method output_type
0, // [0:4] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_init() }
func file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_init() {
if File_gitea_suyono_dev_suyono_go_agent_proto_agent_proto != nil {
func init() { file_agent_proto_init() }
func file_agent_proto_init() {
if File_agent_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc), len(file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_rawDesc)),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_agent_proto_rawDesc), len(file_agent_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_goTypes,
DependencyIndexes: file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_depIdxs,
MessageInfos: file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_msgTypes,
GoTypes: file_agent_proto_goTypes,
DependencyIndexes: file_agent_proto_depIdxs,
MessageInfos: file_agent_proto_msgTypes,
}.Build()
File_gitea_suyono_dev_suyono_go_agent_proto_agent_proto = out.File
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_goTypes = nil
file_gitea_suyono_dev_suyono_go_agent_proto_agent_proto_depIdxs = nil
File_agent_proto = out.File
file_agent_proto_goTypes = nil
file_agent_proto_depIdxs = nil
}