Server test

This commit is contained in:
bdnugget 2024-10-10 10:52:35 +02:00
parent d035a9cff4
commit 353a104675
3 changed files with 215 additions and 2 deletions

211
actions/actions.pb.go Normal file
View File

@ -0,0 +1,211 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.12
// source: actions.proto
package actions
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Action_ActionType int32
const (
Action_MOVE Action_ActionType = 0
)
// Enum value maps for Action_ActionType.
var (
Action_ActionType_name = map[int32]string{
0: "MOVE",
}
Action_ActionType_value = map[string]int32{
"MOVE": 0,
}
)
func (x Action_ActionType) Enum() *Action_ActionType {
p := new(Action_ActionType)
*p = x
return p
}
func (x Action_ActionType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Action_ActionType) Descriptor() protoreflect.EnumDescriptor {
return file_actions_proto_enumTypes[0].Descriptor()
}
func (Action_ActionType) Type() protoreflect.EnumType {
return &file_actions_proto_enumTypes[0]
}
func (x Action_ActionType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Action_ActionType.Descriptor instead.
func (Action_ActionType) EnumDescriptor() ([]byte, []int) {
return file_actions_proto_rawDescGZIP(), []int{0, 0}
}
type Action struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Type Action_ActionType `protobuf:"varint,1,opt,name=type,proto3,enum=actions.Action_ActionType" json:"type,omitempty"`
X int32 `protobuf:"varint,2,opt,name=x,proto3" json:"x,omitempty"`
Y int32 `protobuf:"varint,3,opt,name=y,proto3" json:"y,omitempty"`
}
func (x *Action) Reset() {
*x = Action{}
if protoimpl.UnsafeEnabled {
mi := &file_actions_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Action) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Action) ProtoMessage() {}
func (x *Action) ProtoReflect() protoreflect.Message {
mi := &file_actions_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Action.ProtoReflect.Descriptor instead.
func (*Action) Descriptor() ([]byte, []int) {
return file_actions_proto_rawDescGZIP(), []int{0}
}
func (x *Action) GetType() Action_ActionType {
if x != nil {
return x.Type
}
return Action_MOVE
}
func (x *Action) GetX() int32 {
if x != nil {
return x.X
}
return 0
}
func (x *Action) GetY() int32 {
if x != nil {
return x.Y
}
return 0
}
var File_actions_proto protoreflect.FileDescriptor
var file_actions_proto_rawDesc = []byte{
0x0a, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x6c, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x1a, 0x2e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79,
0x70, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78,
0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0x16,
0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04,
0x4d, 0x4f, 0x56, 0x45, 0x10, 0x00, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x65, 0x61, 0x2e,
0x62, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x62, 0x65, 0x2f, 0x62, 0x64, 0x6e, 0x75, 0x67, 0x67, 0x65,
0x74, 0x2f, 0x67, 0x6f, 0x6f, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_actions_proto_rawDescOnce sync.Once
file_actions_proto_rawDescData = file_actions_proto_rawDesc
)
func file_actions_proto_rawDescGZIP() []byte {
file_actions_proto_rawDescOnce.Do(func() {
file_actions_proto_rawDescData = protoimpl.X.CompressGZIP(file_actions_proto_rawDescData)
})
return file_actions_proto_rawDescData
}
var file_actions_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_actions_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_actions_proto_goTypes = []interface{}{
(Action_ActionType)(0), // 0: actions.Action.ActionType
(*Action)(nil), // 1: actions.Action
}
var file_actions_proto_depIdxs = []int32{
0, // 0: actions.Action.type:type_name -> actions.Action.ActionType
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_actions_proto_init() }
func file_actions_proto_init() {
if File_actions_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_actions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Action); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_actions_proto_rawDesc,
NumEnums: 1,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_actions_proto_goTypes,
DependencyIndexes: file_actions_proto_depIdxs,
EnumInfos: file_actions_proto_enumTypes,
MessageInfos: file_actions_proto_msgTypes,
}.Build()
File_actions_proto = out.File
file_actions_proto_rawDesc = nil
file_actions_proto_goTypes = nil
file_actions_proto_depIdxs = nil
}

View File

@ -2,6 +2,8 @@ syntax = "proto3";
package actions;
option go_package = "gitea.boner.be/bdnugget/goonserver/actions";
message Action {
enum ActionType {
MOVE = 0;

View File

@ -6,13 +6,13 @@ import (
"net"
"time"
pb "path/to/your/protobuf/package" // Change this to your actual protobuf package path
pb "gitea.boner.be/bdnugget/goonserver/actions"
"google.golang.org/protobuf/proto"
)
const (
port = ":5000" // Port to listen on
port = ":6969" // Port to listen on
tickRate = 600 * time.Millisecond
)