Server-Side-Implementation

This commit is contained in:
2025-12-29 16:42:49 +01:00
commit c9d0322177
20 changed files with 1539 additions and 0 deletions

View File

@ -0,0 +1,451 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.10
// protoc (unknown)
// source: portforwarding/portforwarding.proto
package portforwardingv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
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 Portforwarding struct {
state protoimpl.MessageState `protogen:"open.v1"`
Alias string `protobuf:"bytes,1,opt,name=alias,proto3" json:"alias,omitempty"`
TargetPort int32 `protobuf:"varint,2,opt,name=targetPort,proto3" json:"targetPort,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Portforwarding) Reset() {
*x = Portforwarding{}
mi := &file_portforwarding_portforwarding_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Portforwarding) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Portforwarding) ProtoMessage() {}
func (x *Portforwarding) ProtoReflect() protoreflect.Message {
mi := &file_portforwarding_portforwarding_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 Portforwarding.ProtoReflect.Descriptor instead.
func (*Portforwarding) Descriptor() ([]byte, []int) {
return file_portforwarding_portforwarding_proto_rawDescGZIP(), []int{0}
}
func (x *Portforwarding) GetAlias() string {
if x != nil {
return x.Alias
}
return ""
}
func (x *Portforwarding) GetTargetPort() int32 {
if x != nil {
return x.TargetPort
}
return 0
}
type ListPortforwardingsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListPortforwardingsRequest) Reset() {
*x = ListPortforwardingsRequest{}
mi := &file_portforwarding_portforwarding_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListPortforwardingsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListPortforwardingsRequest) ProtoMessage() {}
func (x *ListPortforwardingsRequest) ProtoReflect() protoreflect.Message {
mi := &file_portforwarding_portforwarding_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 ListPortforwardingsRequest.ProtoReflect.Descriptor instead.
func (*ListPortforwardingsRequest) Descriptor() ([]byte, []int) {
return file_portforwarding_portforwarding_proto_rawDescGZIP(), []int{1}
}
type ListPortforwardingsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Pf []*Portforwarding `protobuf:"bytes,1,rep,name=pf,proto3" json:"pf,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *ListPortforwardingsResponse) Reset() {
*x = ListPortforwardingsResponse{}
mi := &file_portforwarding_portforwarding_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListPortforwardingsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListPortforwardingsResponse) ProtoMessage() {}
func (x *ListPortforwardingsResponse) ProtoReflect() protoreflect.Message {
mi := &file_portforwarding_portforwarding_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 ListPortforwardingsResponse.ProtoReflect.Descriptor instead.
func (*ListPortforwardingsResponse) Descriptor() ([]byte, []int) {
return file_portforwarding_portforwarding_proto_rawDescGZIP(), []int{2}
}
func (x *ListPortforwardingsResponse) GetPf() []*Portforwarding {
if x != nil {
return x.Pf
}
return nil
}
type CreatePortforwardingRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Alias string `protobuf:"bytes,1,opt,name=alias,proto3" json:"alias,omitempty"`
TargetPort int32 `protobuf:"varint,2,opt,name=targetPort,proto3" json:"targetPort,omitempty"`
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreatePortforwardingRequest) Reset() {
*x = CreatePortforwardingRequest{}
mi := &file_portforwarding_portforwarding_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreatePortforwardingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreatePortforwardingRequest) ProtoMessage() {}
func (x *CreatePortforwardingRequest) ProtoReflect() protoreflect.Message {
mi := &file_portforwarding_portforwarding_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 CreatePortforwardingRequest.ProtoReflect.Descriptor instead.
func (*CreatePortforwardingRequest) Descriptor() ([]byte, []int) {
return file_portforwarding_portforwarding_proto_rawDescGZIP(), []int{3}
}
func (x *CreatePortforwardingRequest) GetAlias() string {
if x != nil {
return x.Alias
}
return ""
}
func (x *CreatePortforwardingRequest) GetTargetPort() int32 {
if x != nil {
return x.TargetPort
}
return 0
}
func (x *CreatePortforwardingRequest) GetCreatedAt() *timestamppb.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
type CreatePortforwardingResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Pf *Portforwarding `protobuf:"bytes,2,opt,name=pf,proto3" json:"pf,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CreatePortforwardingResponse) Reset() {
*x = CreatePortforwardingResponse{}
mi := &file_portforwarding_portforwarding_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CreatePortforwardingResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreatePortforwardingResponse) ProtoMessage() {}
func (x *CreatePortforwardingResponse) ProtoReflect() protoreflect.Message {
mi := &file_portforwarding_portforwarding_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 CreatePortforwardingResponse.ProtoReflect.Descriptor instead.
func (*CreatePortforwardingResponse) Descriptor() ([]byte, []int) {
return file_portforwarding_portforwarding_proto_rawDescGZIP(), []int{4}
}
func (x *CreatePortforwardingResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *CreatePortforwardingResponse) GetPf() *Portforwarding {
if x != nil {
return x.Pf
}
return nil
}
type DeletePortforwardingRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Alias string `protobuf:"bytes,1,opt,name=alias,proto3" json:"alias,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeletePortforwardingRequest) Reset() {
*x = DeletePortforwardingRequest{}
mi := &file_portforwarding_portforwarding_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeletePortforwardingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeletePortforwardingRequest) ProtoMessage() {}
func (x *DeletePortforwardingRequest) ProtoReflect() protoreflect.Message {
mi := &file_portforwarding_portforwarding_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 DeletePortforwardingRequest.ProtoReflect.Descriptor instead.
func (*DeletePortforwardingRequest) Descriptor() ([]byte, []int) {
return file_portforwarding_portforwarding_proto_rawDescGZIP(), []int{5}
}
func (x *DeletePortforwardingRequest) GetAlias() string {
if x != nil {
return x.Alias
}
return ""
}
type DeletePortforwardingResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeletePortforwardingResponse) Reset() {
*x = DeletePortforwardingResponse{}
mi := &file_portforwarding_portforwarding_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeletePortforwardingResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeletePortforwardingResponse) ProtoMessage() {}
func (x *DeletePortforwardingResponse) ProtoReflect() protoreflect.Message {
mi := &file_portforwarding_portforwarding_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 DeletePortforwardingResponse.ProtoReflect.Descriptor instead.
func (*DeletePortforwardingResponse) Descriptor() ([]byte, []int) {
return file_portforwarding_portforwarding_proto_rawDescGZIP(), []int{6}
}
func (x *DeletePortforwardingResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
var File_portforwarding_portforwarding_proto protoreflect.FileDescriptor
const file_portforwarding_portforwarding_proto_rawDesc = "" +
"\n" +
"#portforwarding/portforwarding.proto\x12\x11portforwarding.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"F\n" +
"\x0ePortforwarding\x12\x14\n" +
"\x05alias\x18\x01 \x01(\tR\x05alias\x12\x1e\n" +
"\n" +
"targetPort\x18\x02 \x01(\x05R\n" +
"targetPort\"\x1c\n" +
"\x1aListPortforwardingsRequest\"P\n" +
"\x1bListPortforwardingsResponse\x121\n" +
"\x02pf\x18\x01 \x03(\v2!.portforwarding.v1.PortforwardingR\x02pf\"\x8d\x01\n" +
"\x1bCreatePortforwardingRequest\x12\x14\n" +
"\x05alias\x18\x01 \x01(\tR\x05alias\x12\x1e\n" +
"\n" +
"targetPort\x18\x02 \x01(\x05R\n" +
"targetPort\x128\n" +
"\tcreatedAt\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\"k\n" +
"\x1cCreatePortforwardingResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess\x121\n" +
"\x02pf\x18\x02 \x01(\v2!.portforwarding.v1.PortforwardingR\x02pf\"3\n" +
"\x1bDeletePortforwardingRequest\x12\x14\n" +
"\x05alias\x18\x01 \x01(\tR\x05alias\"8\n" +
"\x1cDeletePortforwardingResponse\x12\x18\n" +
"\asuccess\x18\x01 \x01(\bR\asuccess2\xff\x02\n" +
"\x15PortForwardingService\x12t\n" +
"\x13ListPortforwardings\x12-.portforwarding.v1.ListPortforwardingsRequest\x1a..portforwarding.v1.ListPortforwardingsResponse\x12w\n" +
"\x14CreatePortforwarding\x12..portforwarding.v1.CreatePortforwardingRequest\x1a/.portforwarding.v1.CreatePortforwardingResponse\x12w\n" +
"\x14DeletePortforwarding\x12..portforwarding.v1.DeletePortforwardingRequest\x1a/.portforwarding.v1.DeletePortforwardingResponseB\xdc\x01\n" +
"\x15com.portforwarding.v1B\x13PortforwardingProtoP\x01ZIgit.kocoder.xyz/kocoder/portforwarder/gen/portforwarding;portforwardingv1\xa2\x02\x03PXX\xaa\x02\x11Portforwarding.V1\xca\x02\x11Portforwarding\\V1\xe2\x02\x1dPortforwarding\\V1\\GPBMetadata\xea\x02\x12Portforwarding::V1b\x06proto3"
var (
file_portforwarding_portforwarding_proto_rawDescOnce sync.Once
file_portforwarding_portforwarding_proto_rawDescData []byte
)
func file_portforwarding_portforwarding_proto_rawDescGZIP() []byte {
file_portforwarding_portforwarding_proto_rawDescOnce.Do(func() {
file_portforwarding_portforwarding_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_portforwarding_portforwarding_proto_rawDesc), len(file_portforwarding_portforwarding_proto_rawDesc)))
})
return file_portforwarding_portforwarding_proto_rawDescData
}
var file_portforwarding_portforwarding_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_portforwarding_portforwarding_proto_goTypes = []any{
(*Portforwarding)(nil), // 0: portforwarding.v1.Portforwarding
(*ListPortforwardingsRequest)(nil), // 1: portforwarding.v1.ListPortforwardingsRequest
(*ListPortforwardingsResponse)(nil), // 2: portforwarding.v1.ListPortforwardingsResponse
(*CreatePortforwardingRequest)(nil), // 3: portforwarding.v1.CreatePortforwardingRequest
(*CreatePortforwardingResponse)(nil), // 4: portforwarding.v1.CreatePortforwardingResponse
(*DeletePortforwardingRequest)(nil), // 5: portforwarding.v1.DeletePortforwardingRequest
(*DeletePortforwardingResponse)(nil), // 6: portforwarding.v1.DeletePortforwardingResponse
(*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp
}
var file_portforwarding_portforwarding_proto_depIdxs = []int32{
0, // 0: portforwarding.v1.ListPortforwardingsResponse.pf:type_name -> portforwarding.v1.Portforwarding
7, // 1: portforwarding.v1.CreatePortforwardingRequest.createdAt:type_name -> google.protobuf.Timestamp
0, // 2: portforwarding.v1.CreatePortforwardingResponse.pf:type_name -> portforwarding.v1.Portforwarding
1, // 3: portforwarding.v1.PortForwardingService.ListPortforwardings:input_type -> portforwarding.v1.ListPortforwardingsRequest
3, // 4: portforwarding.v1.PortForwardingService.CreatePortforwarding:input_type -> portforwarding.v1.CreatePortforwardingRequest
5, // 5: portforwarding.v1.PortForwardingService.DeletePortforwarding:input_type -> portforwarding.v1.DeletePortforwardingRequest
2, // 6: portforwarding.v1.PortForwardingService.ListPortforwardings:output_type -> portforwarding.v1.ListPortforwardingsResponse
4, // 7: portforwarding.v1.PortForwardingService.CreatePortforwarding:output_type -> portforwarding.v1.CreatePortforwardingResponse
6, // 8: portforwarding.v1.PortForwardingService.DeletePortforwarding:output_type -> portforwarding.v1.DeletePortforwardingResponse
6, // [6:9] is the sub-list for method output_type
3, // [3:6] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_portforwarding_portforwarding_proto_init() }
func file_portforwarding_portforwarding_proto_init() {
if File_portforwarding_portforwarding_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_portforwarding_portforwarding_proto_rawDesc), len(file_portforwarding_portforwarding_proto_rawDesc)),
NumEnums: 0,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_portforwarding_portforwarding_proto_goTypes,
DependencyIndexes: file_portforwarding_portforwarding_proto_depIdxs,
MessageInfos: file_portforwarding_portforwarding_proto_msgTypes,
}.Build()
File_portforwarding_portforwarding_proto = out.File
file_portforwarding_portforwarding_proto_goTypes = nil
file_portforwarding_portforwarding_proto_depIdxs = nil
}

View File

@ -0,0 +1,180 @@
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: portforwarding/portforwarding.proto
package portforwardingv1connect
import (
connect "connectrpc.com/connect"
context "context"
errors "errors"
portforwarding "git.kocoder.xyz/kocoder/portforwarder/gen/portforwarding"
http "net/http"
strings "strings"
)
// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect.IsAtLeastVersion1_13_0
const (
// PortForwardingServiceName is the fully-qualified name of the PortForwardingService service.
PortForwardingServiceName = "portforwarding.v1.PortForwardingService"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
// PortForwardingServiceListPortforwardingsProcedure is the fully-qualified name of the
// PortForwardingService's ListPortforwardings RPC.
PortForwardingServiceListPortforwardingsProcedure = "/portforwarding.v1.PortForwardingService/ListPortforwardings"
// PortForwardingServiceCreatePortforwardingProcedure is the fully-qualified name of the
// PortForwardingService's CreatePortforwarding RPC.
PortForwardingServiceCreatePortforwardingProcedure = "/portforwarding.v1.PortForwardingService/CreatePortforwarding"
// PortForwardingServiceDeletePortforwardingProcedure is the fully-qualified name of the
// PortForwardingService's DeletePortforwarding RPC.
PortForwardingServiceDeletePortforwardingProcedure = "/portforwarding.v1.PortForwardingService/DeletePortforwarding"
)
// PortForwardingServiceClient is a client for the portforwarding.v1.PortForwardingService service.
type PortForwardingServiceClient interface {
ListPortforwardings(context.Context, *portforwarding.ListPortforwardingsRequest) (*portforwarding.ListPortforwardingsResponse, error)
CreatePortforwarding(context.Context, *portforwarding.CreatePortforwardingRequest) (*portforwarding.CreatePortforwardingResponse, error)
DeletePortforwarding(context.Context, *portforwarding.DeletePortforwardingRequest) (*portforwarding.DeletePortforwardingResponse, error)
}
// NewPortForwardingServiceClient constructs a client for the
// portforwarding.v1.PortForwardingService service. By default, it uses the Connect protocol with
// the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed requests. To use
// the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewPortForwardingServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PortForwardingServiceClient {
baseURL = strings.TrimRight(baseURL, "/")
portForwardingServiceMethods := portforwarding.File_portforwarding_portforwarding_proto.Services().ByName("PortForwardingService").Methods()
return &portForwardingServiceClient{
listPortforwardings: connect.NewClient[portforwarding.ListPortforwardingsRequest, portforwarding.ListPortforwardingsResponse](
httpClient,
baseURL+PortForwardingServiceListPortforwardingsProcedure,
connect.WithSchema(portForwardingServiceMethods.ByName("ListPortforwardings")),
connect.WithClientOptions(opts...),
),
createPortforwarding: connect.NewClient[portforwarding.CreatePortforwardingRequest, portforwarding.CreatePortforwardingResponse](
httpClient,
baseURL+PortForwardingServiceCreatePortforwardingProcedure,
connect.WithSchema(portForwardingServiceMethods.ByName("CreatePortforwarding")),
connect.WithClientOptions(opts...),
),
deletePortforwarding: connect.NewClient[portforwarding.DeletePortforwardingRequest, portforwarding.DeletePortforwardingResponse](
httpClient,
baseURL+PortForwardingServiceDeletePortforwardingProcedure,
connect.WithSchema(portForwardingServiceMethods.ByName("DeletePortforwarding")),
connect.WithClientOptions(opts...),
),
}
}
// portForwardingServiceClient implements PortForwardingServiceClient.
type portForwardingServiceClient struct {
listPortforwardings *connect.Client[portforwarding.ListPortforwardingsRequest, portforwarding.ListPortforwardingsResponse]
createPortforwarding *connect.Client[portforwarding.CreatePortforwardingRequest, portforwarding.CreatePortforwardingResponse]
deletePortforwarding *connect.Client[portforwarding.DeletePortforwardingRequest, portforwarding.DeletePortforwardingResponse]
}
// ListPortforwardings calls portforwarding.v1.PortForwardingService.ListPortforwardings.
func (c *portForwardingServiceClient) ListPortforwardings(ctx context.Context, req *portforwarding.ListPortforwardingsRequest) (*portforwarding.ListPortforwardingsResponse, error) {
response, err := c.listPortforwardings.CallUnary(ctx, connect.NewRequest(req))
if response != nil {
return response.Msg, err
}
return nil, err
}
// CreatePortforwarding calls portforwarding.v1.PortForwardingService.CreatePortforwarding.
func (c *portForwardingServiceClient) CreatePortforwarding(ctx context.Context, req *portforwarding.CreatePortforwardingRequest) (*portforwarding.CreatePortforwardingResponse, error) {
response, err := c.createPortforwarding.CallUnary(ctx, connect.NewRequest(req))
if response != nil {
return response.Msg, err
}
return nil, err
}
// DeletePortforwarding calls portforwarding.v1.PortForwardingService.DeletePortforwarding.
func (c *portForwardingServiceClient) DeletePortforwarding(ctx context.Context, req *portforwarding.DeletePortforwardingRequest) (*portforwarding.DeletePortforwardingResponse, error) {
response, err := c.deletePortforwarding.CallUnary(ctx, connect.NewRequest(req))
if response != nil {
return response.Msg, err
}
return nil, err
}
// PortForwardingServiceHandler is an implementation of the portforwarding.v1.PortForwardingService
// service.
type PortForwardingServiceHandler interface {
ListPortforwardings(context.Context, *portforwarding.ListPortforwardingsRequest) (*portforwarding.ListPortforwardingsResponse, error)
CreatePortforwarding(context.Context, *portforwarding.CreatePortforwardingRequest) (*portforwarding.CreatePortforwardingResponse, error)
DeletePortforwarding(context.Context, *portforwarding.DeletePortforwardingRequest) (*portforwarding.DeletePortforwardingResponse, error)
}
// NewPortForwardingServiceHandler builds an HTTP handler from the service implementation. It
// returns the path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewPortForwardingServiceHandler(svc PortForwardingServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
portForwardingServiceMethods := portforwarding.File_portforwarding_portforwarding_proto.Services().ByName("PortForwardingService").Methods()
portForwardingServiceListPortforwardingsHandler := connect.NewUnaryHandlerSimple(
PortForwardingServiceListPortforwardingsProcedure,
svc.ListPortforwardings,
connect.WithSchema(portForwardingServiceMethods.ByName("ListPortforwardings")),
connect.WithHandlerOptions(opts...),
)
portForwardingServiceCreatePortforwardingHandler := connect.NewUnaryHandlerSimple(
PortForwardingServiceCreatePortforwardingProcedure,
svc.CreatePortforwarding,
connect.WithSchema(portForwardingServiceMethods.ByName("CreatePortforwarding")),
connect.WithHandlerOptions(opts...),
)
portForwardingServiceDeletePortforwardingHandler := connect.NewUnaryHandlerSimple(
PortForwardingServiceDeletePortforwardingProcedure,
svc.DeletePortforwarding,
connect.WithSchema(portForwardingServiceMethods.ByName("DeletePortforwarding")),
connect.WithHandlerOptions(opts...),
)
return "/portforwarding.v1.PortForwardingService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case PortForwardingServiceListPortforwardingsProcedure:
portForwardingServiceListPortforwardingsHandler.ServeHTTP(w, r)
case PortForwardingServiceCreatePortforwardingProcedure:
portForwardingServiceCreatePortforwardingHandler.ServeHTTP(w, r)
case PortForwardingServiceDeletePortforwardingProcedure:
portForwardingServiceDeletePortforwardingHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedPortForwardingServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedPortForwardingServiceHandler struct{}
func (UnimplementedPortForwardingServiceHandler) ListPortforwardings(context.Context, *portforwarding.ListPortforwardingsRequest) (*portforwarding.ListPortforwardingsResponse, error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("portforwarding.v1.PortForwardingService.ListPortforwardings is not implemented"))
}
func (UnimplementedPortForwardingServiceHandler) CreatePortforwarding(context.Context, *portforwarding.CreatePortforwardingRequest) (*portforwarding.CreatePortforwardingResponse, error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("portforwarding.v1.PortForwardingService.CreatePortforwarding is not implemented"))
}
func (UnimplementedPortForwardingServiceHandler) DeletePortforwarding(context.Context, *portforwarding.DeletePortforwardingRequest) (*portforwarding.DeletePortforwardingResponse, error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("portforwarding.v1.PortForwardingService.DeletePortforwarding is not implemented"))
}