feat: initial commit

This commit is contained in:
2026-09-01 00:54:46 +02:00
commit 620f5f2b82
11 changed files with 525 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
# Service
the service runs on port 1337
+126
View File
@@ -0,0 +1,126 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v6.33.2
// source: proto/service.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 PingMessage struct {
state protoimpl.MessageState `protogen:"open.v1"`
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *PingMessage) Reset() {
*x = PingMessage{}
mi := &file_proto_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PingMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PingMessage) ProtoMessage() {}
func (x *PingMessage) ProtoReflect() protoreflect.Message {
mi := &file_proto_service_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 PingMessage.ProtoReflect.Descriptor instead.
func (*PingMessage) Descriptor() ([]byte, []int) {
return file_proto_service_proto_rawDescGZIP(), []int{0}
}
func (x *PingMessage) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
var File_proto_service_proto protoreflect.FileDescriptor
const file_proto_service_proto_rawDesc = "" +
"\n" +
"\x13proto/service.proto\"'\n" +
"\vPingMessage\x12\x18\n" +
"\amessage\x18\x01 \x01(\tR\amessage2-\n" +
"\aService\x12\"\n" +
"\x04Ping\x12\f.PingMessage\x1a\f.PingMessageB\x0eZ\fgogrpc/protob\x06proto3"
var (
file_proto_service_proto_rawDescOnce sync.Once
file_proto_service_proto_rawDescData []byte
)
func file_proto_service_proto_rawDescGZIP() []byte {
file_proto_service_proto_rawDescOnce.Do(func() {
file_proto_service_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_service_proto_rawDesc), len(file_proto_service_proto_rawDesc)))
})
return file_proto_service_proto_rawDescData
}
var file_proto_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_proto_service_proto_goTypes = []any{
(*PingMessage)(nil), // 0: PingMessage
}
var file_proto_service_proto_depIdxs = []int32{
0, // 0: Service.Ping:input_type -> PingMessage
0, // 1: Service.Ping:output_type -> PingMessage
1, // [1:2] is the sub-list for method output_type
0, // [0:1] 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_proto_service_proto_init() }
func file_proto_service_proto_init() {
if File_proto_service_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_service_proto_rawDesc), len(file_proto_service_proto_rawDesc)),
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_proto_service_proto_goTypes,
DependencyIndexes: file_proto_service_proto_depIdxs,
MessageInfos: file_proto_service_proto_msgTypes,
}.Build()
File_proto_service_proto = out.File
file_proto_service_proto_goTypes = nil
file_proto_service_proto_depIdxs = nil
}
+11
View File
@@ -0,0 +1,11 @@
syntax = "proto3";
option go_package = "gogrpc/proto";
message PingMessage {
string message = 1;
}
service Service {
rpc Ping (PingMessage) returns (PingMessage);
}
+122
View File
@@ -0,0 +1,122 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.2
// source: proto/service.proto
package proto
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 (
Service_Ping_FullMethodName = "/Service/Ping"
)
// ServiceClient is the client API for Service 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 ServiceClient interface {
Ping(ctx context.Context, in *PingMessage, opts ...grpc.CallOption) (*PingMessage, error)
}
type serviceClient struct {
cc grpc.ClientConnInterface
}
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
return &serviceClient{cc}
}
func (c *serviceClient) Ping(ctx context.Context, in *PingMessage, opts ...grpc.CallOption) (*PingMessage, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PingMessage)
err := c.cc.Invoke(ctx, Service_Ping_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServiceServer is the server API for Service service.
// All implementations must embed UnimplementedServiceServer
// for forward compatibility.
type ServiceServer interface {
Ping(context.Context, *PingMessage) (*PingMessage, error)
mustEmbedUnimplementedServiceServer()
}
// UnimplementedServiceServer 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 UnimplementedServiceServer struct{}
func (UnimplementedServiceServer) Ping(context.Context, *PingMessage) (*PingMessage, error) {
return nil, status.Error(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {}
func (UnimplementedServiceServer) testEmbeddedByValue() {}
// UnsafeServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ServiceServer will
// result in compilation errors.
type UnsafeServiceServer interface {
mustEmbedUnimplementedServiceServer()
}
func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer) {
// If the following call panics, it indicates UnimplementedServiceServer 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(&Service_ServiceDesc, srv)
}
func _Service_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PingMessage)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServiceServer).Ping(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Service_Ping_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServiceServer).Ping(ctx, req.(*PingMessage))
}
return interceptor(ctx, in, info, handler)
}
// Service_ServiceDesc is the grpc.ServiceDesc for Service service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Service_ServiceDesc = grpc.ServiceDesc{
ServiceName: "Service",
HandlerType: (*ServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Ping",
Handler: _Service_Ping_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "proto/service.proto",
}