All checks were successful
ci/woodpecker/push/build Pipeline was successful
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
package v1
|
|
|
|
import (
|
|
"context"
|
|
|
|
test "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/test/v1"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/protobuf/types/known/emptypb"
|
|
)
|
|
|
|
func NewTestServer() *TestServer {
|
|
return &TestServer{}
|
|
}
|
|
|
|
type TestServer struct {
|
|
test.UnimplementedTestServiceServer
|
|
}
|
|
|
|
func (t *TestServer) Pong(ctx context.Context, in *test.PongRequest) (*test.PongResponse, error) {
|
|
return &test.PongResponse{}, nil
|
|
}
|
|
|
|
func (t *TestServer) PongStream(in *emptypb.Empty, stream grpc.ServerStreamingServer[test.PongStreamResponse]) error {
|
|
for i := 0; i < 10; i++ {
|
|
if err := stream.Send(&test.PongStreamResponse{Dummy: "test"}); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func NewPublicTestServer() *PublicTestServer {
|
|
return &PublicTestServer{}
|
|
}
|
|
|
|
type PublicTestServer struct {
|
|
test.UnimplementedPublicTestServiceServer
|
|
}
|
|
|
|
func (t *PublicTestServer) Ping(ctx context.Context, in *test.PingRequest) (*test.PingResponse, error) {
|
|
return &test.PingResponse{}, nil
|
|
}
|
|
|
|
func (t *PublicTestServer) PingStream(in *emptypb.Empty, stream grpc.ServerStreamingServer[test.PingStreamResponse]) error {
|
|
for i := 0; i < 10; i++ {
|
|
if err := stream.Send(&test.PingStreamResponse{Dummy: "test"}); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|