Initial proto module with gRPC definitions
This commit is contained in:
commit
d063433b69
26
Dockerfile
Normal file
26
Dockerfile
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
FROM golang:latest AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install protoc
|
||||||
|
RUN apt-get update && apt-get install -y protobuf-compiler
|
||||||
|
|
||||||
|
# Install protoc Go plugins
|
||||||
|
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
|
||||||
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||||
|
|
||||||
|
ENV PATH=$PATH:/root/go/bin
|
||||||
|
|
||||||
|
COPY go.mod ./
|
||||||
|
COPY proto ./proto
|
||||||
|
|
||||||
|
# Generate proto files
|
||||||
|
RUN protoc --go_out=. --go_opt=paths=source_relative \
|
||||||
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
||||||
|
proto/agent.proto
|
||||||
|
|
||||||
|
RUN go mod tidy
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=builder /app .
|
||||||
33
Makefile
Normal file
33
Makefile
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
.PHONY: generate build clean
|
||||||
|
|
||||||
|
PROTOC := protoc
|
||||||
|
GO_PROTOC_GEN_GO := $(shell go env GOPATH)/bin/protoc-gen-go
|
||||||
|
GO_PROTOC_GEN_GO_GRPC := $(shell go env GOPATH)/bin/protoc-gen-go-grpc
|
||||||
|
|
||||||
|
PROTO_FILES := proto/agent.proto
|
||||||
|
PROTO_OUT_DIR := proto
|
||||||
|
|
||||||
|
generate:
|
||||||
|
@echo "Generating Go code from proto files..."
|
||||||
|
$(PROTOC) --go_out=. --go_opt=paths=source_relative \
|
||||||
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
||||||
|
$(PROTO_FILES)
|
||||||
|
@echo "Proto generation complete"
|
||||||
|
|
||||||
|
build: generate
|
||||||
|
@echo "Building proto module..."
|
||||||
|
go mod tidy
|
||||||
|
@echo "Build complete"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning generated files..."
|
||||||
|
rm -f $(PROTO_OUT_DIR)/*.pb.go
|
||||||
|
rm -f $(PROTO_OUT_DIR)/*_grpc.pb.go
|
||||||
|
@echo "Clean complete"
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "Available targets:"
|
||||||
|
@echo " generate - Generate Go code from proto files"
|
||||||
|
@echo " build - Generate proto and tidy go modules"
|
||||||
|
@echo " clean - Remove generated files"
|
||||||
|
@echo " help - Show this help message"
|
||||||
15
go.mod
Normal file
15
go.mod
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module l_vpn_proto
|
||||||
|
|
||||||
|
go 1.25.6
|
||||||
|
|
||||||
|
require (
|
||||||
|
google.golang.org/grpc v1.79.1
|
||||||
|
google.golang.org/protobuf v1.36.11
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
golang.org/x/net v0.48.0 // indirect
|
||||||
|
golang.org/x/sys v0.39.0 // indirect
|
||||||
|
golang.org/x/text v0.32.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
|
||||||
|
)
|
||||||
38
go.sum
Normal file
38
go.sum
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
|
github.com/go-logr/logr v1.4.3/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=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||||
|
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
|
||||||
|
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
|
||||||
|
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
|
||||||
|
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew=
|
||||||
|
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
|
||||||
|
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
|
||||||
|
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||||
|
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||||
|
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||||
|
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
|
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
|
||||||
|
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
|
||||||
|
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||||
|
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
|
||||||
|
google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY=
|
||||||
|
google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||||
|
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||||
|
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
540
proto/agent.pb.go
Normal file
540
proto/agent.pb.go
Normal file
@ -0,0 +1,540 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.36.11
|
||||||
|
// protoc v3.21.12
|
||||||
|
// source: proto/agent.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 GetClientConfigsRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsRequest) Reset() {
|
||||||
|
*x = GetClientConfigsRequest{}
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetClientConfigsRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_agent_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 GetClientConfigsRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetClientConfigsRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_agent_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ClientConfig struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
PublicKey string `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||||
|
PrivateKey string `protobuf:"bytes,3,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"`
|
||||||
|
Endpoint string `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
|
||||||
|
AllowedIps string `protobuf:"bytes,5,opt,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"`
|
||||||
|
CreatedAt string `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ClientConfig) Reset() {
|
||||||
|
*x = ClientConfig{}
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ClientConfig) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ClientConfig) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ClientConfig) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_agent_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 ClientConfig.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ClientConfig) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_agent_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ClientConfig) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ClientConfig) GetPublicKey() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PublicKey
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ClientConfig) GetPrivateKey() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PrivateKey
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ClientConfig) GetEndpoint() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Endpoint
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ClientConfig) GetAllowedIps() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AllowedIps
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ClientConfig) GetCreatedAt() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CreatedAt
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetClientConfigsResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
||||||
|
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
|
||||||
|
Clients []*ClientConfig `protobuf:"bytes,3,rep,name=clients,proto3" json:"clients,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsResponse) Reset() {
|
||||||
|
*x = GetClientConfigsResponse{}
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetClientConfigsResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[2]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetClientConfigsResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetClientConfigsResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_agent_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsResponse) GetSuccess() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Success
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsResponse) GetError() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Error
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetClientConfigsResponse) GetClients() []*ClientConfig {
|
||||||
|
if x != nil {
|
||||||
|
return x.Clients
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegisterClientRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
AllowedIps string `protobuf:"bytes,2,opt,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientRequest) Reset() {
|
||||||
|
*x = RegisterClientRequest{}
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RegisterClientRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RegisterClientRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[3]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RegisterClientRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RegisterClientRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_agent_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientRequest) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientRequest) GetAllowedIps() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AllowedIps
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegisterClientResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
||||||
|
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
|
||||||
|
Client *ClientConfig `protobuf:"bytes,3,opt,name=client,proto3" json:"client,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientResponse) Reset() {
|
||||||
|
*x = RegisterClientResponse{}
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RegisterClientResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RegisterClientResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[4]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RegisterClientResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RegisterClientResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_agent_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientResponse) GetSuccess() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Success
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientResponse) GetError() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Error
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegisterClientResponse) GetClient() *ClientConfig {
|
||||||
|
if x != nil {
|
||||||
|
return x.Client
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetServerStatusRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusRequest) Reset() {
|
||||||
|
*x = GetServerStatusRequest{}
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetServerStatusRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetServerStatusRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[5]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetServerStatusRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetServerStatusRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_agent_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetServerStatusResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
||||||
|
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
|
||||||
|
InterfaceName string `protobuf:"bytes,3,opt,name=interface_name,json=interfaceName,proto3" json:"interface_name,omitempty"`
|
||||||
|
PublicKey string `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
|
||||||
|
ListeningPort string `protobuf:"bytes,5,opt,name=listening_port,json=listeningPort,proto3" json:"listening_port,omitempty"`
|
||||||
|
PeersCount int32 `protobuf:"varint,6,opt,name=peers_count,json=peersCount,proto3" json:"peers_count,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) Reset() {
|
||||||
|
*x = GetServerStatusResponse{}
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetServerStatusResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_agent_proto_msgTypes[6]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetServerStatusResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetServerStatusResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_agent_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) GetSuccess() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Success
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) GetError() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Error
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) GetInterfaceName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.InterfaceName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) GetPublicKey() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PublicKey
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) GetListeningPort() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ListeningPort
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetServerStatusResponse) GetPeersCount() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.PeersCount
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_proto_agent_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
const file_proto_agent_proto_rawDesc = "" +
|
||||||
|
"\n" +
|
||||||
|
"\x11proto/agent.proto\x12\x05agent\"\x19\n" +
|
||||||
|
"\x17GetClientConfigsRequest\"\xbe\x01\n" +
|
||||||
|
"\fClientConfig\x12\x12\n" +
|
||||||
|
"\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"public_key\x18\x02 \x01(\tR\tpublicKey\x12\x1f\n" +
|
||||||
|
"\vprivate_key\x18\x03 \x01(\tR\n" +
|
||||||
|
"privateKey\x12\x1a\n" +
|
||||||
|
"\bendpoint\x18\x04 \x01(\tR\bendpoint\x12\x1f\n" +
|
||||||
|
"\vallowed_ips\x18\x05 \x01(\tR\n" +
|
||||||
|
"allowedIps\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"created_at\x18\x06 \x01(\tR\tcreatedAt\"y\n" +
|
||||||
|
"\x18GetClientConfigsResponse\x12\x18\n" +
|
||||||
|
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" +
|
||||||
|
"\x05error\x18\x02 \x01(\tR\x05error\x12-\n" +
|
||||||
|
"\aclients\x18\x03 \x03(\v2\x13.agent.ClientConfigR\aclients\"L\n" +
|
||||||
|
"\x15RegisterClientRequest\x12\x12\n" +
|
||||||
|
"\x04name\x18\x01 \x01(\tR\x04name\x12\x1f\n" +
|
||||||
|
"\vallowed_ips\x18\x02 \x01(\tR\n" +
|
||||||
|
"allowedIps\"u\n" +
|
||||||
|
"\x16RegisterClientResponse\x12\x18\n" +
|
||||||
|
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" +
|
||||||
|
"\x05error\x18\x02 \x01(\tR\x05error\x12+\n" +
|
||||||
|
"\x06client\x18\x03 \x01(\v2\x13.agent.ClientConfigR\x06client\"\x18\n" +
|
||||||
|
"\x16GetServerStatusRequest\"\xd7\x01\n" +
|
||||||
|
"\x17GetServerStatusResponse\x12\x18\n" +
|
||||||
|
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" +
|
||||||
|
"\x05error\x18\x02 \x01(\tR\x05error\x12%\n" +
|
||||||
|
"\x0einterface_name\x18\x03 \x01(\tR\rinterfaceName\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"public_key\x18\x04 \x01(\tR\tpublicKey\x12%\n" +
|
||||||
|
"\x0elistening_port\x18\x05 \x01(\tR\rlisteningPort\x12\x1f\n" +
|
||||||
|
"\vpeers_count\x18\x06 \x01(\x05R\n" +
|
||||||
|
"peersCount2\x86\x02\n" +
|
||||||
|
"\x0eWireGuardAgent\x12S\n" +
|
||||||
|
"\x10GetClientConfigs\x12\x1e.agent.GetClientConfigsRequest\x1a\x1f.agent.GetClientConfigsResponse\x12M\n" +
|
||||||
|
"\x0eRegisterClient\x12\x1c.agent.RegisterClientRequest\x1a\x1d.agent.RegisterClientResponse\x12P\n" +
|
||||||
|
"\x0fGetServerStatus\x12\x1d.agent.GetServerStatusRequest\x1a\x1e.agent.GetServerStatusResponseB\x13Z\x11l_vpn_proto/protob\x06proto3"
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_proto_agent_proto_rawDescOnce sync.Once
|
||||||
|
file_proto_agent_proto_rawDescData []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_proto_agent_proto_rawDescGZIP() []byte {
|
||||||
|
file_proto_agent_proto_rawDescOnce.Do(func() {
|
||||||
|
file_proto_agent_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_agent_proto_rawDesc), len(file_proto_agent_proto_rawDesc)))
|
||||||
|
})
|
||||||
|
return file_proto_agent_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_proto_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||||
|
var file_proto_agent_proto_goTypes = []any{
|
||||||
|
(*GetClientConfigsRequest)(nil), // 0: agent.GetClientConfigsRequest
|
||||||
|
(*ClientConfig)(nil), // 1: agent.ClientConfig
|
||||||
|
(*GetClientConfigsResponse)(nil), // 2: agent.GetClientConfigsResponse
|
||||||
|
(*RegisterClientRequest)(nil), // 3: agent.RegisterClientRequest
|
||||||
|
(*RegisterClientResponse)(nil), // 4: agent.RegisterClientResponse
|
||||||
|
(*GetServerStatusRequest)(nil), // 5: agent.GetServerStatusRequest
|
||||||
|
(*GetServerStatusResponse)(nil), // 6: agent.GetServerStatusResponse
|
||||||
|
}
|
||||||
|
var file_proto_agent_proto_depIdxs = []int32{
|
||||||
|
1, // 0: agent.GetClientConfigsResponse.clients:type_name -> agent.ClientConfig
|
||||||
|
1, // 1: agent.RegisterClientResponse.client:type_name -> agent.ClientConfig
|
||||||
|
0, // 2: agent.WireGuardAgent.GetClientConfigs:input_type -> agent.GetClientConfigsRequest
|
||||||
|
3, // 3: agent.WireGuardAgent.RegisterClient:input_type -> agent.RegisterClientRequest
|
||||||
|
5, // 4: agent.WireGuardAgent.GetServerStatus:input_type -> agent.GetServerStatusRequest
|
||||||
|
2, // 5: agent.WireGuardAgent.GetClientConfigs:output_type -> agent.GetClientConfigsResponse
|
||||||
|
4, // 6: agent.WireGuardAgent.RegisterClient:output_type -> agent.RegisterClientResponse
|
||||||
|
6, // 7: agent.WireGuardAgent.GetServerStatus:output_type -> agent.GetServerStatusResponse
|
||||||
|
5, // [5:8] is the sub-list for method output_type
|
||||||
|
2, // [2:5] is the sub-list for method input_type
|
||||||
|
2, // [2:2] is the sub-list for extension type_name
|
||||||
|
2, // [2:2] is the sub-list for extension extendee
|
||||||
|
0, // [0:2] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_proto_agent_proto_init() }
|
||||||
|
func file_proto_agent_proto_init() {
|
||||||
|
if File_proto_agent_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_agent_proto_rawDesc), len(file_proto_agent_proto_rawDesc)),
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 7,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 1,
|
||||||
|
},
|
||||||
|
GoTypes: file_proto_agent_proto_goTypes,
|
||||||
|
DependencyIndexes: file_proto_agent_proto_depIdxs,
|
||||||
|
MessageInfos: file_proto_agent_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_proto_agent_proto = out.File
|
||||||
|
file_proto_agent_proto_goTypes = nil
|
||||||
|
file_proto_agent_proto_depIdxs = nil
|
||||||
|
}
|
||||||
50
proto/agent.proto
Normal file
50
proto/agent.proto
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package agent;
|
||||||
|
|
||||||
|
option go_package = "l_vpn_proto/proto";
|
||||||
|
|
||||||
|
service WireGuardAgent {
|
||||||
|
rpc GetClientConfigs(GetClientConfigsRequest) returns (GetClientConfigsResponse);
|
||||||
|
rpc RegisterClient(RegisterClientRequest) returns (RegisterClientResponse);
|
||||||
|
rpc GetServerStatus(GetServerStatusRequest) returns (GetServerStatusResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetClientConfigsRequest {}
|
||||||
|
|
||||||
|
message ClientConfig {
|
||||||
|
string name = 1;
|
||||||
|
string public_key = 2;
|
||||||
|
string private_key = 3;
|
||||||
|
string endpoint = 4;
|
||||||
|
string allowed_ips = 5;
|
||||||
|
string created_at = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetClientConfigsResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string error = 2;
|
||||||
|
repeated ClientConfig clients = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RegisterClientRequest {
|
||||||
|
string name = 1;
|
||||||
|
string allowed_ips = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RegisterClientResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string error = 2;
|
||||||
|
ClientConfig client = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetServerStatusRequest {}
|
||||||
|
|
||||||
|
message GetServerStatusResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string error = 2;
|
||||||
|
string interface_name = 3;
|
||||||
|
string public_key = 4;
|
||||||
|
string listening_port = 5;
|
||||||
|
int32 peers_count = 6;
|
||||||
|
}
|
||||||
197
proto/agent_grpc.pb.go
Normal file
197
proto/agent_grpc.pb.go
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.6.1
|
||||||
|
// - protoc v3.21.12
|
||||||
|
// source: proto/agent.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 (
|
||||||
|
WireGuardAgent_GetClientConfigs_FullMethodName = "/agent.WireGuardAgent/GetClientConfigs"
|
||||||
|
WireGuardAgent_RegisterClient_FullMethodName = "/agent.WireGuardAgent/RegisterClient"
|
||||||
|
WireGuardAgent_GetServerStatus_FullMethodName = "/agent.WireGuardAgent/GetServerStatus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// WireGuardAgentClient is the client API for WireGuardAgent 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 WireGuardAgentClient interface {
|
||||||
|
GetClientConfigs(ctx context.Context, in *GetClientConfigsRequest, opts ...grpc.CallOption) (*GetClientConfigsResponse, error)
|
||||||
|
RegisterClient(ctx context.Context, in *RegisterClientRequest, opts ...grpc.CallOption) (*RegisterClientResponse, error)
|
||||||
|
GetServerStatus(ctx context.Context, in *GetServerStatusRequest, opts ...grpc.CallOption) (*GetServerStatusResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type wireGuardAgentClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWireGuardAgentClient(cc grpc.ClientConnInterface) WireGuardAgentClient {
|
||||||
|
return &wireGuardAgentClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *wireGuardAgentClient) GetClientConfigs(ctx context.Context, in *GetClientConfigsRequest, opts ...grpc.CallOption) (*GetClientConfigsResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetClientConfigsResponse)
|
||||||
|
err := c.cc.Invoke(ctx, WireGuardAgent_GetClientConfigs_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *wireGuardAgentClient) RegisterClient(ctx context.Context, in *RegisterClientRequest, opts ...grpc.CallOption) (*RegisterClientResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(RegisterClientResponse)
|
||||||
|
err := c.cc.Invoke(ctx, WireGuardAgent_RegisterClient_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *wireGuardAgentClient) GetServerStatus(ctx context.Context, in *GetServerStatusRequest, opts ...grpc.CallOption) (*GetServerStatusResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetServerStatusResponse)
|
||||||
|
err := c.cc.Invoke(ctx, WireGuardAgent_GetServerStatus_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// WireGuardAgentServer is the server API for WireGuardAgent service.
|
||||||
|
// All implementations must embed UnimplementedWireGuardAgentServer
|
||||||
|
// for forward compatibility.
|
||||||
|
type WireGuardAgentServer interface {
|
||||||
|
GetClientConfigs(context.Context, *GetClientConfigsRequest) (*GetClientConfigsResponse, error)
|
||||||
|
RegisterClient(context.Context, *RegisterClientRequest) (*RegisterClientResponse, error)
|
||||||
|
GetServerStatus(context.Context, *GetServerStatusRequest) (*GetServerStatusResponse, error)
|
||||||
|
mustEmbedUnimplementedWireGuardAgentServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedWireGuardAgentServer 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 UnimplementedWireGuardAgentServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedWireGuardAgentServer) GetClientConfigs(context.Context, *GetClientConfigsRequest) (*GetClientConfigsResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GetClientConfigs not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedWireGuardAgentServer) RegisterClient(context.Context, *RegisterClientRequest) (*RegisterClientResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method RegisterClient not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedWireGuardAgentServer) GetServerStatus(context.Context, *GetServerStatusRequest) (*GetServerStatusResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GetServerStatus not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedWireGuardAgentServer) mustEmbedUnimplementedWireGuardAgentServer() {}
|
||||||
|
func (UnimplementedWireGuardAgentServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeWireGuardAgentServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to WireGuardAgentServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeWireGuardAgentServer interface {
|
||||||
|
mustEmbedUnimplementedWireGuardAgentServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterWireGuardAgentServer(s grpc.ServiceRegistrar, srv WireGuardAgentServer) {
|
||||||
|
// If the following call panics, it indicates UnimplementedWireGuardAgentServer 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(&WireGuardAgent_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _WireGuardAgent_GetClientConfigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetClientConfigsRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(WireGuardAgentServer).GetClientConfigs(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: WireGuardAgent_GetClientConfigs_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(WireGuardAgentServer).GetClientConfigs(ctx, req.(*GetClientConfigsRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _WireGuardAgent_RegisterClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(RegisterClientRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(WireGuardAgentServer).RegisterClient(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: WireGuardAgent_RegisterClient_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(WireGuardAgentServer).RegisterClient(ctx, req.(*RegisterClientRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _WireGuardAgent_GetServerStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetServerStatusRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(WireGuardAgentServer).GetServerStatus(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: WireGuardAgent_GetServerStatus_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(WireGuardAgentServer).GetServerStatus(ctx, req.(*GetServerStatusRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WireGuardAgent_ServiceDesc is the grpc.ServiceDesc for WireGuardAgent service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var WireGuardAgent_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "agent.WireGuardAgent",
|
||||||
|
HandlerType: (*WireGuardAgentServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "GetClientConfigs",
|
||||||
|
Handler: _WireGuardAgent_GetClientConfigs_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "RegisterClient",
|
||||||
|
Handler: _WireGuardAgent_RegisterClient_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetServerStatus",
|
||||||
|
Handler: _WireGuardAgent_GetServerStatus_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "proto/agent.proto",
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user