yao/tai/tunnel/taipb/tunnel_grpc.pb.go
Max 9c9701ed7e feat(tunnel): refactor VNC and proxy handling with structured routing
- Updated VNC and proxy handling in the tunnel to utilize a structured routing approach, enhancing clarity and maintainability.
- Replaced direct port checks with a new `forwardRoute` struct to encapsulate routing information, including channel type, container ID, and port.
- Modified request handling to streamline the forwarding process and improve error handling for unknown routes.
- Enhanced tests to validate the new routing logic and ensure consistent behavior across VNC and proxy requests.

Made-with: Cursor
2026-03-14 21:51:32 +08:00

151 lines
6.3 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v4.25.0
// source: tunnel/proto/tunnel.proto
package taipb
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 (
TaiTunnel_Register_FullMethodName = "/tai.tunnel.TaiTunnel/Register"
TaiTunnel_Forward_FullMethodName = "/tai.tunnel.TaiTunnel/Forward"
)
// TaiTunnelClient is the client API for TaiTunnel 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 TaiTunnelClient interface {
// Control plane: Tai → Yao, register + keepalive + receive commands.
Register(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TunnelControl, TunnelControl], error)
// Data plane: Tai → Yao, raw TCP forwarding.
Forward(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ForwardData, ForwardData], error)
}
type taiTunnelClient struct {
cc grpc.ClientConnInterface
}
func NewTaiTunnelClient(cc grpc.ClientConnInterface) TaiTunnelClient {
return &taiTunnelClient{cc}
}
func (c *taiTunnelClient) Register(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[TunnelControl, TunnelControl], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &TaiTunnel_ServiceDesc.Streams[0], TaiTunnel_Register_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[TunnelControl, TunnelControl]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TaiTunnel_RegisterClient = grpc.BidiStreamingClient[TunnelControl, TunnelControl]
func (c *taiTunnelClient) Forward(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ForwardData, ForwardData], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &TaiTunnel_ServiceDesc.Streams[1], TaiTunnel_Forward_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[ForwardData, ForwardData]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TaiTunnel_ForwardClient = grpc.BidiStreamingClient[ForwardData, ForwardData]
// TaiTunnelServer is the server API for TaiTunnel service.
// All implementations must embed UnimplementedTaiTunnelServer
// for forward compatibility.
type TaiTunnelServer interface {
// Control plane: Tai → Yao, register + keepalive + receive commands.
Register(grpc.BidiStreamingServer[TunnelControl, TunnelControl]) error
// Data plane: Tai → Yao, raw TCP forwarding.
Forward(grpc.BidiStreamingServer[ForwardData, ForwardData]) error
mustEmbedUnimplementedTaiTunnelServer()
}
// UnimplementedTaiTunnelServer 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 UnimplementedTaiTunnelServer struct{}
func (UnimplementedTaiTunnelServer) Register(grpc.BidiStreamingServer[TunnelControl, TunnelControl]) error {
return status.Error(codes.Unimplemented, "method Register not implemented")
}
func (UnimplementedTaiTunnelServer) Forward(grpc.BidiStreamingServer[ForwardData, ForwardData]) error {
return status.Error(codes.Unimplemented, "method Forward not implemented")
}
func (UnimplementedTaiTunnelServer) mustEmbedUnimplementedTaiTunnelServer() {}
func (UnimplementedTaiTunnelServer) testEmbeddedByValue() {}
// UnsafeTaiTunnelServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to TaiTunnelServer will
// result in compilation errors.
type UnsafeTaiTunnelServer interface {
mustEmbedUnimplementedTaiTunnelServer()
}
func RegisterTaiTunnelServer(s grpc.ServiceRegistrar, srv TaiTunnelServer) {
// If the following call panics, it indicates UnimplementedTaiTunnelServer 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(&TaiTunnel_ServiceDesc, srv)
}
func _TaiTunnel_Register_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TaiTunnelServer).Register(&grpc.GenericServerStream[TunnelControl, TunnelControl]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TaiTunnel_RegisterServer = grpc.BidiStreamingServer[TunnelControl, TunnelControl]
func _TaiTunnel_Forward_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TaiTunnelServer).Forward(&grpc.GenericServerStream[ForwardData, ForwardData]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TaiTunnel_ForwardServer = grpc.BidiStreamingServer[ForwardData, ForwardData]
// TaiTunnel_ServiceDesc is the grpc.ServiceDesc for TaiTunnel service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TaiTunnel_ServiceDesc = grpc.ServiceDesc{
ServiceName: "tai.tunnel.TaiTunnel",
HandlerType: (*TaiTunnelServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "Register",
Handler: _TaiTunnel_Register_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "Forward",
Handler: _TaiTunnel_Forward_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "tunnel/proto/tunnel.proto",
}