diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..498e275 Binary files /dev/null and b/.DS_Store differ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c64d6e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:1.22 as builder + +WORKDIR /app +COPY . . + +RUN go mod download +RUN go build -o /core main.go + +FROM gcr.io/distroless/static +COPY --from=builder /core /core + +ENTRYPOINT ["/core"] diff --git a/Makefile b/Makefile index 555ab8d..4dc2119 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ GO_BASE := git.espin.casa/albert/go-telecom PROTOC := protoc PROTOC_GEN_GO := $(shell which protoc-gen-go) PROTOC_GEN_GO_GRPC := $(shell which protoc-gen-go-grpc) - +PROTOC_GEN_GO_VERSION := $(shell $(PROTOC_GEN_GO) --version) # Archivos .proto PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto) @@ -23,18 +23,18 @@ proto: @mkdir -p $(OUT_DIR) $(PROTOC) \ --proto_path=$(PROTO_DIR) \ - --go_out=$(OUT_DIR) \ + --twirp_out=$(OUT_DIR) \ --go-grpc_out=$(OUT_DIR) \ $(PROTO_FILES) ## Build binario principal (solo CLI cobra, por ejemplo) build: - @echo "🔨 Compiling main binary..." - go build -o bin/procontel main.go + @echo "🔨 Compiling main binary..." + go build -o bin/procontel main.go ## Ejecutar servicios individuales run-core: - go run main.go core + go run main.go core m run-admin: go run main.go admin diff --git a/README.md b/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/cmd/core.go b/cmd/core.go index a6e8455..7d69d30 100644 --- a/cmd/core.go +++ b/cmd/core.go @@ -1,28 +1,24 @@ /* Copyright © 2025 NAME HERE - */ package cmd import ( - "fmt" - + "git.espin.casa/albert/go-telecom/internal/core" "github.com/spf13/cobra" ) // coreCmd represents the core command var coreCmd = &cobra.Command{ Use: "core", - Short: "A brief description of your command", - Long: `A longer description that spans multiple lines and likely contains examples -and usage of using your command. For example: - -Cobra is a CLI library for Go that empowers applications. -This application is a tool to generate the needed files -to quickly create a Cobra application.`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("core called") - }, + Short: "Go-telecom core commands.", + // A longer description that spans multiple lines and likely contains examples + // and usage of using your command. + // You can also use the following for a more detailed description: + Long: `Go-telecom core service. +This service is used to manage the core functionalities of the Go-Telecom application. +It includes various subcommands to interact with services.`, + Run: core.Run, } func init() { diff --git a/go.mod b/go.mod index a24e3ab..1ca0fdd 100644 --- a/go.mod +++ b/go.mod @@ -2,9 +2,34 @@ module git.espin.casa/albert/go-telecom go 1.24.1 -require github.com/spf13/cobra v1.9.1 +require ( + github.com/spf13/cobra v1.9.1 + github.com/twitchtv/twirp v8.1.3+incompatible + go.opentelemetry.io/otel v1.35.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 + go.opentelemetry.io/otel/sdk v1.35.0 + google.golang.org/grpc v1.72.0 + google.golang.org/protobuf v1.36.6 +) require ( + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/spf13/pflag v1.0.6 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect + go.opentelemetry.io/otel/metric v1.35.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.35.0 // indirect + go.opentelemetry.io/otel/trace v1.35.0 // indirect + go.opentelemetry.io/proto/otlp v1.5.0 // indirect + golang.org/x/net v0.39.0 // indirect + golang.org/x/sys v0.32.0 // indirect + golang.org/x/text v0.24.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250422160041-2d3770c4ea7f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f // indirect ) diff --git a/go.sum b/go.sum index ffae55e..fc588a3 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,70 @@ +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/twitchtv/twirp v8.1.3+incompatible h1:+F4TdErPgSUbMZMwp13Q/KgDVuI7HJXP61mNV3/7iuU= +github.com/twitchtv/twirp v8.1.3+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= +go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 h1:xJ2qHD0C1BeYVTLLR9sX12+Qb95kfeD/byKj6Ky1pXg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0/go.mod h1:u5BF1xyjstDowA1R5QAO9JHzqK+ublenEW/dyqTjBVk= +go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M= +go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE= +go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= +go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= +go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= +go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= +go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= +go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= +go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= +go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +google.golang.org/genproto/googleapis/api v0.0.0-20250422160041-2d3770c4ea7f h1:tjZsroqekhC63+WMqzmWyW5Twj/ZfR5HAlpd5YQ1Vs0= +google.golang.org/genproto/googleapis/api v0.0.0-20250422160041-2d3770c4ea7f/go.mod h1:Cd8IzgPo5Akum2c9R6FsXNaZbH3Jpa2gpHlW89FqlyQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f h1:N/PrbTw4kdkqNRzVfWPrBekzLuarFREcbFOiOLkXon4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= +google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/.DS_Store b/internal/.DS_Store new file mode 100644 index 0000000..ac599b5 Binary files /dev/null and b/internal/.DS_Store differ diff --git a/internal/core/core.go b/internal/core/core.go new file mode 100644 index 0000000..fbb2dc2 --- /dev/null +++ b/internal/core/core.go @@ -0,0 +1,53 @@ +package core + +import ( + "os" + "os/signal" + "syscall" + + "git.espin.casa/albert/go-telecom/internal/trace" + "github.com/spf13/cobra" +) + +func Run(cmd *cobra.Command, args []string) { + + tp, err := trace.InitTrace() + if err != nil { + panic(err) + } + defer func() { + if err := tp.Shutdown(cmd.Context()); err != nil { + panic(err) + } + }() + // wait signal to finish + signal := WaitSignal() + switch signal { + case syscall.SIGINT: + cmd.Println("Received SIGINT, shutting down...") + case syscall.SIGQUIT: + cmd.Println("Received SIGQUIT, shutting down...") + case syscall.SIGTERM: + cmd.Println("Received SIGTERM, shutting down...") + default: + cmd.Println("Received unknown signal, shutting down...") + } +} + +// WaitSignal catching exit signal +func WaitSignal() os.Signal { + ch := make(chan os.Signal, 2) + signal.Notify( + ch, + syscall.SIGINT, + syscall.SIGQUIT, + syscall.SIGTERM, + ) + for { + sig := <-ch + switch sig { + case syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM: + return sig + } + } +} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/adaptor/adaptor.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/adaptor/adaptor.pb.go deleted file mode 100644 index 78c3794..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/adaptor/adaptor.pb.go +++ /dev/null @@ -1,197 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v5.29.3 -// source: adaptor.proto - -package adaptor - -import ( - common "git.espin.casa/albert/go-telecom/proto/common" - 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 DataMessage struct { - state protoimpl.MessageState `protogen:"open.v1"` - Origin string `protobuf:"bytes,1,opt,name=origin,proto3" json:"origin,omitempty"` - Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DataMessage) Reset() { - *x = DataMessage{} - mi := &file_adaptor_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DataMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DataMessage) ProtoMessage() {} - -func (x *DataMessage) ProtoReflect() protoreflect.Message { - mi := &file_adaptor_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 DataMessage.ProtoReflect.Descriptor instead. -func (*DataMessage) Descriptor() ([]byte, []int) { - return file_adaptor_proto_rawDescGZIP(), []int{0} -} - -func (x *DataMessage) GetOrigin() string { - if x != nil { - return x.Origin - } - return "" -} - -func (x *DataMessage) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -func (x *DataMessage) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -type Ack struct { - state protoimpl.MessageState `protogen:"open.v1"` - Received bool `protobuf:"varint,1,opt,name=received,proto3" json:"received,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Ack) Reset() { - *x = Ack{} - mi := &file_adaptor_proto_msgTypes[1] - 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_adaptor_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 Ack.ProtoReflect.Descriptor instead. -func (*Ack) Descriptor() ([]byte, []int) { - return file_adaptor_proto_rawDescGZIP(), []int{1} -} - -func (x *Ack) GetReceived() bool { - if x != nil { - return x.Received - } - return false -} - -var File_adaptor_proto protoreflect.FileDescriptor - -const file_adaptor_proto_rawDesc = "" + - "\n" + - "\radaptor.proto\x12\aadapter\x1a\fcommon.proto\"]\n" + - "\vDataMessage\x12\x16\n" + - "\x06origin\x18\x01 \x01(\tR\x06origin\x12\x18\n" + - "\apayload\x18\x02 \x01(\fR\apayload\x12\x1c\n" + - "\ttimestamp\x18\x03 \x01(\x03R\ttimestamp\"!\n" + - "\x03Ack\x12\x1a\n" + - "\breceived\x18\x01 \x01(\bR\breceived2\x88\x01\n" + - "\x0eAdapterService\x12F\n" + - "\vHealthCheck\x12\x1a.common.HealthCheckRequest\x1a\x1b.common.HealthCheckResponse\x12.\n" + - "\bSendData\x12\x14.adapter.DataMessage\x1a\f.adapter.AckB8Z6git.espin.casa/albert/go-telecom/proto/adaptor;adaptorb\x06proto3" - -var ( - file_adaptor_proto_rawDescOnce sync.Once - file_adaptor_proto_rawDescData []byte -) - -func file_adaptor_proto_rawDescGZIP() []byte { - file_adaptor_proto_rawDescOnce.Do(func() { - file_adaptor_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_adaptor_proto_rawDesc), len(file_adaptor_proto_rawDesc))) - }) - return file_adaptor_proto_rawDescData -} - -var file_adaptor_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_adaptor_proto_goTypes = []any{ - (*DataMessage)(nil), // 0: adapter.DataMessage - (*Ack)(nil), // 1: adapter.Ack - (*common.HealthCheckRequest)(nil), // 2: common.HealthCheckRequest - (*common.HealthCheckResponse)(nil), // 3: common.HealthCheckResponse -} -var file_adaptor_proto_depIdxs = []int32{ - 2, // 0: adapter.AdapterService.HealthCheck:input_type -> common.HealthCheckRequest - 0, // 1: adapter.AdapterService.SendData:input_type -> adapter.DataMessage - 3, // 2: adapter.AdapterService.HealthCheck:output_type -> common.HealthCheckResponse - 1, // 3: adapter.AdapterService.SendData:output_type -> adapter.Ack - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] 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_adaptor_proto_init() } -func file_adaptor_proto_init() { - if File_adaptor_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_adaptor_proto_rawDesc), len(file_adaptor_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_adaptor_proto_goTypes, - DependencyIndexes: file_adaptor_proto_depIdxs, - MessageInfos: file_adaptor_proto_msgTypes, - }.Build() - File_adaptor_proto = out.File - file_adaptor_proto_goTypes = nil - file_adaptor_proto_depIdxs = nil -} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/adaptor/adaptor_grpc.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/adaptor/adaptor_grpc.pb.go deleted file mode 100644 index c55c61a..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/adaptor/adaptor_grpc.pb.go +++ /dev/null @@ -1,160 +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: adaptor.proto - -package adaptor - -import ( - context "context" - common "git.espin.casa/albert/go-telecom/proto/common" - 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 ( - AdapterService_HealthCheck_FullMethodName = "/adapter.AdapterService/HealthCheck" - AdapterService_SendData_FullMethodName = "/adapter.AdapterService/SendData" -) - -// AdapterServiceClient is the client API for AdapterService 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 AdapterServiceClient interface { - HealthCheck(ctx context.Context, in *common.HealthCheckRequest, opts ...grpc.CallOption) (*common.HealthCheckResponse, error) - SendData(ctx context.Context, in *DataMessage, opts ...grpc.CallOption) (*Ack, error) -} - -type adapterServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewAdapterServiceClient(cc grpc.ClientConnInterface) AdapterServiceClient { - return &adapterServiceClient{cc} -} - -func (c *adapterServiceClient) HealthCheck(ctx context.Context, in *common.HealthCheckRequest, opts ...grpc.CallOption) (*common.HealthCheckResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(common.HealthCheckResponse) - err := c.cc.Invoke(ctx, AdapterService_HealthCheck_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adapterServiceClient) SendData(ctx context.Context, in *DataMessage, opts ...grpc.CallOption) (*Ack, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Ack) - err := c.cc.Invoke(ctx, AdapterService_SendData_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AdapterServiceServer is the server API for AdapterService service. -// All implementations must embed UnimplementedAdapterServiceServer -// for forward compatibility. -type AdapterServiceServer interface { - HealthCheck(context.Context, *common.HealthCheckRequest) (*common.HealthCheckResponse, error) - SendData(context.Context, *DataMessage) (*Ack, error) - mustEmbedUnimplementedAdapterServiceServer() -} - -// UnimplementedAdapterServiceServer 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 UnimplementedAdapterServiceServer struct{} - -func (UnimplementedAdapterServiceServer) HealthCheck(context.Context, *common.HealthCheckRequest) (*common.HealthCheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") -} -func (UnimplementedAdapterServiceServer) SendData(context.Context, *DataMessage) (*Ack, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendData not implemented") -} -func (UnimplementedAdapterServiceServer) mustEmbedUnimplementedAdapterServiceServer() {} -func (UnimplementedAdapterServiceServer) testEmbeddedByValue() {} - -// UnsafeAdapterServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to AdapterServiceServer will -// result in compilation errors. -type UnsafeAdapterServiceServer interface { - mustEmbedUnimplementedAdapterServiceServer() -} - -func RegisterAdapterServiceServer(s grpc.ServiceRegistrar, srv AdapterServiceServer) { - // If the following call pancis, it indicates UnimplementedAdapterServiceServer 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(&AdapterService_ServiceDesc, srv) -} - -func _AdapterService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(common.HealthCheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdapterServiceServer).HealthCheck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdapterService_HealthCheck_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdapterServiceServer).HealthCheck(ctx, req.(*common.HealthCheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdapterService_SendData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DataMessage) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdapterServiceServer).SendData(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdapterService_SendData_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdapterServiceServer).SendData(ctx, req.(*DataMessage)) - } - return interceptor(ctx, in, info, handler) -} - -// AdapterService_ServiceDesc is the grpc.ServiceDesc for AdapterService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var AdapterService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "adapter.AdapterService", - HandlerType: (*AdapterServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "HealthCheck", - Handler: _AdapterService_HealthCheck_Handler, - }, - { - MethodName: "SendData", - Handler: _AdapterService_SendData_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "adaptor.proto", -} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/admin/admin.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/admin/admin.pb.go deleted file mode 100644 index 47bc9db..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/admin/admin.pb.go +++ /dev/null @@ -1,188 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v5.29.3 -// source: admin.proto - -package admin - -import ( - common "git.espin.casa/albert/go-telecom/proto/common" - 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 ConfigUpdateRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ConfigUpdateRequest) Reset() { - *x = ConfigUpdateRequest{} - mi := &file_admin_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ConfigUpdateRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConfigUpdateRequest) ProtoMessage() {} - -func (x *ConfigUpdateRequest) ProtoReflect() protoreflect.Message { - mi := &file_admin_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 ConfigUpdateRequest.ProtoReflect.Descriptor instead. -func (*ConfigUpdateRequest) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{0} -} - -func (x *ConfigUpdateRequest) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *ConfigUpdateRequest) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type ConfigUpdateResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Updated bool `protobuf:"varint,1,opt,name=updated,proto3" json:"updated,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ConfigUpdateResponse) Reset() { - *x = ConfigUpdateResponse{} - mi := &file_admin_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ConfigUpdateResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConfigUpdateResponse) ProtoMessage() {} - -func (x *ConfigUpdateResponse) ProtoReflect() protoreflect.Message { - mi := &file_admin_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 ConfigUpdateResponse.ProtoReflect.Descriptor instead. -func (*ConfigUpdateResponse) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{1} -} - -func (x *ConfigUpdateResponse) GetUpdated() bool { - if x != nil { - return x.Updated - } - return false -} - -var File_admin_proto protoreflect.FileDescriptor - -const file_admin_proto_rawDesc = "" + - "\n" + - "\vadmin.proto\x12\x05admin\x1a\fcommon.proto\"=\n" + - "\x13ConfigUpdateRequest\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value\"0\n" + - "\x14ConfigUpdateResponse\x12\x18\n" + - "\aupdated\x18\x01 \x01(\bR\aupdated2\x9f\x01\n" + - "\fAdminService\x12F\n" + - "\vHealthCheck\x12\x1a.common.HealthCheckRequest\x1a\x1b.common.HealthCheckResponse\x12G\n" + - "\fUpdateConfig\x12\x1a.admin.ConfigUpdateRequest\x1a\x1b.admin.ConfigUpdateResponseB4Z2git.espin.casa/albert/go-telecom/proto/admin;adminb\x06proto3" - -var ( - file_admin_proto_rawDescOnce sync.Once - file_admin_proto_rawDescData []byte -) - -func file_admin_proto_rawDescGZIP() []byte { - file_admin_proto_rawDescOnce.Do(func() { - file_admin_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_admin_proto_rawDesc), len(file_admin_proto_rawDesc))) - }) - return file_admin_proto_rawDescData -} - -var file_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_admin_proto_goTypes = []any{ - (*ConfigUpdateRequest)(nil), // 0: admin.ConfigUpdateRequest - (*ConfigUpdateResponse)(nil), // 1: admin.ConfigUpdateResponse - (*common.HealthCheckRequest)(nil), // 2: common.HealthCheckRequest - (*common.HealthCheckResponse)(nil), // 3: common.HealthCheckResponse -} -var file_admin_proto_depIdxs = []int32{ - 2, // 0: admin.AdminService.HealthCheck:input_type -> common.HealthCheckRequest - 0, // 1: admin.AdminService.UpdateConfig:input_type -> admin.ConfigUpdateRequest - 3, // 2: admin.AdminService.HealthCheck:output_type -> common.HealthCheckResponse - 1, // 3: admin.AdminService.UpdateConfig:output_type -> admin.ConfigUpdateResponse - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] 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_admin_proto_init() } -func file_admin_proto_init() { - if File_admin_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_admin_proto_rawDesc), len(file_admin_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_admin_proto_goTypes, - DependencyIndexes: file_admin_proto_depIdxs, - MessageInfos: file_admin_proto_msgTypes, - }.Build() - File_admin_proto = out.File - file_admin_proto_goTypes = nil - file_admin_proto_depIdxs = nil -} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/admin/admin_grpc.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/admin/admin_grpc.pb.go deleted file mode 100644 index e28f30b..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/admin/admin_grpc.pb.go +++ /dev/null @@ -1,160 +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: admin.proto - -package admin - -import ( - context "context" - common "git.espin.casa/albert/go-telecom/proto/common" - 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 ( - AdminService_HealthCheck_FullMethodName = "/admin.AdminService/HealthCheck" - AdminService_UpdateConfig_FullMethodName = "/admin.AdminService/UpdateConfig" -) - -// AdminServiceClient is the client API for AdminService 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 AdminServiceClient interface { - HealthCheck(ctx context.Context, in *common.HealthCheckRequest, opts ...grpc.CallOption) (*common.HealthCheckResponse, error) - UpdateConfig(ctx context.Context, in *ConfigUpdateRequest, opts ...grpc.CallOption) (*ConfigUpdateResponse, error) -} - -type adminServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient { - return &adminServiceClient{cc} -} - -func (c *adminServiceClient) HealthCheck(ctx context.Context, in *common.HealthCheckRequest, opts ...grpc.CallOption) (*common.HealthCheckResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(common.HealthCheckResponse) - err := c.cc.Invoke(ctx, AdminService_HealthCheck_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *adminServiceClient) UpdateConfig(ctx context.Context, in *ConfigUpdateRequest, opts ...grpc.CallOption) (*ConfigUpdateResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ConfigUpdateResponse) - err := c.cc.Invoke(ctx, AdminService_UpdateConfig_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AdminServiceServer is the server API for AdminService service. -// All implementations must embed UnimplementedAdminServiceServer -// for forward compatibility. -type AdminServiceServer interface { - HealthCheck(context.Context, *common.HealthCheckRequest) (*common.HealthCheckResponse, error) - UpdateConfig(context.Context, *ConfigUpdateRequest) (*ConfigUpdateResponse, error) - mustEmbedUnimplementedAdminServiceServer() -} - -// UnimplementedAdminServiceServer 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 UnimplementedAdminServiceServer struct{} - -func (UnimplementedAdminServiceServer) HealthCheck(context.Context, *common.HealthCheckRequest) (*common.HealthCheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") -} -func (UnimplementedAdminServiceServer) UpdateConfig(context.Context, *ConfigUpdateRequest) (*ConfigUpdateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateConfig not implemented") -} -func (UnimplementedAdminServiceServer) mustEmbedUnimplementedAdminServiceServer() {} -func (UnimplementedAdminServiceServer) testEmbeddedByValue() {} - -// UnsafeAdminServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to AdminServiceServer will -// result in compilation errors. -type UnsafeAdminServiceServer interface { - mustEmbedUnimplementedAdminServiceServer() -} - -func RegisterAdminServiceServer(s grpc.ServiceRegistrar, srv AdminServiceServer) { - // If the following call pancis, it indicates UnimplementedAdminServiceServer 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(&AdminService_ServiceDesc, srv) -} - -func _AdminService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(common.HealthCheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).HealthCheck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_HealthCheck_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).HealthCheck(ctx, req.(*common.HealthCheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _AdminService_UpdateConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfigUpdateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AdminServiceServer).UpdateConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AdminService_UpdateConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AdminServiceServer).UpdateConfig(ctx, req.(*ConfigUpdateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// AdminService_ServiceDesc is the grpc.ServiceDesc for AdminService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var AdminService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "admin.AdminService", - HandlerType: (*AdminServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "HealthCheck", - Handler: _AdminService_HealthCheck_Handler, - }, - { - MethodName: "UpdateConfig", - Handler: _AdminService_UpdateConfig_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "admin.proto", -} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/common/common.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/common/common.pb.go deleted file mode 100644 index c49164e..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/common/common.pb.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v5.29.3 -// source: common.proto - -package common - -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 HealthCheckRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HealthCheckRequest) Reset() { - *x = HealthCheckRequest{} - mi := &file_common_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HealthCheckRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckRequest) ProtoMessage() {} - -func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message { - mi := &file_common_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 HealthCheckRequest.ProtoReflect.Descriptor instead. -func (*HealthCheckRequest) Descriptor() ([]byte, []int) { - return file_common_proto_rawDescGZIP(), []int{0} -} - -type HealthCheckResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *HealthCheckResponse) Reset() { - *x = HealthCheckResponse{} - mi := &file_common_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *HealthCheckResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheckResponse) ProtoMessage() {} - -func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message { - mi := &file_common_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 HealthCheckResponse.ProtoReflect.Descriptor instead. -func (*HealthCheckResponse) Descriptor() ([]byte, []int) { - return file_common_proto_rawDescGZIP(), []int{1} -} - -func (x *HealthCheckResponse) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -var File_common_proto protoreflect.FileDescriptor - -const file_common_proto_rawDesc = "" + - "\n" + - "\fcommon.proto\x12\x06common\"\x14\n" + - "\x12HealthCheckRequest\"-\n" + - "\x13HealthCheckResponse\x12\x16\n" + - "\x06status\x18\x01 \x01(\tR\x06statusB6Z4git.espin.casa/albert/go-telecom/proto/common;commonb\x06proto3" - -var ( - file_common_proto_rawDescOnce sync.Once - file_common_proto_rawDescData []byte -) - -func file_common_proto_rawDescGZIP() []byte { - file_common_proto_rawDescOnce.Do(func() { - file_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc))) - }) - return file_common_proto_rawDescData -} - -var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_common_proto_goTypes = []any{ - (*HealthCheckRequest)(nil), // 0: common.HealthCheckRequest - (*HealthCheckResponse)(nil), // 1: common.HealthCheckResponse -} -var file_common_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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_common_proto_init() } -func file_common_proto_init() { - if File_common_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_common_proto_goTypes, - DependencyIndexes: file_common_proto_depIdxs, - MessageInfos: file_common_proto_msgTypes, - }.Build() - File_common_proto = out.File - file_common_proto_goTypes = nil - file_common_proto_depIdxs = nil -} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/core/core.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/core/core.pb.go deleted file mode 100644 index 5dd31dc..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/core/core.pb.go +++ /dev/null @@ -1,189 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v5.29.3 -// source: core.proto - -package core - -import ( - common "git.espin.casa/albert/go-telecom/proto/common" - 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 StartRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - ProcessName string `protobuf:"bytes,1,opt,name=process_name,json=processName,proto3" json:"process_name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StartRequest) Reset() { - *x = StartRequest{} - mi := &file_core_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StartRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StartRequest) ProtoMessage() {} - -func (x *StartRequest) ProtoReflect() protoreflect.Message { - mi := &file_core_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 StartRequest.ProtoReflect.Descriptor instead. -func (*StartRequest) Descriptor() ([]byte, []int) { - return file_core_proto_rawDescGZIP(), []int{0} -} - -func (x *StartRequest) GetProcessName() string { - if x != nil { - return x.ProcessName - } - return "" -} - -type StartResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StartResponse) Reset() { - *x = StartResponse{} - mi := &file_core_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StartResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StartResponse) ProtoMessage() {} - -func (x *StartResponse) ProtoReflect() protoreflect.Message { - mi := &file_core_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 StartResponse.ProtoReflect.Descriptor instead. -func (*StartResponse) Descriptor() ([]byte, []int) { - return file_core_proto_rawDescGZIP(), []int{1} -} - -func (x *StartResponse) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *StartResponse) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -var File_core_proto protoreflect.FileDescriptor - -const file_core_proto_rawDesc = "" + - "\n" + - "\n" + - "core.proto\x12\x04core\x1a\fcommon.proto\"1\n" + - "\fStartRequest\x12!\n" + - "\fprocess_name\x18\x01 \x01(\tR\vprocessName\"C\n" + - "\rStartResponse\x12\x18\n" + - "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + - "\amessage\x18\x02 \x01(\tR\amessage2\x8e\x01\n" + - "\vCoreService\x12F\n" + - "\vHealthCheck\x12\x1a.common.HealthCheckRequest\x1a\x1b.common.HealthCheckResponse\x127\n" + - "\fStartProcess\x12\x12.core.StartRequest\x1a\x13.core.StartResponseB2Z0git.espin.casa/albert/go-telecom/proto/core;coreb\x06proto3" - -var ( - file_core_proto_rawDescOnce sync.Once - file_core_proto_rawDescData []byte -) - -func file_core_proto_rawDescGZIP() []byte { - file_core_proto_rawDescOnce.Do(func() { - file_core_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_core_proto_rawDesc), len(file_core_proto_rawDesc))) - }) - return file_core_proto_rawDescData -} - -var file_core_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_core_proto_goTypes = []any{ - (*StartRequest)(nil), // 0: core.StartRequest - (*StartResponse)(nil), // 1: core.StartResponse - (*common.HealthCheckRequest)(nil), // 2: common.HealthCheckRequest - (*common.HealthCheckResponse)(nil), // 3: common.HealthCheckResponse -} -var file_core_proto_depIdxs = []int32{ - 2, // 0: core.CoreService.HealthCheck:input_type -> common.HealthCheckRequest - 0, // 1: core.CoreService.StartProcess:input_type -> core.StartRequest - 3, // 2: core.CoreService.HealthCheck:output_type -> common.HealthCheckResponse - 1, // 3: core.CoreService.StartProcess:output_type -> core.StartResponse - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] 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_core_proto_init() } -func file_core_proto_init() { - if File_core_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_core_proto_rawDesc), len(file_core_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_core_proto_goTypes, - DependencyIndexes: file_core_proto_depIdxs, - MessageInfos: file_core_proto_msgTypes, - }.Build() - File_core_proto = out.File - file_core_proto_goTypes = nil - file_core_proto_depIdxs = nil -} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/core/core_grpc.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/core/core_grpc.pb.go deleted file mode 100644 index 4bff7b5..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/core/core_grpc.pb.go +++ /dev/null @@ -1,160 +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: core.proto - -package core - -import ( - context "context" - common "git.espin.casa/albert/go-telecom/proto/common" - 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 ( - CoreService_HealthCheck_FullMethodName = "/core.CoreService/HealthCheck" - CoreService_StartProcess_FullMethodName = "/core.CoreService/StartProcess" -) - -// CoreServiceClient is the client API for CoreService 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 CoreServiceClient interface { - HealthCheck(ctx context.Context, in *common.HealthCheckRequest, opts ...grpc.CallOption) (*common.HealthCheckResponse, error) - StartProcess(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) -} - -type coreServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewCoreServiceClient(cc grpc.ClientConnInterface) CoreServiceClient { - return &coreServiceClient{cc} -} - -func (c *coreServiceClient) HealthCheck(ctx context.Context, in *common.HealthCheckRequest, opts ...grpc.CallOption) (*common.HealthCheckResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(common.HealthCheckResponse) - err := c.cc.Invoke(ctx, CoreService_HealthCheck_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *coreServiceClient) StartProcess(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(StartResponse) - err := c.cc.Invoke(ctx, CoreService_StartProcess_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CoreServiceServer is the server API for CoreService service. -// All implementations must embed UnimplementedCoreServiceServer -// for forward compatibility. -type CoreServiceServer interface { - HealthCheck(context.Context, *common.HealthCheckRequest) (*common.HealthCheckResponse, error) - StartProcess(context.Context, *StartRequest) (*StartResponse, error) - mustEmbedUnimplementedCoreServiceServer() -} - -// UnimplementedCoreServiceServer 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 UnimplementedCoreServiceServer struct{} - -func (UnimplementedCoreServiceServer) HealthCheck(context.Context, *common.HealthCheckRequest) (*common.HealthCheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") -} -func (UnimplementedCoreServiceServer) StartProcess(context.Context, *StartRequest) (*StartResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StartProcess not implemented") -} -func (UnimplementedCoreServiceServer) mustEmbedUnimplementedCoreServiceServer() {} -func (UnimplementedCoreServiceServer) testEmbeddedByValue() {} - -// UnsafeCoreServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to CoreServiceServer will -// result in compilation errors. -type UnsafeCoreServiceServer interface { - mustEmbedUnimplementedCoreServiceServer() -} - -func RegisterCoreServiceServer(s grpc.ServiceRegistrar, srv CoreServiceServer) { - // If the following call pancis, it indicates UnimplementedCoreServiceServer 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(&CoreService_ServiceDesc, srv) -} - -func _CoreService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(common.HealthCheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CoreServiceServer).HealthCheck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CoreService_HealthCheck_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoreServiceServer).HealthCheck(ctx, req.(*common.HealthCheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CoreService_StartProcess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CoreServiceServer).StartProcess(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: CoreService_StartProcess_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoreServiceServer).StartProcess(ctx, req.(*StartRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// CoreService_ServiceDesc is the grpc.ServiceDesc for CoreService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var CoreService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "core.CoreService", - HandlerType: (*CoreServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "HealthCheck", - Handler: _CoreService_HealthCheck_Handler, - }, - { - MethodName: "StartProcess", - Handler: _CoreService_StartProcess_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "core.proto", -} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/monitor/monitor.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/monitor/monitor.pb.go deleted file mode 100644 index 73fcbd0..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/monitor/monitor.pb.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v5.29.3 -// source: monitor.proto - -package monitor - -import ( - common "git.espin.casa/albert/go-telecom/proto/common" - 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 LogEntry struct { - state protoimpl.MessageState `protogen:"open.v1"` - Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` - Level string `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty"` - Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` - Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LogEntry) Reset() { - *x = LogEntry{} - mi := &file_monitor_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LogEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LogEntry) ProtoMessage() {} - -func (x *LogEntry) ProtoReflect() protoreflect.Message { - mi := &file_monitor_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 LogEntry.ProtoReflect.Descriptor instead. -func (*LogEntry) Descriptor() ([]byte, []int) { - return file_monitor_proto_rawDescGZIP(), []int{0} -} - -func (x *LogEntry) GetService() string { - if x != nil { - return x.Service - } - return "" -} - -func (x *LogEntry) GetLevel() string { - if x != nil { - return x.Level - } - return "" -} - -func (x *LogEntry) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *LogEntry) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -type LogAck struct { - state protoimpl.MessageState `protogen:"open.v1"` - Received bool `protobuf:"varint,1,opt,name=received,proto3" json:"received,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *LogAck) Reset() { - *x = LogAck{} - mi := &file_monitor_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *LogAck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LogAck) ProtoMessage() {} - -func (x *LogAck) ProtoReflect() protoreflect.Message { - mi := &file_monitor_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 LogAck.ProtoReflect.Descriptor instead. -func (*LogAck) Descriptor() ([]byte, []int) { - return file_monitor_proto_rawDescGZIP(), []int{1} -} - -func (x *LogAck) GetReceived() bool { - if x != nil { - return x.Received - } - return false -} - -var File_monitor_proto protoreflect.FileDescriptor - -const file_monitor_proto_rawDesc = "" + - "\n" + - "\rmonitor.proto\x12\amonitor\x1a\fcommon.proto\"r\n" + - "\bLogEntry\x12\x18\n" + - "\aservice\x18\x01 \x01(\tR\aservice\x12\x14\n" + - "\x05level\x18\x02 \x01(\tR\x05level\x12\x18\n" + - "\amessage\x18\x03 \x01(\tR\amessage\x12\x1c\n" + - "\ttimestamp\x18\x04 \x01(\x03R\ttimestamp\"$\n" + - "\x06LogAck\x12\x1a\n" + - "\breceived\x18\x01 \x01(\bR\breceived2\x87\x01\n" + - "\x0eMonitorService\x12F\n" + - "\vHealthCheck\x12\x1a.common.HealthCheckRequest\x1a\x1b.common.HealthCheckResponse\x12-\n" + - "\aSendLog\x12\x11.monitor.LogEntry\x1a\x0f.monitor.LogAckB8Z6git.espin.casa/albert/go-telecom/proto/monitor;monitorb\x06proto3" - -var ( - file_monitor_proto_rawDescOnce sync.Once - file_monitor_proto_rawDescData []byte -) - -func file_monitor_proto_rawDescGZIP() []byte { - file_monitor_proto_rawDescOnce.Do(func() { - file_monitor_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_monitor_proto_rawDesc), len(file_monitor_proto_rawDesc))) - }) - return file_monitor_proto_rawDescData -} - -var file_monitor_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_monitor_proto_goTypes = []any{ - (*LogEntry)(nil), // 0: monitor.LogEntry - (*LogAck)(nil), // 1: monitor.LogAck - (*common.HealthCheckRequest)(nil), // 2: common.HealthCheckRequest - (*common.HealthCheckResponse)(nil), // 3: common.HealthCheckResponse -} -var file_monitor_proto_depIdxs = []int32{ - 2, // 0: monitor.MonitorService.HealthCheck:input_type -> common.HealthCheckRequest - 0, // 1: monitor.MonitorService.SendLog:input_type -> monitor.LogEntry - 3, // 2: monitor.MonitorService.HealthCheck:output_type -> common.HealthCheckResponse - 1, // 3: monitor.MonitorService.SendLog:output_type -> monitor.LogAck - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] 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_monitor_proto_init() } -func file_monitor_proto_init() { - if File_monitor_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_monitor_proto_rawDesc), len(file_monitor_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_monitor_proto_goTypes, - DependencyIndexes: file_monitor_proto_depIdxs, - MessageInfos: file_monitor_proto_msgTypes, - }.Build() - File_monitor_proto = out.File - file_monitor_proto_goTypes = nil - file_monitor_proto_depIdxs = nil -} diff --git a/internal/gen/git.espin.casa/albert/go-telecom/proto/monitor/monitor_grpc.pb.go b/internal/gen/git.espin.casa/albert/go-telecom/proto/monitor/monitor_grpc.pb.go deleted file mode 100644 index e08fec7..0000000 --- a/internal/gen/git.espin.casa/albert/go-telecom/proto/monitor/monitor_grpc.pb.go +++ /dev/null @@ -1,160 +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: monitor.proto - -package monitor - -import ( - context "context" - common "git.espin.casa/albert/go-telecom/proto/common" - 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 ( - MonitorService_HealthCheck_FullMethodName = "/monitor.MonitorService/HealthCheck" - MonitorService_SendLog_FullMethodName = "/monitor.MonitorService/SendLog" -) - -// MonitorServiceClient is the client API for MonitorService 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 MonitorServiceClient interface { - HealthCheck(ctx context.Context, in *common.HealthCheckRequest, opts ...grpc.CallOption) (*common.HealthCheckResponse, error) - SendLog(ctx context.Context, in *LogEntry, opts ...grpc.CallOption) (*LogAck, error) -} - -type monitorServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewMonitorServiceClient(cc grpc.ClientConnInterface) MonitorServiceClient { - return &monitorServiceClient{cc} -} - -func (c *monitorServiceClient) HealthCheck(ctx context.Context, in *common.HealthCheckRequest, opts ...grpc.CallOption) (*common.HealthCheckResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(common.HealthCheckResponse) - err := c.cc.Invoke(ctx, MonitorService_HealthCheck_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *monitorServiceClient) SendLog(ctx context.Context, in *LogEntry, opts ...grpc.CallOption) (*LogAck, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(LogAck) - err := c.cc.Invoke(ctx, MonitorService_SendLog_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MonitorServiceServer is the server API for MonitorService service. -// All implementations must embed UnimplementedMonitorServiceServer -// for forward compatibility. -type MonitorServiceServer interface { - HealthCheck(context.Context, *common.HealthCheckRequest) (*common.HealthCheckResponse, error) - SendLog(context.Context, *LogEntry) (*LogAck, error) - mustEmbedUnimplementedMonitorServiceServer() -} - -// UnimplementedMonitorServiceServer 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 UnimplementedMonitorServiceServer struct{} - -func (UnimplementedMonitorServiceServer) HealthCheck(context.Context, *common.HealthCheckRequest) (*common.HealthCheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented") -} -func (UnimplementedMonitorServiceServer) SendLog(context.Context, *LogEntry) (*LogAck, error) { - return nil, status.Errorf(codes.Unimplemented, "method SendLog not implemented") -} -func (UnimplementedMonitorServiceServer) mustEmbedUnimplementedMonitorServiceServer() {} -func (UnimplementedMonitorServiceServer) testEmbeddedByValue() {} - -// UnsafeMonitorServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MonitorServiceServer will -// result in compilation errors. -type UnsafeMonitorServiceServer interface { - mustEmbedUnimplementedMonitorServiceServer() -} - -func RegisterMonitorServiceServer(s grpc.ServiceRegistrar, srv MonitorServiceServer) { - // If the following call pancis, it indicates UnimplementedMonitorServiceServer 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(&MonitorService_ServiceDesc, srv) -} - -func _MonitorService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(common.HealthCheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MonitorServiceServer).HealthCheck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MonitorService_HealthCheck_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MonitorServiceServer).HealthCheck(ctx, req.(*common.HealthCheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _MonitorService_SendLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LogEntry) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MonitorServiceServer).SendLog(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MonitorService_SendLog_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MonitorServiceServer).SendLog(ctx, req.(*LogEntry)) - } - return interceptor(ctx, in, info, handler) -} - -// MonitorService_ServiceDesc is the grpc.ServiceDesc for MonitorService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var MonitorService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "monitor.MonitorService", - HandlerType: (*MonitorServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "HealthCheck", - Handler: _MonitorService_HealthCheck_Handler, - }, - { - MethodName: "SendLog", - Handler: _MonitorService_SendLog_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "monitor.proto", -} diff --git a/internal/trace/otel_configurator.go b/internal/trace/otel_configurator.go new file mode 100644 index 0000000..3b260d1 --- /dev/null +++ b/internal/trace/otel_configurator.go @@ -0,0 +1,39 @@ +package trace + +import ( + "context" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.26.0" +) + +func InitTrace() (*sdktrace.TracerProvider, error) { + // Initialize OpenTelemetry tracing + ctx := context.Background() + // Configure OpenTelemetry with your desired settings + exporter, err := otlptracehttp.New(ctx, otlptracehttp.WithEndpoint("localhost:4318"), otlptracehttp.WithInsecure()) + if err != nil { + return nil, err + } + // Create a new TracerProvider with the exporter + // and a sampler (e.g., AlwaysSample) + tracerProvider := sdktrace.NewTracerProvider( + sdktrace.WithSampler(sdktrace.AlwaysSample()), + sdktrace.WithBatcher(exporter), + // You may want to set resource attributes here, e.g. service name/version + sdktrace.WithResource(resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String("go-telecom"), + )), + ) + // Set the global trace provider + otel.SetTracerProvider(tracerProvider) + // set the global propagator + otel.SetTextMapPropagator(propagation.TraceContext{}) + + return tracerProvider, nil +} diff --git a/proto/.DS_Store b/proto/.DS_Store new file mode 100644 index 0000000..127aa17 Binary files /dev/null and b/proto/.DS_Store differ diff --git a/proto/adaptor.proto b/proto/adaptor.proto index 7904ef7..e899c39 100644 --- a/proto/adaptor.proto +++ b/proto/adaptor.proto @@ -1,10 +1,11 @@ syntax = "proto3"; +import "common.proto"; package adapter; -import "common.proto"; -option go_package = "git.espin.casa/albert/go-telecom/proto/adaptor;adaptor"; + +option go_package = "git.espin.casa/albert/go-telecom/pb;pb"; service AdapterService { diff --git a/proto/admin.proto b/proto/admin.proto index 27c6edb..b9ba8fa 100644 --- a/proto/admin.proto +++ b/proto/admin.proto @@ -4,7 +4,7 @@ package admin; import "common.proto"; -option go_package = "git.espin.casa/albert/go-telecom/proto/admin;admin"; +option go_package = "git.espin.casa/albert/go-telecom/pb;pb"; service AdminService { diff --git a/proto/common.proto b/proto/common.proto index a4efba3..d7670a4 100644 --- a/proto/common.proto +++ b/proto/common.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package common; -option go_package = "git.espin.casa/albert/go-telecom/proto/common;common"; +option go_package = "git.espin.casa/albert/go-telecom/pb;pb"; message HealthCheckRequest {} message HealthCheckResponse { diff --git a/proto/core.proto b/proto/core.proto index ce9c908..49fb9db 100644 --- a/proto/core.proto +++ b/proto/core.proto @@ -4,7 +4,7 @@ package core; import "common.proto"; -option go_package = "git.espin.casa/albert/go-telecom/proto/core;core"; +option go_package = "git.espin.casa/albert/go-telecom/pb;pb"; service CoreService { rpc HealthCheck(common.HealthCheckRequest) returns (common.HealthCheckResponse); diff --git a/proto/monitor.proto b/proto/monitor.proto index 04a88b2..f04b2f6 100644 --- a/proto/monitor.proto +++ b/proto/monitor.proto @@ -4,7 +4,7 @@ package monitor; import "common.proto"; -option go_package = "git.espin.casa/albert/go-telecom/proto/monitor;monitor"; +option go_package = "git.espin.casa/albert/go-telecom/pb;pb"; service MonitorService {