proto: add RecordSpeedTest RPC + request/response messages
This commit is contained in:
@@ -19,9 +19,10 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
SpeedStatus_RecentResults_FullMethodName = "/stats.v1.SpeedStatus/RecentResults"
|
||||
SpeedStatus_Aggregate_FullMethodName = "/stats.v1.SpeedStatus/Aggregate"
|
||||
SpeedStatus_Tunnel_FullMethodName = "/stats.v1.SpeedStatus/Tunnel"
|
||||
SpeedStatus_RecentResults_FullMethodName = "/stats.v1.SpeedStatus/RecentResults"
|
||||
SpeedStatus_Aggregate_FullMethodName = "/stats.v1.SpeedStatus/Aggregate"
|
||||
SpeedStatus_Tunnel_FullMethodName = "/stats.v1.SpeedStatus/Tunnel"
|
||||
SpeedStatus_RecordSpeedTest_FullMethodName = "/stats.v1.SpeedStatus/RecordSpeedTest"
|
||||
)
|
||||
|
||||
// SpeedStatusClient is the client API for SpeedStatus service.
|
||||
@@ -36,6 +37,8 @@ type SpeedStatusClient interface {
|
||||
// Auth: Bearer JWT (HS256) в gRPC metadata "authorization: Bearer <jwt>".
|
||||
// Server validates: signature, exp, scope=="tunnel", optional revocation list.
|
||||
Tunnel(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Frame, Frame], error)
|
||||
// RecordSpeedTest ingests a single speedtest sample from an edge node.
|
||||
RecordSpeedTest(ctx context.Context, in *RecordSpeedTestRequest, opts ...grpc.CallOption) (*RecordSpeedTestResponse, error)
|
||||
}
|
||||
|
||||
type speedStatusClient struct {
|
||||
@@ -88,6 +91,16 @@ func (c *speedStatusClient) Tunnel(ctx context.Context, opts ...grpc.CallOption)
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type SpeedStatus_TunnelClient = grpc.BidiStreamingClient[Frame, Frame]
|
||||
|
||||
func (c *speedStatusClient) RecordSpeedTest(ctx context.Context, in *RecordSpeedTestRequest, opts ...grpc.CallOption) (*RecordSpeedTestResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RecordSpeedTestResponse)
|
||||
err := c.cc.Invoke(ctx, SpeedStatus_RecordSpeedTest_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SpeedStatusServer is the server API for SpeedStatus service.
|
||||
// All implementations must embed UnimplementedSpeedStatusServer
|
||||
// for forward compatibility.
|
||||
@@ -100,6 +113,8 @@ type SpeedStatusServer interface {
|
||||
// Auth: Bearer JWT (HS256) в gRPC metadata "authorization: Bearer <jwt>".
|
||||
// Server validates: signature, exp, scope=="tunnel", optional revocation list.
|
||||
Tunnel(grpc.BidiStreamingServer[Frame, Frame]) error
|
||||
// RecordSpeedTest ingests a single speedtest sample from an edge node.
|
||||
RecordSpeedTest(context.Context, *RecordSpeedTestRequest) (*RecordSpeedTestResponse, error)
|
||||
mustEmbedUnimplementedSpeedStatusServer()
|
||||
}
|
||||
|
||||
@@ -119,6 +134,9 @@ func (UnimplementedSpeedStatusServer) Aggregate(context.Context, *Range) (*Histo
|
||||
func (UnimplementedSpeedStatusServer) Tunnel(grpc.BidiStreamingServer[Frame, Frame]) error {
|
||||
return status.Error(codes.Unimplemented, "method Tunnel not implemented")
|
||||
}
|
||||
func (UnimplementedSpeedStatusServer) RecordSpeedTest(context.Context, *RecordSpeedTestRequest) (*RecordSpeedTestResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method RecordSpeedTest not implemented")
|
||||
}
|
||||
func (UnimplementedSpeedStatusServer) mustEmbedUnimplementedSpeedStatusServer() {}
|
||||
func (UnimplementedSpeedStatusServer) testEmbeddedByValue() {}
|
||||
|
||||
@@ -176,6 +194,24 @@ func _SpeedStatus_Tunnel_Handler(srv interface{}, stream grpc.ServerStream) erro
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type SpeedStatus_TunnelServer = grpc.BidiStreamingServer[Frame, Frame]
|
||||
|
||||
func _SpeedStatus_RecordSpeedTest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecordSpeedTestRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SpeedStatusServer).RecordSpeedTest(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: SpeedStatus_RecordSpeedTest_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SpeedStatusServer).RecordSpeedTest(ctx, req.(*RecordSpeedTestRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// SpeedStatus_ServiceDesc is the grpc.ServiceDesc for SpeedStatus service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -187,6 +223,10 @@ var SpeedStatus_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Aggregate",
|
||||
Handler: _SpeedStatus_Aggregate_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RecordSpeedTest",
|
||||
Handler: _SpeedStatus_RecordSpeedTest_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user