Files
safeline/activate/safeline/proto/v1/server/proto_server_grpc.pb.go
2025-03-11 19:01:30 +08:00

155 lines
5.7 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.29.1
// source: proto_server.proto
package server
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 (
Server_Sync_FullMethodName = "/chaitin.safeline_ops.proto.v1.server.Server/Sync"
Server_IPInfo_FullMethodName = "/chaitin.safeline_ops.proto.v1.server.Server/IPInfo"
)
// ServerClient is the client API for Server 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 ServerClient interface {
Sync(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SyncRequest, SyncPush], error)
IPInfo(ctx context.Context, in *IPInfoRequest, opts ...grpc.CallOption) (*IPInfoResponse, error)
}
type serverClient struct {
cc grpc.ClientConnInterface
}
func NewServerClient(cc grpc.ClientConnInterface) ServerClient {
return &serverClient{cc}
}
func (c *serverClient) Sync(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SyncRequest, SyncPush], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &Server_ServiceDesc.Streams[0], Server_Sync_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[SyncRequest, SyncPush]{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 Server_SyncClient = grpc.BidiStreamingClient[SyncRequest, SyncPush]
func (c *serverClient) IPInfo(ctx context.Context, in *IPInfoRequest, opts ...grpc.CallOption) (*IPInfoResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(IPInfoResponse)
err := c.cc.Invoke(ctx, Server_IPInfo_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServerServer is the server API for Server service.
// All implementations must embed UnimplementedServerServer
// for forward compatibility.
type ServerServer interface {
Sync(grpc.BidiStreamingServer[SyncRequest, SyncPush]) error
IPInfo(context.Context, *IPInfoRequest) (*IPInfoResponse, error)
mustEmbedUnimplementedServerServer()
}
// UnimplementedServerServer 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 UnimplementedServerServer struct{}
func (UnimplementedServerServer) Sync(grpc.BidiStreamingServer[SyncRequest, SyncPush]) error {
return status.Errorf(codes.Unimplemented, "method Sync not implemented")
}
func (UnimplementedServerServer) IPInfo(context.Context, *IPInfoRequest) (*IPInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method IPInfo not implemented")
}
func (UnimplementedServerServer) mustEmbedUnimplementedServerServer() {}
func (UnimplementedServerServer) testEmbeddedByValue() {}
// UnsafeServerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ServerServer will
// result in compilation errors.
type UnsafeServerServer interface {
mustEmbedUnimplementedServerServer()
}
func RegisterServerServer(s grpc.ServiceRegistrar, srv ServerServer) {
// If the following call pancis, it indicates UnimplementedServerServer 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(&Server_ServiceDesc, srv)
}
func _Server_Sync_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(ServerServer).Sync(&grpc.GenericServerStream[SyncRequest, SyncPush]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Server_SyncServer = grpc.BidiStreamingServer[SyncRequest, SyncPush]
func _Server_IPInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IPInfoRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServerServer).IPInfo(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Server_IPInfo_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServerServer).IPInfo(ctx, req.(*IPInfoRequest))
}
return interceptor(ctx, in, info, handler)
}
// Server_ServiceDesc is the grpc.ServiceDesc for Server service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Server_ServiceDesc = grpc.ServiceDesc{
ServiceName: "chaitin.safeline_ops.proto.v1.server.Server",
HandlerType: (*ServerServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "IPInfo",
Handler: _Server_IPInfo_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Sync",
Handler: _Server_Sync_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "proto_server.proto",
}