diff --git a/go.mod b/go.mod index 89ee3a24..7b896a9b 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( go.etcd.io/etcd/server/v3 v3.5.15 go.uber.org/zap v1.27.0 google.golang.org/grpc v1.65.0 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 google.golang.org/protobuf v1.34.2 ) @@ -78,13 +78,13 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/multierr v1.10.0 // indirect golang.org/x/crypto v0.25.0 // indirect - golang.org/x/net v0.25.0 // indirect + golang.org/x/net v0.26.0 // indirect golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect sigs.k8s.io/yaml v1.2.0 // indirect diff --git a/go.sum b/go.sum index 50aacc2c..05923c6c 100644 --- a/go.sum +++ b/go.sum @@ -239,8 +239,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= @@ -291,8 +291,8 @@ google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUE google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -301,8 +301,8 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 h1:9SxA29VM43MF5Z9dQu694wmY5t8E/Gxr7s+RSxiIDmc= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0/go.mod h1:yZOK5zhQMiALmuweVdIVoQPa6eIJyXn2B9g5dJDhqX4= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/grpc_backend_grpc.pb.go b/grpc_backend_grpc.pb.go index e0801d86..9f690fce 100644 --- a/grpc_backend_grpc.pb.go +++ b/grpc_backend_grpc.pb.go @@ -33,8 +33,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( RpcBackend_GetSessionCount_FullMethodName = "/signaling.RpcBackend/GetSessionCount" @@ -67,20 +67,24 @@ func (c *rpcBackendClient) GetSessionCount(ctx context.Context, in *GetSessionCo // RpcBackendServer is the server API for RpcBackend service. // All implementations must embed UnimplementedRpcBackendServer -// for forward compatibility +// for forward compatibility. type RpcBackendServer interface { GetSessionCount(context.Context, *GetSessionCountRequest) (*GetSessionCountReply, error) mustEmbedUnimplementedRpcBackendServer() } -// UnimplementedRpcBackendServer must be embedded to have forward compatible implementations. -type UnimplementedRpcBackendServer struct { -} +// UnimplementedRpcBackendServer 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 UnimplementedRpcBackendServer struct{} func (UnimplementedRpcBackendServer) GetSessionCount(context.Context, *GetSessionCountRequest) (*GetSessionCountReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSessionCount not implemented") } func (UnimplementedRpcBackendServer) mustEmbedUnimplementedRpcBackendServer() {} +func (UnimplementedRpcBackendServer) testEmbeddedByValue() {} // UnsafeRpcBackendServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RpcBackendServer will @@ -90,6 +94,13 @@ type UnsafeRpcBackendServer interface { } func RegisterRpcBackendServer(s grpc.ServiceRegistrar, srv RpcBackendServer) { + // If the following call pancis, it indicates UnimplementedRpcBackendServer 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(&RpcBackend_ServiceDesc, srv) } diff --git a/grpc_internal_grpc.pb.go b/grpc_internal_grpc.pb.go index 02b4c659..577ef0df 100644 --- a/grpc_internal_grpc.pb.go +++ b/grpc_internal_grpc.pb.go @@ -33,8 +33,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( RpcInternal_GetServerId_FullMethodName = "/signaling.RpcInternal/GetServerId" @@ -67,20 +67,24 @@ func (c *rpcInternalClient) GetServerId(ctx context.Context, in *GetServerIdRequ // RpcInternalServer is the server API for RpcInternal service. // All implementations must embed UnimplementedRpcInternalServer -// for forward compatibility +// for forward compatibility. type RpcInternalServer interface { GetServerId(context.Context, *GetServerIdRequest) (*GetServerIdReply, error) mustEmbedUnimplementedRpcInternalServer() } -// UnimplementedRpcInternalServer must be embedded to have forward compatible implementations. -type UnimplementedRpcInternalServer struct { -} +// UnimplementedRpcInternalServer 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 UnimplementedRpcInternalServer struct{} func (UnimplementedRpcInternalServer) GetServerId(context.Context, *GetServerIdRequest) (*GetServerIdReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetServerId not implemented") } func (UnimplementedRpcInternalServer) mustEmbedUnimplementedRpcInternalServer() {} +func (UnimplementedRpcInternalServer) testEmbeddedByValue() {} // UnsafeRpcInternalServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RpcInternalServer will @@ -90,6 +94,13 @@ type UnsafeRpcInternalServer interface { } func RegisterRpcInternalServer(s grpc.ServiceRegistrar, srv RpcInternalServer) { + // If the following call pancis, it indicates UnimplementedRpcInternalServer 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(&RpcInternal_ServiceDesc, srv) } diff --git a/grpc_mcu_grpc.pb.go b/grpc_mcu_grpc.pb.go index 8f8732fa..3b375915 100644 --- a/grpc_mcu_grpc.pb.go +++ b/grpc_mcu_grpc.pb.go @@ -33,8 +33,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( RpcMcu_GetPublisherId_FullMethodName = "/signaling.RpcMcu/GetPublisherId" @@ -67,20 +67,24 @@ func (c *rpcMcuClient) GetPublisherId(ctx context.Context, in *GetPublisherIdReq // RpcMcuServer is the server API for RpcMcu service. // All implementations must embed UnimplementedRpcMcuServer -// for forward compatibility +// for forward compatibility. type RpcMcuServer interface { GetPublisherId(context.Context, *GetPublisherIdRequest) (*GetPublisherIdReply, error) mustEmbedUnimplementedRpcMcuServer() } -// UnimplementedRpcMcuServer must be embedded to have forward compatible implementations. -type UnimplementedRpcMcuServer struct { -} +// UnimplementedRpcMcuServer 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 UnimplementedRpcMcuServer struct{} func (UnimplementedRpcMcuServer) GetPublisherId(context.Context, *GetPublisherIdRequest) (*GetPublisherIdReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPublisherId not implemented") } func (UnimplementedRpcMcuServer) mustEmbedUnimplementedRpcMcuServer() {} +func (UnimplementedRpcMcuServer) testEmbeddedByValue() {} // UnsafeRpcMcuServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RpcMcuServer will @@ -90,6 +94,13 @@ type UnsafeRpcMcuServer interface { } func RegisterRpcMcuServer(s grpc.ServiceRegistrar, srv RpcMcuServer) { + // If the following call pancis, it indicates UnimplementedRpcMcuServer 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(&RpcMcu_ServiceDesc, srv) } diff --git a/grpc_sessions_grpc.pb.go b/grpc_sessions_grpc.pb.go index 2e4d47fe..7898269a 100644 --- a/grpc_sessions_grpc.pb.go +++ b/grpc_sessions_grpc.pb.go @@ -33,8 +33,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( RpcSessions_LookupResumeId_FullMethodName = "/signaling.RpcSessions/LookupResumeId" @@ -50,7 +50,7 @@ type RpcSessionsClient interface { LookupResumeId(ctx context.Context, in *LookupResumeIdRequest, opts ...grpc.CallOption) (*LookupResumeIdReply, error) LookupSessionId(ctx context.Context, in *LookupSessionIdRequest, opts ...grpc.CallOption) (*LookupSessionIdReply, error) IsSessionInCall(ctx context.Context, in *IsSessionInCallRequest, opts ...grpc.CallOption) (*IsSessionInCallReply, error) - ProxySession(ctx context.Context, opts ...grpc.CallOption) (RpcSessions_ProxySessionClient, error) + ProxySession(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientSessionMessage, ServerSessionMessage], error) } type rpcSessionsClient struct { @@ -91,52 +91,36 @@ func (c *rpcSessionsClient) IsSessionInCall(ctx context.Context, in *IsSessionIn return out, nil } -func (c *rpcSessionsClient) ProxySession(ctx context.Context, opts ...grpc.CallOption) (RpcSessions_ProxySessionClient, error) { +func (c *rpcSessionsClient) ProxySession(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientSessionMessage, ServerSessionMessage], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &RpcSessions_ServiceDesc.Streams[0], RpcSessions_ProxySession_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &rpcSessionsProxySessionClient{ClientStream: stream} + x := &grpc.GenericClientStream[ClientSessionMessage, ServerSessionMessage]{ClientStream: stream} return x, nil } -type RpcSessions_ProxySessionClient interface { - Send(*ClientSessionMessage) error - Recv() (*ServerSessionMessage, error) - grpc.ClientStream -} - -type rpcSessionsProxySessionClient struct { - grpc.ClientStream -} - -func (x *rpcSessionsProxySessionClient) Send(m *ClientSessionMessage) error { - return x.ClientStream.SendMsg(m) -} - -func (x *rpcSessionsProxySessionClient) Recv() (*ServerSessionMessage, error) { - m := new(ServerSessionMessage) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type RpcSessions_ProxySessionClient = grpc.BidiStreamingClient[ClientSessionMessage, ServerSessionMessage] // RpcSessionsServer is the server API for RpcSessions service. // All implementations must embed UnimplementedRpcSessionsServer -// for forward compatibility +// for forward compatibility. type RpcSessionsServer interface { LookupResumeId(context.Context, *LookupResumeIdRequest) (*LookupResumeIdReply, error) LookupSessionId(context.Context, *LookupSessionIdRequest) (*LookupSessionIdReply, error) IsSessionInCall(context.Context, *IsSessionInCallRequest) (*IsSessionInCallReply, error) - ProxySession(RpcSessions_ProxySessionServer) error + ProxySession(grpc.BidiStreamingServer[ClientSessionMessage, ServerSessionMessage]) error mustEmbedUnimplementedRpcSessionsServer() } -// UnimplementedRpcSessionsServer must be embedded to have forward compatible implementations. -type UnimplementedRpcSessionsServer struct { -} +// UnimplementedRpcSessionsServer 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 UnimplementedRpcSessionsServer struct{} func (UnimplementedRpcSessionsServer) LookupResumeId(context.Context, *LookupResumeIdRequest) (*LookupResumeIdReply, error) { return nil, status.Errorf(codes.Unimplemented, "method LookupResumeId not implemented") @@ -147,10 +131,11 @@ func (UnimplementedRpcSessionsServer) LookupSessionId(context.Context, *LookupSe func (UnimplementedRpcSessionsServer) IsSessionInCall(context.Context, *IsSessionInCallRequest) (*IsSessionInCallReply, error) { return nil, status.Errorf(codes.Unimplemented, "method IsSessionInCall not implemented") } -func (UnimplementedRpcSessionsServer) ProxySession(RpcSessions_ProxySessionServer) error { +func (UnimplementedRpcSessionsServer) ProxySession(grpc.BidiStreamingServer[ClientSessionMessage, ServerSessionMessage]) error { return status.Errorf(codes.Unimplemented, "method ProxySession not implemented") } func (UnimplementedRpcSessionsServer) mustEmbedUnimplementedRpcSessionsServer() {} +func (UnimplementedRpcSessionsServer) testEmbeddedByValue() {} // UnsafeRpcSessionsServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RpcSessionsServer will @@ -160,6 +145,13 @@ type UnsafeRpcSessionsServer interface { } func RegisterRpcSessionsServer(s grpc.ServiceRegistrar, srv RpcSessionsServer) { + // If the following call pancis, it indicates UnimplementedRpcSessionsServer 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(&RpcSessions_ServiceDesc, srv) } @@ -218,30 +210,11 @@ func _RpcSessions_IsSessionInCall_Handler(srv interface{}, ctx context.Context, } func _RpcSessions_ProxySession_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(RpcSessionsServer).ProxySession(&rpcSessionsProxySessionServer{ServerStream: stream}) -} - -type RpcSessions_ProxySessionServer interface { - Send(*ServerSessionMessage) error - Recv() (*ClientSessionMessage, error) - grpc.ServerStream -} - -type rpcSessionsProxySessionServer struct { - grpc.ServerStream + return srv.(RpcSessionsServer).ProxySession(&grpc.GenericServerStream[ClientSessionMessage, ServerSessionMessage]{ServerStream: stream}) } -func (x *rpcSessionsProxySessionServer) Send(m *ServerSessionMessage) error { - return x.ServerStream.SendMsg(m) -} - -func (x *rpcSessionsProxySessionServer) Recv() (*ClientSessionMessage, error) { - m := new(ClientSessionMessage) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type RpcSessions_ProxySessionServer = grpc.BidiStreamingServer[ClientSessionMessage, ServerSessionMessage] // RpcSessions_ServiceDesc is the grpc.ServiceDesc for RpcSessions service. // It's only intended for direct use with grpc.RegisterService,