From fcbb016a216958894781d3b6d98883c840cd1342 Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Mon, 29 Jul 2024 10:41:13 -0300 Subject: [PATCH 1/3] chore: Bump google.golang.org/grpc/cmd/protoc-gen-go-grpc to v1.5.0 --- go.mod | 2 +- go.sum | 4 ++-- integrations/event-handler/go.mod | 2 +- integrations/event-handler/go.sum | 4 ++-- integrations/terraform/go.mod | 2 +- integrations/terraform/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index acb5c2976fb0b..db3c63d92fa03 100644 --- a/go.mod +++ b/go.mod @@ -206,7 +206,7 @@ require ( google.golang.org/api v0.187.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 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.0 google.golang.org/protobuf v1.34.2 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/dnaeon/go-vcr.v3 v3.2.0 diff --git a/go.sum b/go.sum index 0e0887041f210..c520cbf0a5d58 100644 --- a/go.sum +++ b/go.sum @@ -3121,8 +3121,8 @@ google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpX 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.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -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.0 h1:LbGOiI82o4xuOWAYyRCrb7qgrRsKvlLRLcFal5iDz5w= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.0/go.mod h1:BQzMLXlekia34Yc4jZRJW0Rs0bhTn5/jMYPN349sUPA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/integrations/event-handler/go.mod b/integrations/event-handler/go.mod index 11fd3836b122a..de23220d86396 100644 --- a/integrations/event-handler/go.mod +++ b/integrations/event-handler/go.mod @@ -288,7 +288,7 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.65.0 // indirect - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect diff --git a/integrations/event-handler/go.sum b/integrations/event-handler/go.sum index 31b54526320ec..2cc5589fab8c0 100644 --- a/integrations/event-handler/go.sum +++ b/integrations/event-handler/go.sum @@ -2339,8 +2339,8 @@ google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpX 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.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -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.0 h1:LbGOiI82o4xuOWAYyRCrb7qgrRsKvlLRLcFal5iDz5w= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.0/go.mod h1:BQzMLXlekia34Yc4jZRJW0Rs0bhTn5/jMYPN349sUPA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/integrations/terraform/go.mod b/integrations/terraform/go.mod index 878a662ab28c7..a1c00dbbe59e2 100644 --- a/integrations/terraform/go.mod +++ b/integrations/terraform/go.mod @@ -341,7 +341,7 @@ require ( google.golang.org/genproto v0.0.0-20240624140628-dc46fd24d27d // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect diff --git a/integrations/terraform/go.sum b/integrations/terraform/go.sum index fe076981af841..9928b0f40cfb0 100644 --- a/integrations/terraform/go.sum +++ b/integrations/terraform/go.sum @@ -2717,8 +2717,8 @@ google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpX 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.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -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.0 h1:LbGOiI82o4xuOWAYyRCrb7qgrRsKvlLRLcFal5iDz5w= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.0/go.mod h1:BQzMLXlekia34Yc4jZRJW0Rs0bhTn5/jMYPN349sUPA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 61e5b9419aefde43b26531dcdbe6aaed07ca1da2 Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Mon, 29 Jul 2024 10:48:43 -0300 Subject: [PATCH 2/3] Update generated protos --- .../accessgraph/v1/secrets_service_grpc.pb.go | 141 +++----- .../v1/accesslist_service_grpc.pb.go | 25 +- ...access_monitoring_rules_service_grpc.pb.go | 25 +- .../teleport/auditlog/v1/auditlog_grpc.pb.go | 69 ++-- .../v1/clusterconfig_service_grpc.pb.go | 25 +- .../v1/crownjewel_service_grpc.pb.go | 25 +- .../dbobject/v1/dbobject_service_grpc.pb.go | 25 +- .../v1/dbobjectimportrule_service_grpc.pb.go | 25 +- .../v1/devicetrust_service_grpc.pb.go | 199 +++-------- .../v1/discoveryconfig_service_grpc.pb.go | 25 +- .../externalauditstorage_service_grpc.pb.go | 25 +- .../integration/v1/awsoidc_service_grpc.pb.go | 25 +- .../v1/integration_service_grpc.pb.go | 25 +- .../teleport/kube/v1/kube_service_grpc.pb.go | 25 +- .../kubewaitingcontainer_service_grpc.pb.go | 25 +- .../loginrule/v1/loginrule_service_grpc.pb.go | 25 +- .../v1/bot_instance_service_grpc.pb.go | 25 +- .../machineid/v1/bot_service_grpc.pb.go | 25 +- .../v1/workload_identity_service_grpc.pb.go | 25 +- .../v1/notifications_service_grpc.pb.go | 25 +- .../teleport/okta/v1/okta_service_grpc.pb.go | 25 +- .../plugins/v1/plugin_service_grpc.pb.go | 25 +- .../teleport/presence/v1/service_grpc.pb.go | 25 +- .../v1/resourceusage_service_grpc.pb.go | 25 +- .../go/teleport/samlidp/v1/samlidp_grpc.pb.go | 25 +- .../teleport/scim/v1/scim_service_grpc.pb.go | 25 +- .../v1/secreports_service_grpc.pb.go | 25 +- .../transport/v1/transport_service_grpc.pb.go | 141 +++----- .../trust/v1/trust_service_grpc.pb.go | 25 +- .../v1/userloginstate_service_grpc.pb.go | 25 +- .../users/v1/users_service_grpc.pb.go | 25 +- .../vnet/v1/vnet_config_service_grpc.pb.go | 25 +- .../v1/userpreferences_grpc.pb.go | 25 +- .../v1alpha/access_graph_service_grpc.pb.go | 321 ++++-------------- .../lib/teleterm/v1/service_grpc.pb.go | 127 +++---- .../v1/tshd_events_service_grpc.pb.go | 25 +- .../teleterm/vnet/v1/vnet_service_grpc.pb.go | 25 +- lib/multiplexer/test/ping_grpc.pb.go | 25 +- 38 files changed, 834 insertions(+), 964 deletions(-) diff --git a/api/gen/proto/go/teleport/accessgraph/v1/secrets_service_grpc.pb.go b/api/gen/proto/go/teleport/accessgraph/v1/secrets_service_grpc.pb.go index bc1e09264f36a..3c131c843dd49 100644 --- a/api/gen/proto/go/teleport/accessgraph/v1/secrets_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/accessgraph/v1/secrets_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/access_graph/v1/secrets_service.proto @@ -29,8 +29,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 ( SecretsScannerService_ReportAuthorizedKeys_FullMethodName = "/teleport.access_graph.v1.SecretsScannerService/ReportAuthorizedKeys" @@ -46,7 +46,7 @@ type SecretsScannerServiceClient interface { // ReportAuthorizedKeys is used by Teleport SSH nodes to report authorized keys // that could be used to bypass Teleport. // The client (Teleport SSH Node) should authenticate using the certificate-key pair signed by Teleport HostCA. - ReportAuthorizedKeys(ctx context.Context, opts ...grpc.CallOption) (SecretsScannerService_ReportAuthorizedKeysClient, error) + ReportAuthorizedKeys(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReportAuthorizedKeysRequest, ReportAuthorizedKeysResponse], error) // ReportSecrets is used by trusted devices to report secrets found on the host that could be used to bypass Teleport. // The client (device) should first authenticate using the [ReportSecretsRequest.device_assertion] flow. Please refer to // the [teleport.devicetrust.v1.AssertDeviceRequest] and [teleport.devicetrust.v1.AssertDeviceResponse] messages for more details. @@ -60,7 +60,7 @@ type SecretsScannerServiceClient interface { // // Any failure in the assertion ceremony will result in the stream being terminated by the server. All secrets // reported by the client before the assertion terminates will be ignored and result in the stream being terminated. - ReportSecrets(ctx context.Context, opts ...grpc.CallOption) (SecretsScannerService_ReportSecretsClient, error) + ReportSecrets(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReportSecretsRequest, ReportSecretsResponse], error) } type secretsScannerServiceClient struct { @@ -71,80 +71,42 @@ func NewSecretsScannerServiceClient(cc grpc.ClientConnInterface) SecretsScannerS return &secretsScannerServiceClient{cc} } -func (c *secretsScannerServiceClient) ReportAuthorizedKeys(ctx context.Context, opts ...grpc.CallOption) (SecretsScannerService_ReportAuthorizedKeysClient, error) { +func (c *secretsScannerServiceClient) ReportAuthorizedKeys(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReportAuthorizedKeysRequest, ReportAuthorizedKeysResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &SecretsScannerService_ServiceDesc.Streams[0], SecretsScannerService_ReportAuthorizedKeys_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &secretsScannerServiceReportAuthorizedKeysClient{ClientStream: stream} + x := &grpc.GenericClientStream[ReportAuthorizedKeysRequest, ReportAuthorizedKeysResponse]{ClientStream: stream} return x, nil } -type SecretsScannerService_ReportAuthorizedKeysClient interface { - Send(*ReportAuthorizedKeysRequest) error - Recv() (*ReportAuthorizedKeysResponse, error) - grpc.ClientStream -} - -type secretsScannerServiceReportAuthorizedKeysClient struct { - grpc.ClientStream -} - -func (x *secretsScannerServiceReportAuthorizedKeysClient) Send(m *ReportAuthorizedKeysRequest) error { - return x.ClientStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type SecretsScannerService_ReportAuthorizedKeysClient = grpc.BidiStreamingClient[ReportAuthorizedKeysRequest, ReportAuthorizedKeysResponse] -func (x *secretsScannerServiceReportAuthorizedKeysClient) Recv() (*ReportAuthorizedKeysResponse, error) { - m := new(ReportAuthorizedKeysResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *secretsScannerServiceClient) ReportSecrets(ctx context.Context, opts ...grpc.CallOption) (SecretsScannerService_ReportSecretsClient, error) { +func (c *secretsScannerServiceClient) ReportSecrets(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReportSecretsRequest, ReportSecretsResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &SecretsScannerService_ServiceDesc.Streams[1], SecretsScannerService_ReportSecrets_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &secretsScannerServiceReportSecretsClient{ClientStream: stream} + x := &grpc.GenericClientStream[ReportSecretsRequest, ReportSecretsResponse]{ClientStream: stream} return x, nil } -type SecretsScannerService_ReportSecretsClient interface { - Send(*ReportSecretsRequest) error - Recv() (*ReportSecretsResponse, error) - grpc.ClientStream -} - -type secretsScannerServiceReportSecretsClient struct { - grpc.ClientStream -} - -func (x *secretsScannerServiceReportSecretsClient) Send(m *ReportSecretsRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *secretsScannerServiceReportSecretsClient) Recv() (*ReportSecretsResponse, error) { - m := new(ReportSecretsResponse) - 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 SecretsScannerService_ReportSecretsClient = grpc.BidiStreamingClient[ReportSecretsRequest, ReportSecretsResponse] // SecretsScannerServiceServer is the server API for SecretsScannerService service. // All implementations must embed UnimplementedSecretsScannerServiceServer -// for forward compatibility +// for forward compatibility. // // SecretsScannerService provides methods for Access Graph Secret Scanner functionality. type SecretsScannerServiceServer interface { // ReportAuthorizedKeys is used by Teleport SSH nodes to report authorized keys // that could be used to bypass Teleport. // The client (Teleport SSH Node) should authenticate using the certificate-key pair signed by Teleport HostCA. - ReportAuthorizedKeys(SecretsScannerService_ReportAuthorizedKeysServer) error + ReportAuthorizedKeys(grpc.BidiStreamingServer[ReportAuthorizedKeysRequest, ReportAuthorizedKeysResponse]) error // ReportSecrets is used by trusted devices to report secrets found on the host that could be used to bypass Teleport. // The client (device) should first authenticate using the [ReportSecretsRequest.device_assertion] flow. Please refer to // the [teleport.devicetrust.v1.AssertDeviceRequest] and [teleport.devicetrust.v1.AssertDeviceResponse] messages for more details. @@ -158,21 +120,25 @@ type SecretsScannerServiceServer interface { // // Any failure in the assertion ceremony will result in the stream being terminated by the server. All secrets // reported by the client before the assertion terminates will be ignored and result in the stream being terminated. - ReportSecrets(SecretsScannerService_ReportSecretsServer) error + ReportSecrets(grpc.BidiStreamingServer[ReportSecretsRequest, ReportSecretsResponse]) error mustEmbedUnimplementedSecretsScannerServiceServer() } -// UnimplementedSecretsScannerServiceServer must be embedded to have forward compatible implementations. -type UnimplementedSecretsScannerServiceServer struct { -} +// UnimplementedSecretsScannerServiceServer 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 UnimplementedSecretsScannerServiceServer struct{} -func (UnimplementedSecretsScannerServiceServer) ReportAuthorizedKeys(SecretsScannerService_ReportAuthorizedKeysServer) error { +func (UnimplementedSecretsScannerServiceServer) ReportAuthorizedKeys(grpc.BidiStreamingServer[ReportAuthorizedKeysRequest, ReportAuthorizedKeysResponse]) error { return status.Errorf(codes.Unimplemented, "method ReportAuthorizedKeys not implemented") } -func (UnimplementedSecretsScannerServiceServer) ReportSecrets(SecretsScannerService_ReportSecretsServer) error { +func (UnimplementedSecretsScannerServiceServer) ReportSecrets(grpc.BidiStreamingServer[ReportSecretsRequest, ReportSecretsResponse]) error { return status.Errorf(codes.Unimplemented, "method ReportSecrets not implemented") } func (UnimplementedSecretsScannerServiceServer) mustEmbedUnimplementedSecretsScannerServiceServer() {} +func (UnimplementedSecretsScannerServiceServer) testEmbeddedByValue() {} // UnsafeSecretsScannerServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SecretsScannerServiceServer will @@ -182,60 +148,29 @@ type UnsafeSecretsScannerServiceServer interface { } func RegisterSecretsScannerServiceServer(s grpc.ServiceRegistrar, srv SecretsScannerServiceServer) { + // If the following call pancis, it indicates UnimplementedSecretsScannerServiceServer 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(&SecretsScannerService_ServiceDesc, srv) } func _SecretsScannerService_ReportAuthorizedKeys_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SecretsScannerServiceServer).ReportAuthorizedKeys(&secretsScannerServiceReportAuthorizedKeysServer{ServerStream: stream}) -} - -type SecretsScannerService_ReportAuthorizedKeysServer interface { - Send(*ReportAuthorizedKeysResponse) error - Recv() (*ReportAuthorizedKeysRequest, error) - grpc.ServerStream -} - -type secretsScannerServiceReportAuthorizedKeysServer struct { - grpc.ServerStream + return srv.(SecretsScannerServiceServer).ReportAuthorizedKeys(&grpc.GenericServerStream[ReportAuthorizedKeysRequest, ReportAuthorizedKeysResponse]{ServerStream: stream}) } -func (x *secretsScannerServiceReportAuthorizedKeysServer) Send(m *ReportAuthorizedKeysResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *secretsScannerServiceReportAuthorizedKeysServer) Recv() (*ReportAuthorizedKeysRequest, error) { - m := new(ReportAuthorizedKeysRequest) - 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 SecretsScannerService_ReportAuthorizedKeysServer = grpc.BidiStreamingServer[ReportAuthorizedKeysRequest, ReportAuthorizedKeysResponse] func _SecretsScannerService_ReportSecrets_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SecretsScannerServiceServer).ReportSecrets(&secretsScannerServiceReportSecretsServer{ServerStream: stream}) + return srv.(SecretsScannerServiceServer).ReportSecrets(&grpc.GenericServerStream[ReportSecretsRequest, ReportSecretsResponse]{ServerStream: stream}) } -type SecretsScannerService_ReportSecretsServer interface { - Send(*ReportSecretsResponse) error - Recv() (*ReportSecretsRequest, error) - grpc.ServerStream -} - -type secretsScannerServiceReportSecretsServer struct { - grpc.ServerStream -} - -func (x *secretsScannerServiceReportSecretsServer) Send(m *ReportSecretsResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *secretsScannerServiceReportSecretsServer) Recv() (*ReportSecretsRequest, error) { - m := new(ReportSecretsRequest) - 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 SecretsScannerService_ReportSecretsServer = grpc.BidiStreamingServer[ReportSecretsRequest, ReportSecretsResponse] // SecretsScannerService_ServiceDesc is the grpc.ServiceDesc for SecretsScannerService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/gen/proto/go/teleport/accesslist/v1/accesslist_service_grpc.pb.go b/api/gen/proto/go/teleport/accesslist/v1/accesslist_service_grpc.pb.go index 13c53d238ee29..ae47a9a39038c 100644 --- a/api/gen/proto/go/teleport/accesslist/v1/accesslist_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/accesslist/v1/accesslist_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/accesslist/v1/accesslist_service.proto @@ -30,8 +30,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 ( AccessListService_GetAccessLists_FullMethodName = "/teleport.accesslist.v1.AccessListService/GetAccessLists" @@ -377,7 +377,7 @@ func (c *accessListServiceClient) GetSuggestedAccessLists(ctx context.Context, i // AccessListServiceServer is the server API for AccessListService service. // All implementations must embed UnimplementedAccessListServiceServer -// for forward compatibility +// for forward compatibility. // // AccessListService provides CRUD methods for Access List resources. type AccessListServiceServer interface { @@ -443,9 +443,12 @@ type AccessListServiceServer interface { mustEmbedUnimplementedAccessListServiceServer() } -// UnimplementedAccessListServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAccessListServiceServer struct { -} +// UnimplementedAccessListServiceServer 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 UnimplementedAccessListServiceServer struct{} func (UnimplementedAccessListServiceServer) GetAccessLists(context.Context, *GetAccessListsRequest) (*GetAccessListsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAccessLists not implemented") @@ -520,6 +523,7 @@ func (UnimplementedAccessListServiceServer) GetSuggestedAccessLists(context.Cont return nil, status.Errorf(codes.Unimplemented, "method GetSuggestedAccessLists not implemented") } func (UnimplementedAccessListServiceServer) mustEmbedUnimplementedAccessListServiceServer() {} +func (UnimplementedAccessListServiceServer) testEmbeddedByValue() {} // UnsafeAccessListServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AccessListServiceServer will @@ -529,6 +533,13 @@ type UnsafeAccessListServiceServer interface { } func RegisterAccessListServiceServer(s grpc.ServiceRegistrar, srv AccessListServiceServer) { + // If the following call pancis, it indicates UnimplementedAccessListServiceServer 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(&AccessListService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/accessmonitoringrules/v1/access_monitoring_rules_service_grpc.pb.go b/api/gen/proto/go/teleport/accessmonitoringrules/v1/access_monitoring_rules_service_grpc.pb.go index 71c4bbcd01f27..d1e98293dacba 100644 --- a/api/gen/proto/go/teleport/accessmonitoringrules/v1/access_monitoring_rules_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/accessmonitoringrules/v1/access_monitoring_rules_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/accessmonitoringrules/v1/access_monitoring_rules_service.proto @@ -30,8 +30,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 ( AccessMonitoringRulesService_CreateAccessMonitoringRule_FullMethodName = "/teleport.accessmonitoringrules.v1.AccessMonitoringRulesService/CreateAccessMonitoringRule" @@ -145,7 +145,7 @@ func (c *accessMonitoringRulesServiceClient) ListAccessMonitoringRulesWithFilter // AccessMonitoringRulesServiceServer is the server API for AccessMonitoringRulesService service. // All implementations must embed UnimplementedAccessMonitoringRulesServiceServer -// for forward compatibility +// for forward compatibility. // // AccessMonitoringRulesService provides CRUD methods for Access Monitoring Rules resources. type AccessMonitoringRulesServiceServer interface { @@ -166,9 +166,12 @@ type AccessMonitoringRulesServiceServer interface { mustEmbedUnimplementedAccessMonitoringRulesServiceServer() } -// UnimplementedAccessMonitoringRulesServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAccessMonitoringRulesServiceServer struct { -} +// UnimplementedAccessMonitoringRulesServiceServer 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 UnimplementedAccessMonitoringRulesServiceServer struct{} func (UnimplementedAccessMonitoringRulesServiceServer) CreateAccessMonitoringRule(context.Context, *CreateAccessMonitoringRuleRequest) (*AccessMonitoringRule, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateAccessMonitoringRule not implemented") @@ -193,6 +196,7 @@ func (UnimplementedAccessMonitoringRulesServiceServer) ListAccessMonitoringRules } func (UnimplementedAccessMonitoringRulesServiceServer) mustEmbedUnimplementedAccessMonitoringRulesServiceServer() { } +func (UnimplementedAccessMonitoringRulesServiceServer) testEmbeddedByValue() {} // UnsafeAccessMonitoringRulesServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AccessMonitoringRulesServiceServer will @@ -202,6 +206,13 @@ type UnsafeAccessMonitoringRulesServiceServer interface { } func RegisterAccessMonitoringRulesServiceServer(s grpc.ServiceRegistrar, srv AccessMonitoringRulesServiceServer) { + // If the following call pancis, it indicates UnimplementedAccessMonitoringRulesServiceServer 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(&AccessMonitoringRulesService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/auditlog/v1/auditlog_grpc.pb.go b/api/gen/proto/go/teleport/auditlog/v1/auditlog_grpc.pb.go index e72abf53a92c6..f8a7779af753a 100644 --- a/api/gen/proto/go/teleport/auditlog/v1/auditlog_grpc.pb.go +++ b/api/gen/proto/go/teleport/auditlog/v1/auditlog_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/auditlog/v1/auditlog.proto @@ -29,8 +29,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 ( AuditLogService_StreamUnstructuredSessionEvents_FullMethodName = "/teleport.auditlog.v1.AuditLogService/StreamUnstructuredSessionEvents" @@ -45,7 +45,7 @@ const ( type AuditLogServiceClient interface { // StreamUnstructuredSessionEvents streams audit events from a given session recording in an unstructured format. // This endpoint is used by the event handler to retrieve the session events as JSON. - StreamUnstructuredSessionEvents(ctx context.Context, in *StreamUnstructuredSessionEventsRequest, opts ...grpc.CallOption) (AuditLogService_StreamUnstructuredSessionEventsClient, error) + StreamUnstructuredSessionEvents(ctx context.Context, in *StreamUnstructuredSessionEventsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[EventUnstructured], error) // GetUnstructuredEvents gets events from the audit log in an unstructured format. // This endpoint is used by the event handler to retrieve the events as JSON. GetUnstructuredEvents(ctx context.Context, in *GetUnstructuredEventsRequest, opts ...grpc.CallOption) (*EventsUnstructured, error) @@ -59,13 +59,13 @@ func NewAuditLogServiceClient(cc grpc.ClientConnInterface) AuditLogServiceClient return &auditLogServiceClient{cc} } -func (c *auditLogServiceClient) StreamUnstructuredSessionEvents(ctx context.Context, in *StreamUnstructuredSessionEventsRequest, opts ...grpc.CallOption) (AuditLogService_StreamUnstructuredSessionEventsClient, error) { +func (c *auditLogServiceClient) StreamUnstructuredSessionEvents(ctx context.Context, in *StreamUnstructuredSessionEventsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[EventUnstructured], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &AuditLogService_ServiceDesc.Streams[0], AuditLogService_StreamUnstructuredSessionEvents_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &auditLogServiceStreamUnstructuredSessionEventsClient{ClientStream: stream} + x := &grpc.GenericClientStream[StreamUnstructuredSessionEventsRequest, EventUnstructured]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -75,22 +75,8 @@ func (c *auditLogServiceClient) StreamUnstructuredSessionEvents(ctx context.Cont return x, nil } -type AuditLogService_StreamUnstructuredSessionEventsClient interface { - Recv() (*EventUnstructured, error) - grpc.ClientStream -} - -type auditLogServiceStreamUnstructuredSessionEventsClient struct { - grpc.ClientStream -} - -func (x *auditLogServiceStreamUnstructuredSessionEventsClient) Recv() (*EventUnstructured, error) { - m := new(EventUnstructured) - 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 AuditLogService_StreamUnstructuredSessionEventsClient = grpc.ServerStreamingClient[EventUnstructured] func (c *auditLogServiceClient) GetUnstructuredEvents(ctx context.Context, in *GetUnstructuredEventsRequest, opts ...grpc.CallOption) (*EventsUnstructured, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -104,30 +90,34 @@ func (c *auditLogServiceClient) GetUnstructuredEvents(ctx context.Context, in *G // AuditLogServiceServer is the server API for AuditLogService service. // All implementations must embed UnimplementedAuditLogServiceServer -// for forward compatibility +// for forward compatibility. // // AuditLogService provides methods to access audit log. type AuditLogServiceServer interface { // StreamUnstructuredSessionEvents streams audit events from a given session recording in an unstructured format. // This endpoint is used by the event handler to retrieve the session events as JSON. - StreamUnstructuredSessionEvents(*StreamUnstructuredSessionEventsRequest, AuditLogService_StreamUnstructuredSessionEventsServer) error + StreamUnstructuredSessionEvents(*StreamUnstructuredSessionEventsRequest, grpc.ServerStreamingServer[EventUnstructured]) error // GetUnstructuredEvents gets events from the audit log in an unstructured format. // This endpoint is used by the event handler to retrieve the events as JSON. GetUnstructuredEvents(context.Context, *GetUnstructuredEventsRequest) (*EventsUnstructured, error) mustEmbedUnimplementedAuditLogServiceServer() } -// UnimplementedAuditLogServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAuditLogServiceServer struct { -} +// UnimplementedAuditLogServiceServer 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 UnimplementedAuditLogServiceServer struct{} -func (UnimplementedAuditLogServiceServer) StreamUnstructuredSessionEvents(*StreamUnstructuredSessionEventsRequest, AuditLogService_StreamUnstructuredSessionEventsServer) error { +func (UnimplementedAuditLogServiceServer) StreamUnstructuredSessionEvents(*StreamUnstructuredSessionEventsRequest, grpc.ServerStreamingServer[EventUnstructured]) error { return status.Errorf(codes.Unimplemented, "method StreamUnstructuredSessionEvents not implemented") } func (UnimplementedAuditLogServiceServer) GetUnstructuredEvents(context.Context, *GetUnstructuredEventsRequest) (*EventsUnstructured, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUnstructuredEvents not implemented") } func (UnimplementedAuditLogServiceServer) mustEmbedUnimplementedAuditLogServiceServer() {} +func (UnimplementedAuditLogServiceServer) testEmbeddedByValue() {} // UnsafeAuditLogServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AuditLogServiceServer will @@ -137,6 +127,13 @@ type UnsafeAuditLogServiceServer interface { } func RegisterAuditLogServiceServer(s grpc.ServiceRegistrar, srv AuditLogServiceServer) { + // If the following call pancis, it indicates UnimplementedAuditLogServiceServer 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(&AuditLogService_ServiceDesc, srv) } @@ -145,21 +142,11 @@ func _AuditLogService_StreamUnstructuredSessionEvents_Handler(srv interface{}, s if err := stream.RecvMsg(m); err != nil { return err } - return srv.(AuditLogServiceServer).StreamUnstructuredSessionEvents(m, &auditLogServiceStreamUnstructuredSessionEventsServer{ServerStream: stream}) -} - -type AuditLogService_StreamUnstructuredSessionEventsServer interface { - Send(*EventUnstructured) error - grpc.ServerStream + return srv.(AuditLogServiceServer).StreamUnstructuredSessionEvents(m, &grpc.GenericServerStream[StreamUnstructuredSessionEventsRequest, EventUnstructured]{ServerStream: stream}) } -type auditLogServiceStreamUnstructuredSessionEventsServer struct { - grpc.ServerStream -} - -func (x *auditLogServiceStreamUnstructuredSessionEventsServer) Send(m *EventUnstructured) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AuditLogService_StreamUnstructuredSessionEventsServer = grpc.ServerStreamingServer[EventUnstructured] func _AuditLogService_GetUnstructuredEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetUnstructuredEventsRequest) diff --git a/api/gen/proto/go/teleport/clusterconfig/v1/clusterconfig_service_grpc.pb.go b/api/gen/proto/go/teleport/clusterconfig/v1/clusterconfig_service_grpc.pb.go index 905e77dac9543..e0863476c8118 100644 --- a/api/gen/proto/go/teleport/clusterconfig/v1/clusterconfig_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/clusterconfig/v1/clusterconfig_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/clusterconfig/v1/clusterconfig_service.proto @@ -30,8 +30,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 ( ClusterConfigService_GetClusterNetworkingConfig_FullMethodName = "/teleport.clusterconfig.v1.ClusterConfigService/GetClusterNetworkingConfig" @@ -301,7 +301,7 @@ func (c *clusterConfigServiceClient) ResetAccessGraphSettings(ctx context.Contex // ClusterConfigServiceServer is the server API for ClusterConfigService service. // All implementations must embed UnimplementedClusterConfigServiceServer -// for forward compatibility +// for forward compatibility. // // ClusterConfigService provides methods to manage cluster configuration resources. type ClusterConfigServiceServer interface { @@ -346,9 +346,12 @@ type ClusterConfigServiceServer interface { mustEmbedUnimplementedClusterConfigServiceServer() } -// UnimplementedClusterConfigServiceServer must be embedded to have forward compatible implementations. -type UnimplementedClusterConfigServiceServer struct { -} +// UnimplementedClusterConfigServiceServer 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 UnimplementedClusterConfigServiceServer struct{} func (UnimplementedClusterConfigServiceServer) GetClusterNetworkingConfig(context.Context, *GetClusterNetworkingConfigRequest) (*types.ClusterNetworkingConfigV2, error) { return nil, status.Errorf(codes.Unimplemented, "method GetClusterNetworkingConfig not implemented") @@ -408,6 +411,7 @@ func (UnimplementedClusterConfigServiceServer) ResetAccessGraphSettings(context. return nil, status.Errorf(codes.Unimplemented, "method ResetAccessGraphSettings not implemented") } func (UnimplementedClusterConfigServiceServer) mustEmbedUnimplementedClusterConfigServiceServer() {} +func (UnimplementedClusterConfigServiceServer) testEmbeddedByValue() {} // UnsafeClusterConfigServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ClusterConfigServiceServer will @@ -417,6 +421,13 @@ type UnsafeClusterConfigServiceServer interface { } func RegisterClusterConfigServiceServer(s grpc.ServiceRegistrar, srv ClusterConfigServiceServer) { + // If the following call pancis, it indicates UnimplementedClusterConfigServiceServer 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(&ClusterConfigService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/crownjewel/v1/crownjewel_service_grpc.pb.go b/api/gen/proto/go/teleport/crownjewel/v1/crownjewel_service_grpc.pb.go index 5098686592a34..653a5bf5e4295 100644 --- a/api/gen/proto/go/teleport/crownjewel/v1/crownjewel_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/crownjewel/v1/crownjewel_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/crownjewel/v1/crownjewel_service.proto @@ -30,8 +30,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 ( CrownJewelService_CreateCrownJewel_FullMethodName = "/teleport.crownjewel.v1.CrownJewelService/CreateCrownJewel" @@ -132,7 +132,7 @@ func (c *crownJewelServiceClient) DeleteCrownJewel(ctx context.Context, in *Dele // CrownJewelServiceServer is the server API for CrownJewelService service. // All implementations must embed UnimplementedCrownJewelServiceServer -// for forward compatibility +// for forward compatibility. // // CrownJewelService is a service that provides methods to manage CrownJewels. type CrownJewelServiceServer interface { @@ -151,9 +151,12 @@ type CrownJewelServiceServer interface { mustEmbedUnimplementedCrownJewelServiceServer() } -// UnimplementedCrownJewelServiceServer must be embedded to have forward compatible implementations. -type UnimplementedCrownJewelServiceServer struct { -} +// UnimplementedCrownJewelServiceServer 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 UnimplementedCrownJewelServiceServer struct{} func (UnimplementedCrownJewelServiceServer) CreateCrownJewel(context.Context, *CreateCrownJewelRequest) (*CrownJewel, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateCrownJewel not implemented") @@ -174,6 +177,7 @@ func (UnimplementedCrownJewelServiceServer) DeleteCrownJewel(context.Context, *D return nil, status.Errorf(codes.Unimplemented, "method DeleteCrownJewel not implemented") } func (UnimplementedCrownJewelServiceServer) mustEmbedUnimplementedCrownJewelServiceServer() {} +func (UnimplementedCrownJewelServiceServer) testEmbeddedByValue() {} // UnsafeCrownJewelServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to CrownJewelServiceServer will @@ -183,6 +187,13 @@ type UnsafeCrownJewelServiceServer interface { } func RegisterCrownJewelServiceServer(s grpc.ServiceRegistrar, srv CrownJewelServiceServer) { + // If the following call pancis, it indicates UnimplementedCrownJewelServiceServer 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(&CrownJewelService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/dbobject/v1/dbobject_service_grpc.pb.go b/api/gen/proto/go/teleport/dbobject/v1/dbobject_service_grpc.pb.go index 9b87181d0a7e9..05c0e34682bef 100644 --- a/api/gen/proto/go/teleport/dbobject/v1/dbobject_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/dbobject/v1/dbobject_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/dbobject/v1/dbobject_service.proto @@ -30,8 +30,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 ( DatabaseObjectService_GetDatabaseObject_FullMethodName = "/teleport.dbobject.v1.DatabaseObjectService/GetDatabaseObject" @@ -143,7 +143,7 @@ func (c *databaseObjectServiceClient) DeleteDatabaseObject(ctx context.Context, // DatabaseObjectServiceServer is the server API for DatabaseObjectService service. // All implementations must embed UnimplementedDatabaseObjectServiceServer -// for forward compatibility +// for forward compatibility. // // DatabaseObjectService provides methods to manage Teleport DatabaseObjects type DatabaseObjectServiceServer interface { @@ -173,9 +173,12 @@ type DatabaseObjectServiceServer interface { mustEmbedUnimplementedDatabaseObjectServiceServer() } -// UnimplementedDatabaseObjectServiceServer must be embedded to have forward compatible implementations. -type UnimplementedDatabaseObjectServiceServer struct { -} +// UnimplementedDatabaseObjectServiceServer 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 UnimplementedDatabaseObjectServiceServer struct{} func (UnimplementedDatabaseObjectServiceServer) GetDatabaseObject(context.Context, *GetDatabaseObjectRequest) (*DatabaseObject, error) { return nil, status.Errorf(codes.Unimplemented, "method GetDatabaseObject not implemented") @@ -196,6 +199,7 @@ func (UnimplementedDatabaseObjectServiceServer) DeleteDatabaseObject(context.Con return nil, status.Errorf(codes.Unimplemented, "method DeleteDatabaseObject not implemented") } func (UnimplementedDatabaseObjectServiceServer) mustEmbedUnimplementedDatabaseObjectServiceServer() {} +func (UnimplementedDatabaseObjectServiceServer) testEmbeddedByValue() {} // UnsafeDatabaseObjectServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DatabaseObjectServiceServer will @@ -205,6 +209,13 @@ type UnsafeDatabaseObjectServiceServer interface { } func RegisterDatabaseObjectServiceServer(s grpc.ServiceRegistrar, srv DatabaseObjectServiceServer) { + // If the following call pancis, it indicates UnimplementedDatabaseObjectServiceServer 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(&DatabaseObjectService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/dbobjectimportrule/v1/dbobjectimportrule_service_grpc.pb.go b/api/gen/proto/go/teleport/dbobjectimportrule/v1/dbobjectimportrule_service_grpc.pb.go index f92f31efe1ff6..33a30ef154567 100644 --- a/api/gen/proto/go/teleport/dbobjectimportrule/v1/dbobjectimportrule_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/dbobjectimportrule/v1/dbobjectimportrule_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/dbobjectimportrule/v1/dbobjectimportrule_service.proto @@ -30,8 +30,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 ( DatabaseObjectImportRuleService_GetDatabaseObjectImportRule_FullMethodName = "/teleport.dbobjectimportrule.v1.DatabaseObjectImportRuleService/GetDatabaseObjectImportRule" @@ -143,7 +143,7 @@ func (c *databaseObjectImportRuleServiceClient) DeleteDatabaseObjectImportRule(c // DatabaseObjectImportRuleServiceServer is the server API for DatabaseObjectImportRuleService service. // All implementations must embed UnimplementedDatabaseObjectImportRuleServiceServer -// for forward compatibility +// for forward compatibility. // // DatabaseObjectImportRuleService provides methods to manage Teleport DatabaseObjectImportRules type DatabaseObjectImportRuleServiceServer interface { @@ -173,9 +173,12 @@ type DatabaseObjectImportRuleServiceServer interface { mustEmbedUnimplementedDatabaseObjectImportRuleServiceServer() } -// UnimplementedDatabaseObjectImportRuleServiceServer must be embedded to have forward compatible implementations. -type UnimplementedDatabaseObjectImportRuleServiceServer struct { -} +// UnimplementedDatabaseObjectImportRuleServiceServer 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 UnimplementedDatabaseObjectImportRuleServiceServer struct{} func (UnimplementedDatabaseObjectImportRuleServiceServer) GetDatabaseObjectImportRule(context.Context, *GetDatabaseObjectImportRuleRequest) (*DatabaseObjectImportRule, error) { return nil, status.Errorf(codes.Unimplemented, "method GetDatabaseObjectImportRule not implemented") @@ -197,6 +200,7 @@ func (UnimplementedDatabaseObjectImportRuleServiceServer) DeleteDatabaseObjectIm } func (UnimplementedDatabaseObjectImportRuleServiceServer) mustEmbedUnimplementedDatabaseObjectImportRuleServiceServer() { } +func (UnimplementedDatabaseObjectImportRuleServiceServer) testEmbeddedByValue() {} // UnsafeDatabaseObjectImportRuleServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DatabaseObjectImportRuleServiceServer will @@ -206,6 +210,13 @@ type UnsafeDatabaseObjectImportRuleServiceServer interface { } func RegisterDatabaseObjectImportRuleServiceServer(s grpc.ServiceRegistrar, srv DatabaseObjectImportRuleServiceServer) { + // If the following call pancis, it indicates UnimplementedDatabaseObjectImportRuleServiceServer 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(&DatabaseObjectImportRuleService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/devicetrust/v1/devicetrust_service_grpc.pb.go b/api/gen/proto/go/teleport/devicetrust/v1/devicetrust_service_grpc.pb.go index 86be79eb248cf..efe987efc84da 100644 --- a/api/gen/proto/go/teleport/devicetrust/v1/devicetrust_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/devicetrust/v1/devicetrust_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/devicetrust/v1/devicetrust_service.proto @@ -30,8 +30,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 ( DeviceTrustService_CreateDevice_FullMethodName = "/teleport.devicetrust.v1.DeviceTrustService/CreateDevice" @@ -141,7 +141,7 @@ type DeviceTrustServiceClient interface { // <- TPMEnrollChallenge (server) // -> TPMEnrollChallengeResponse // <- EnrollDeviceSuccess - EnrollDevice(ctx context.Context, opts ...grpc.CallOption) (DeviceTrustService_EnrollDeviceClient, error) + EnrollDevice(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[EnrollDeviceRequest, EnrollDeviceResponse], error) // AuthenticateDevice performs the device authentication ceremony. // // Device authentication exchanges existing user certificates without device @@ -149,7 +149,7 @@ type DeviceTrustServiceClient interface { // certificates allow the user to perform device-aware actions. // // Only registered and enrolled devices may perform device authentication. - AuthenticateDevice(ctx context.Context, opts ...grpc.CallOption) (DeviceTrustService_AuthenticateDeviceClient, error) + AuthenticateDevice(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AuthenticateDeviceRequest, AuthenticateDeviceResponse], error) // ConfirmDeviceWebAuthentication finalizes the device web authentication // ceremony started by the creation of a DeviceWebToken and subsequent // AuthenticateDevice call. @@ -171,7 +171,7 @@ type DeviceTrustServiceClient interface { // the external inventory are handled as specified. // Authorized either by a valid MDM service certificate or the appropriate // "device" permissions (create/update/delete). - SyncInventory(ctx context.Context, opts ...grpc.CallOption) (DeviceTrustService_SyncInventoryClient, error) + SyncInventory(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SyncInventoryRequest, SyncInventoryResponse], error) // Deprecated: Do not use. // Superseded by ResourceUsageService.GetUsage. GetDevicesUsage(ctx context.Context, in *GetDevicesUsageRequest, opts ...grpc.CallOption) (*DevicesUsage, error) @@ -275,69 +275,31 @@ func (c *deviceTrustServiceClient) CreateDeviceEnrollToken(ctx context.Context, return out, nil } -func (c *deviceTrustServiceClient) EnrollDevice(ctx context.Context, opts ...grpc.CallOption) (DeviceTrustService_EnrollDeviceClient, error) { +func (c *deviceTrustServiceClient) EnrollDevice(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[EnrollDeviceRequest, EnrollDeviceResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &DeviceTrustService_ServiceDesc.Streams[0], DeviceTrustService_EnrollDevice_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &deviceTrustServiceEnrollDeviceClient{ClientStream: stream} + x := &grpc.GenericClientStream[EnrollDeviceRequest, EnrollDeviceResponse]{ClientStream: stream} return x, nil } -type DeviceTrustService_EnrollDeviceClient interface { - Send(*EnrollDeviceRequest) error - Recv() (*EnrollDeviceResponse, error) - grpc.ClientStream -} - -type deviceTrustServiceEnrollDeviceClient struct { - grpc.ClientStream -} - -func (x *deviceTrustServiceEnrollDeviceClient) Send(m *EnrollDeviceRequest) error { - return x.ClientStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type DeviceTrustService_EnrollDeviceClient = grpc.BidiStreamingClient[EnrollDeviceRequest, EnrollDeviceResponse] -func (x *deviceTrustServiceEnrollDeviceClient) Recv() (*EnrollDeviceResponse, error) { - m := new(EnrollDeviceResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *deviceTrustServiceClient) AuthenticateDevice(ctx context.Context, opts ...grpc.CallOption) (DeviceTrustService_AuthenticateDeviceClient, error) { +func (c *deviceTrustServiceClient) AuthenticateDevice(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AuthenticateDeviceRequest, AuthenticateDeviceResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &DeviceTrustService_ServiceDesc.Streams[1], DeviceTrustService_AuthenticateDevice_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &deviceTrustServiceAuthenticateDeviceClient{ClientStream: stream} + x := &grpc.GenericClientStream[AuthenticateDeviceRequest, AuthenticateDeviceResponse]{ClientStream: stream} return x, nil } -type DeviceTrustService_AuthenticateDeviceClient interface { - Send(*AuthenticateDeviceRequest) error - Recv() (*AuthenticateDeviceResponse, error) - grpc.ClientStream -} - -type deviceTrustServiceAuthenticateDeviceClient struct { - grpc.ClientStream -} - -func (x *deviceTrustServiceAuthenticateDeviceClient) Send(m *AuthenticateDeviceRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *deviceTrustServiceAuthenticateDeviceClient) Recv() (*AuthenticateDeviceResponse, error) { - m := new(AuthenticateDeviceResponse) - 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 DeviceTrustService_AuthenticateDeviceClient = grpc.BidiStreamingClient[AuthenticateDeviceRequest, AuthenticateDeviceResponse] func (c *deviceTrustServiceClient) ConfirmDeviceWebAuthentication(ctx context.Context, in *ConfirmDeviceWebAuthenticationRequest, opts ...grpc.CallOption) (*ConfirmDeviceWebAuthenticationResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -349,37 +311,18 @@ func (c *deviceTrustServiceClient) ConfirmDeviceWebAuthentication(ctx context.Co return out, nil } -func (c *deviceTrustServiceClient) SyncInventory(ctx context.Context, opts ...grpc.CallOption) (DeviceTrustService_SyncInventoryClient, error) { +func (c *deviceTrustServiceClient) SyncInventory(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SyncInventoryRequest, SyncInventoryResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &DeviceTrustService_ServiceDesc.Streams[2], DeviceTrustService_SyncInventory_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &deviceTrustServiceSyncInventoryClient{ClientStream: stream} + x := &grpc.GenericClientStream[SyncInventoryRequest, SyncInventoryResponse]{ClientStream: stream} return x, nil } -type DeviceTrustService_SyncInventoryClient interface { - Send(*SyncInventoryRequest) error - Recv() (*SyncInventoryResponse, error) - grpc.ClientStream -} - -type deviceTrustServiceSyncInventoryClient struct { - grpc.ClientStream -} - -func (x *deviceTrustServiceSyncInventoryClient) Send(m *SyncInventoryRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *deviceTrustServiceSyncInventoryClient) Recv() (*SyncInventoryResponse, error) { - m := new(SyncInventoryResponse) - 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 DeviceTrustService_SyncInventoryClient = grpc.BidiStreamingClient[SyncInventoryRequest, SyncInventoryResponse] // Deprecated: Do not use. func (c *deviceTrustServiceClient) GetDevicesUsage(ctx context.Context, in *GetDevicesUsageRequest, opts ...grpc.CallOption) (*DevicesUsage, error) { @@ -394,7 +337,7 @@ func (c *deviceTrustServiceClient) GetDevicesUsage(ctx context.Context, in *GetD // DeviceTrustServiceServer is the server API for DeviceTrustService service. // All implementations must embed UnimplementedDeviceTrustServiceServer -// for forward compatibility +// for forward compatibility. // // DeviceTrustService provides methods to manage, enroll and authenticate // trusted devices. @@ -483,7 +426,7 @@ type DeviceTrustServiceServer interface { // <- TPMEnrollChallenge (server) // -> TPMEnrollChallengeResponse // <- EnrollDeviceSuccess - EnrollDevice(DeviceTrustService_EnrollDeviceServer) error + EnrollDevice(grpc.BidiStreamingServer[EnrollDeviceRequest, EnrollDeviceResponse]) error // AuthenticateDevice performs the device authentication ceremony. // // Device authentication exchanges existing user certificates without device @@ -491,7 +434,7 @@ type DeviceTrustServiceServer interface { // certificates allow the user to perform device-aware actions. // // Only registered and enrolled devices may perform device authentication. - AuthenticateDevice(DeviceTrustService_AuthenticateDeviceServer) error + AuthenticateDevice(grpc.BidiStreamingServer[AuthenticateDeviceRequest, AuthenticateDeviceResponse]) error // ConfirmDeviceWebAuthentication finalizes the device web authentication // ceremony started by the creation of a DeviceWebToken and subsequent // AuthenticateDevice call. @@ -513,16 +456,19 @@ type DeviceTrustServiceServer interface { // the external inventory are handled as specified. // Authorized either by a valid MDM service certificate or the appropriate // "device" permissions (create/update/delete). - SyncInventory(DeviceTrustService_SyncInventoryServer) error + SyncInventory(grpc.BidiStreamingServer[SyncInventoryRequest, SyncInventoryResponse]) error // Deprecated: Do not use. // Superseded by ResourceUsageService.GetUsage. GetDevicesUsage(context.Context, *GetDevicesUsageRequest) (*DevicesUsage, error) mustEmbedUnimplementedDeviceTrustServiceServer() } -// UnimplementedDeviceTrustServiceServer must be embedded to have forward compatible implementations. -type UnimplementedDeviceTrustServiceServer struct { -} +// UnimplementedDeviceTrustServiceServer 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 UnimplementedDeviceTrustServiceServer struct{} func (UnimplementedDeviceTrustServiceServer) CreateDevice(context.Context, *CreateDeviceRequest) (*Device, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateDevice not implemented") @@ -551,22 +497,23 @@ func (UnimplementedDeviceTrustServiceServer) BulkCreateDevices(context.Context, func (UnimplementedDeviceTrustServiceServer) CreateDeviceEnrollToken(context.Context, *CreateDeviceEnrollTokenRequest) (*DeviceEnrollToken, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateDeviceEnrollToken not implemented") } -func (UnimplementedDeviceTrustServiceServer) EnrollDevice(DeviceTrustService_EnrollDeviceServer) error { +func (UnimplementedDeviceTrustServiceServer) EnrollDevice(grpc.BidiStreamingServer[EnrollDeviceRequest, EnrollDeviceResponse]) error { return status.Errorf(codes.Unimplemented, "method EnrollDevice not implemented") } -func (UnimplementedDeviceTrustServiceServer) AuthenticateDevice(DeviceTrustService_AuthenticateDeviceServer) error { +func (UnimplementedDeviceTrustServiceServer) AuthenticateDevice(grpc.BidiStreamingServer[AuthenticateDeviceRequest, AuthenticateDeviceResponse]) error { return status.Errorf(codes.Unimplemented, "method AuthenticateDevice not implemented") } func (UnimplementedDeviceTrustServiceServer) ConfirmDeviceWebAuthentication(context.Context, *ConfirmDeviceWebAuthenticationRequest) (*ConfirmDeviceWebAuthenticationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ConfirmDeviceWebAuthentication not implemented") } -func (UnimplementedDeviceTrustServiceServer) SyncInventory(DeviceTrustService_SyncInventoryServer) error { +func (UnimplementedDeviceTrustServiceServer) SyncInventory(grpc.BidiStreamingServer[SyncInventoryRequest, SyncInventoryResponse]) error { return status.Errorf(codes.Unimplemented, "method SyncInventory not implemented") } func (UnimplementedDeviceTrustServiceServer) GetDevicesUsage(context.Context, *GetDevicesUsageRequest) (*DevicesUsage, error) { return nil, status.Errorf(codes.Unimplemented, "method GetDevicesUsage not implemented") } func (UnimplementedDeviceTrustServiceServer) mustEmbedUnimplementedDeviceTrustServiceServer() {} +func (UnimplementedDeviceTrustServiceServer) testEmbeddedByValue() {} // UnsafeDeviceTrustServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DeviceTrustServiceServer will @@ -576,6 +523,13 @@ type UnsafeDeviceTrustServiceServer interface { } func RegisterDeviceTrustServiceServer(s grpc.ServiceRegistrar, srv DeviceTrustServiceServer) { + // If the following call pancis, it indicates UnimplementedDeviceTrustServiceServer 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(&DeviceTrustService_ServiceDesc, srv) } @@ -742,56 +696,18 @@ func _DeviceTrustService_CreateDeviceEnrollToken_Handler(srv interface{}, ctx co } func _DeviceTrustService_EnrollDevice_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DeviceTrustServiceServer).EnrollDevice(&deviceTrustServiceEnrollDeviceServer{ServerStream: stream}) -} - -type DeviceTrustService_EnrollDeviceServer interface { - Send(*EnrollDeviceResponse) error - Recv() (*EnrollDeviceRequest, error) - grpc.ServerStream -} - -type deviceTrustServiceEnrollDeviceServer struct { - grpc.ServerStream -} - -func (x *deviceTrustServiceEnrollDeviceServer) Send(m *EnrollDeviceResponse) error { - return x.ServerStream.SendMsg(m) + return srv.(DeviceTrustServiceServer).EnrollDevice(&grpc.GenericServerStream[EnrollDeviceRequest, EnrollDeviceResponse]{ServerStream: stream}) } -func (x *deviceTrustServiceEnrollDeviceServer) Recv() (*EnrollDeviceRequest, error) { - m := new(EnrollDeviceRequest) - 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 DeviceTrustService_EnrollDeviceServer = grpc.BidiStreamingServer[EnrollDeviceRequest, EnrollDeviceResponse] func _DeviceTrustService_AuthenticateDevice_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DeviceTrustServiceServer).AuthenticateDevice(&deviceTrustServiceAuthenticateDeviceServer{ServerStream: stream}) -} - -type DeviceTrustService_AuthenticateDeviceServer interface { - Send(*AuthenticateDeviceResponse) error - Recv() (*AuthenticateDeviceRequest, error) - grpc.ServerStream -} - -type deviceTrustServiceAuthenticateDeviceServer struct { - grpc.ServerStream + return srv.(DeviceTrustServiceServer).AuthenticateDevice(&grpc.GenericServerStream[AuthenticateDeviceRequest, AuthenticateDeviceResponse]{ServerStream: stream}) } -func (x *deviceTrustServiceAuthenticateDeviceServer) Send(m *AuthenticateDeviceResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *deviceTrustServiceAuthenticateDeviceServer) Recv() (*AuthenticateDeviceRequest, error) { - m := new(AuthenticateDeviceRequest) - 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 DeviceTrustService_AuthenticateDeviceServer = grpc.BidiStreamingServer[AuthenticateDeviceRequest, AuthenticateDeviceResponse] func _DeviceTrustService_ConfirmDeviceWebAuthentication_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ConfirmDeviceWebAuthenticationRequest) @@ -812,30 +728,11 @@ func _DeviceTrustService_ConfirmDeviceWebAuthentication_Handler(srv interface{}, } func _DeviceTrustService_SyncInventory_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DeviceTrustServiceServer).SyncInventory(&deviceTrustServiceSyncInventoryServer{ServerStream: stream}) -} - -type DeviceTrustService_SyncInventoryServer interface { - Send(*SyncInventoryResponse) error - Recv() (*SyncInventoryRequest, error) - grpc.ServerStream + return srv.(DeviceTrustServiceServer).SyncInventory(&grpc.GenericServerStream[SyncInventoryRequest, SyncInventoryResponse]{ServerStream: stream}) } -type deviceTrustServiceSyncInventoryServer struct { - grpc.ServerStream -} - -func (x *deviceTrustServiceSyncInventoryServer) Send(m *SyncInventoryResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *deviceTrustServiceSyncInventoryServer) Recv() (*SyncInventoryRequest, error) { - m := new(SyncInventoryRequest) - 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 DeviceTrustService_SyncInventoryServer = grpc.BidiStreamingServer[SyncInventoryRequest, SyncInventoryResponse] func _DeviceTrustService_GetDevicesUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetDevicesUsageRequest) diff --git a/api/gen/proto/go/teleport/discoveryconfig/v1/discoveryconfig_service_grpc.pb.go b/api/gen/proto/go/teleport/discoveryconfig/v1/discoveryconfig_service_grpc.pb.go index 931e454d0d742..aec7605c5ed80 100644 --- a/api/gen/proto/go/teleport/discoveryconfig/v1/discoveryconfig_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/discoveryconfig/v1/discoveryconfig_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/discoveryconfig/v1/discoveryconfig_service.proto @@ -30,8 +30,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 ( DiscoveryConfigService_ListDiscoveryConfigs_FullMethodName = "/teleport.discoveryconfig.v1.DiscoveryConfigService/ListDiscoveryConfigs" @@ -162,7 +162,7 @@ func (c *discoveryConfigServiceClient) UpdateDiscoveryConfigStatus(ctx context.C // DiscoveryConfigServiceServer is the server API for DiscoveryConfigService service. // All implementations must embed UnimplementedDiscoveryConfigServiceServer -// for forward compatibility +// for forward compatibility. // // DiscoveryConfigService provides methods to manage Discovery Configs. // @@ -189,9 +189,12 @@ type DiscoveryConfigServiceServer interface { mustEmbedUnimplementedDiscoveryConfigServiceServer() } -// UnimplementedDiscoveryConfigServiceServer must be embedded to have forward compatible implementations. -type UnimplementedDiscoveryConfigServiceServer struct { -} +// UnimplementedDiscoveryConfigServiceServer 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 UnimplementedDiscoveryConfigServiceServer struct{} func (UnimplementedDiscoveryConfigServiceServer) ListDiscoveryConfigs(context.Context, *ListDiscoveryConfigsRequest) (*ListDiscoveryConfigsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListDiscoveryConfigs not implemented") @@ -219,6 +222,7 @@ func (UnimplementedDiscoveryConfigServiceServer) UpdateDiscoveryConfigStatus(con } func (UnimplementedDiscoveryConfigServiceServer) mustEmbedUnimplementedDiscoveryConfigServiceServer() { } +func (UnimplementedDiscoveryConfigServiceServer) testEmbeddedByValue() {} // UnsafeDiscoveryConfigServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DiscoveryConfigServiceServer will @@ -228,6 +232,13 @@ type UnsafeDiscoveryConfigServiceServer interface { } func RegisterDiscoveryConfigServiceServer(s grpc.ServiceRegistrar, srv DiscoveryConfigServiceServer) { + // If the following call pancis, it indicates UnimplementedDiscoveryConfigServiceServer 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(&DiscoveryConfigService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/externalauditstorage/v1/externalauditstorage_service_grpc.pb.go b/api/gen/proto/go/teleport/externalauditstorage/v1/externalauditstorage_service_grpc.pb.go index 4daf16e04b176..ae7b61b886d61 100644 --- a/api/gen/proto/go/teleport/externalauditstorage/v1/externalauditstorage_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/externalauditstorage/v1/externalauditstorage_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/externalauditstorage/v1/externalauditstorage_service.proto @@ -30,8 +30,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 ( ExternalAuditStorageService_GetDraftExternalAuditStorage_FullMethodName = "/teleport.externalauditstorage.v1.ExternalAuditStorageService/GetDraftExternalAuditStorage" @@ -214,7 +214,7 @@ func (c *externalAuditStorageServiceClient) TestDraftExternalAuditStorageAthena( // ExternalAuditStorageServiceServer is the server API for ExternalAuditStorageService service. // All implementations must embed UnimplementedExternalAuditStorageServiceServer -// for forward compatibility +// for forward compatibility. // // ExternalAuditStorageService provides methods to manage External Audit Storage. // @@ -260,9 +260,12 @@ type ExternalAuditStorageServiceServer interface { mustEmbedUnimplementedExternalAuditStorageServiceServer() } -// UnimplementedExternalAuditStorageServiceServer must be embedded to have forward compatible implementations. -type UnimplementedExternalAuditStorageServiceServer struct { -} +// UnimplementedExternalAuditStorageServiceServer 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 UnimplementedExternalAuditStorageServiceServer struct{} func (UnimplementedExternalAuditStorageServiceServer) GetDraftExternalAuditStorage(context.Context, *GetDraftExternalAuditStorageRequest) (*GetDraftExternalAuditStorageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetDraftExternalAuditStorage not implemented") @@ -299,6 +302,7 @@ func (UnimplementedExternalAuditStorageServiceServer) TestDraftExternalAuditStor } func (UnimplementedExternalAuditStorageServiceServer) mustEmbedUnimplementedExternalAuditStorageServiceServer() { } +func (UnimplementedExternalAuditStorageServiceServer) testEmbeddedByValue() {} // UnsafeExternalAuditStorageServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ExternalAuditStorageServiceServer will @@ -308,6 +312,13 @@ type UnsafeExternalAuditStorageServiceServer interface { } func RegisterExternalAuditStorageServiceServer(s grpc.ServiceRegistrar, srv ExternalAuditStorageServiceServer) { + // If the following call pancis, it indicates UnimplementedExternalAuditStorageServiceServer 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(&ExternalAuditStorageService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/integration/v1/awsoidc_service_grpc.pb.go b/api/gen/proto/go/teleport/integration/v1/awsoidc_service_grpc.pb.go index d629021b2887b..06710804553d6 100644 --- a/api/gen/proto/go/teleport/integration/v1/awsoidc_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/integration/v1/awsoidc_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/integration/v1/awsoidc_service.proto @@ -29,8 +29,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 ( AWSOIDCService_ListEICE_FullMethodName = "/teleport.integration.v1.AWSOIDCService/ListEICE" @@ -215,7 +215,7 @@ func (c *aWSOIDCServiceClient) ListEKSClusters(ctx context.Context, in *ListEKSC // AWSOIDCServiceServer is the server API for AWSOIDCService service. // All implementations must embed UnimplementedAWSOIDCServiceServer -// for forward compatibility +// for forward compatibility. // // AWSOIDCService provides access to AWS APIs using the AWS OIDC Integration. type AWSOIDCServiceServer interface { @@ -263,9 +263,12 @@ type AWSOIDCServiceServer interface { mustEmbedUnimplementedAWSOIDCServiceServer() } -// UnimplementedAWSOIDCServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAWSOIDCServiceServer struct { -} +// UnimplementedAWSOIDCServiceServer 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 UnimplementedAWSOIDCServiceServer struct{} func (UnimplementedAWSOIDCServiceServer) ListEICE(context.Context, *ListEICERequest) (*ListEICEResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListEICE not implemented") @@ -301,6 +304,7 @@ func (UnimplementedAWSOIDCServiceServer) ListEKSClusters(context.Context, *ListE return nil, status.Errorf(codes.Unimplemented, "method ListEKSClusters not implemented") } func (UnimplementedAWSOIDCServiceServer) mustEmbedUnimplementedAWSOIDCServiceServer() {} +func (UnimplementedAWSOIDCServiceServer) testEmbeddedByValue() {} // UnsafeAWSOIDCServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AWSOIDCServiceServer will @@ -310,6 +314,13 @@ type UnsafeAWSOIDCServiceServer interface { } func RegisterAWSOIDCServiceServer(s grpc.ServiceRegistrar, srv AWSOIDCServiceServer) { + // If the following call pancis, it indicates UnimplementedAWSOIDCServiceServer 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(&AWSOIDCService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/integration/v1/integration_service_grpc.pb.go b/api/gen/proto/go/teleport/integration/v1/integration_service_grpc.pb.go index dac1038e618ab..2a4bbdb3f9563 100644 --- a/api/gen/proto/go/teleport/integration/v1/integration_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/integration/v1/integration_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/integration/v1/integration_service.proto @@ -31,8 +31,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 ( IntegrationService_ListIntegrations_FullMethodName = "/teleport.integration.v1.IntegrationService/ListIntegrations" @@ -147,7 +147,7 @@ func (c *integrationServiceClient) GenerateAWSOIDCToken(ctx context.Context, in // IntegrationServiceServer is the server API for IntegrationService service. // All implementations must embed UnimplementedIntegrationServiceServer -// for forward compatibility +// for forward compatibility. // // IntegrationService provides methods to manage Integrations with 3rd party APIs. type IntegrationServiceServer interface { @@ -169,9 +169,12 @@ type IntegrationServiceServer interface { mustEmbedUnimplementedIntegrationServiceServer() } -// UnimplementedIntegrationServiceServer must be embedded to have forward compatible implementations. -type UnimplementedIntegrationServiceServer struct { -} +// UnimplementedIntegrationServiceServer 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 UnimplementedIntegrationServiceServer struct{} func (UnimplementedIntegrationServiceServer) ListIntegrations(context.Context, *ListIntegrationsRequest) (*ListIntegrationsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListIntegrations not implemented") @@ -195,6 +198,7 @@ func (UnimplementedIntegrationServiceServer) GenerateAWSOIDCToken(context.Contex return nil, status.Errorf(codes.Unimplemented, "method GenerateAWSOIDCToken not implemented") } func (UnimplementedIntegrationServiceServer) mustEmbedUnimplementedIntegrationServiceServer() {} +func (UnimplementedIntegrationServiceServer) testEmbeddedByValue() {} // UnsafeIntegrationServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to IntegrationServiceServer will @@ -204,6 +208,13 @@ type UnsafeIntegrationServiceServer interface { } func RegisterIntegrationServiceServer(s grpc.ServiceRegistrar, srv IntegrationServiceServer) { + // If the following call pancis, it indicates UnimplementedIntegrationServiceServer 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(&IntegrationService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/kube/v1/kube_service_grpc.pb.go b/api/gen/proto/go/teleport/kube/v1/kube_service_grpc.pb.go index 2be5ac46ee7d6..95cd7d1cfcbb4 100644 --- a/api/gen/proto/go/teleport/kube/v1/kube_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/kube/v1/kube_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/kube/v1/kube_service.proto @@ -29,8 +29,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 ( KubeService_ListKubernetesResources_FullMethodName = "/teleport.kube.v1.KubeService/ListKubernetesResources" @@ -67,7 +67,7 @@ func (c *kubeServiceClient) ListKubernetesResources(ctx context.Context, in *Lis // KubeServiceServer is the server API for KubeService service. // All implementations must embed UnimplementedKubeServiceServer -// for forward compatibility +// for forward compatibility. // // KubeService provides methods to list Kubernetes resources when users are not allowed // to access the underlying cluster or resources but their `search_as_roles` allow. @@ -77,14 +77,18 @@ type KubeServiceServer interface { mustEmbedUnimplementedKubeServiceServer() } -// UnimplementedKubeServiceServer must be embedded to have forward compatible implementations. -type UnimplementedKubeServiceServer struct { -} +// UnimplementedKubeServiceServer 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 UnimplementedKubeServiceServer struct{} func (UnimplementedKubeServiceServer) ListKubernetesResources(context.Context, *ListKubernetesResourcesRequest) (*ListKubernetesResourcesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListKubernetesResources not implemented") } func (UnimplementedKubeServiceServer) mustEmbedUnimplementedKubeServiceServer() {} +func (UnimplementedKubeServiceServer) testEmbeddedByValue() {} // UnsafeKubeServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to KubeServiceServer will @@ -94,6 +98,13 @@ type UnsafeKubeServiceServer interface { } func RegisterKubeServiceServer(s grpc.ServiceRegistrar, srv KubeServiceServer) { + // If the following call pancis, it indicates UnimplementedKubeServiceServer 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(&KubeService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/kubewaitingcontainer/v1/kubewaitingcontainer_service_grpc.pb.go b/api/gen/proto/go/teleport/kubewaitingcontainer/v1/kubewaitingcontainer_service_grpc.pb.go index 5d7ce460c5e50..bc81c2103f607 100644 --- a/api/gen/proto/go/teleport/kubewaitingcontainer/v1/kubewaitingcontainer_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/kubewaitingcontainer/v1/kubewaitingcontainer_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/kubewaitingcontainer/v1/kubewaitingcontainer_service.proto @@ -30,8 +30,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 ( KubeWaitingContainersService_ListKubernetesWaitingContainers_FullMethodName = "/teleport.kubewaitingcontainer.v1.KubeWaitingContainersService/ListKubernetesWaitingContainers" @@ -112,7 +112,7 @@ func (c *kubeWaitingContainersServiceClient) DeleteKubernetesWaitingContainer(ct // KubeWaitingContainersServiceServer is the server API for KubeWaitingContainersService service. // All implementations must embed UnimplementedKubeWaitingContainersServiceServer -// for forward compatibility +// for forward compatibility. // // KubeWaitingContainersService manages Kubernetes ephemeral // containers that are waiting to be created until moderated @@ -133,9 +133,12 @@ type KubeWaitingContainersServiceServer interface { mustEmbedUnimplementedKubeWaitingContainersServiceServer() } -// UnimplementedKubeWaitingContainersServiceServer must be embedded to have forward compatible implementations. -type UnimplementedKubeWaitingContainersServiceServer struct { -} +// UnimplementedKubeWaitingContainersServiceServer 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 UnimplementedKubeWaitingContainersServiceServer struct{} func (UnimplementedKubeWaitingContainersServiceServer) ListKubernetesWaitingContainers(context.Context, *ListKubernetesWaitingContainersRequest) (*ListKubernetesWaitingContainersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListKubernetesWaitingContainers not implemented") @@ -151,6 +154,7 @@ func (UnimplementedKubeWaitingContainersServiceServer) DeleteKubernetesWaitingCo } func (UnimplementedKubeWaitingContainersServiceServer) mustEmbedUnimplementedKubeWaitingContainersServiceServer() { } +func (UnimplementedKubeWaitingContainersServiceServer) testEmbeddedByValue() {} // UnsafeKubeWaitingContainersServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to KubeWaitingContainersServiceServer will @@ -160,6 +164,13 @@ type UnsafeKubeWaitingContainersServiceServer interface { } func RegisterKubeWaitingContainersServiceServer(s grpc.ServiceRegistrar, srv KubeWaitingContainersServiceServer) { + // If the following call pancis, it indicates UnimplementedKubeWaitingContainersServiceServer 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(&KubeWaitingContainersService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/loginrule/v1/loginrule_service_grpc.pb.go b/api/gen/proto/go/teleport/loginrule/v1/loginrule_service_grpc.pb.go index fd138656fadf4..06dbd7c99cde0 100644 --- a/api/gen/proto/go/teleport/loginrule/v1/loginrule_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/loginrule/v1/loginrule_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/loginrule/v1/loginrule_service.proto @@ -30,8 +30,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 ( LoginRuleService_CreateLoginRule_FullMethodName = "/teleport.loginrule.v1.LoginRuleService/CreateLoginRule" @@ -136,7 +136,7 @@ func (c *loginRuleServiceClient) TestLoginRule(ctx context.Context, in *TestLogi // LoginRuleServiceServer is the server API for LoginRuleService service. // All implementations must embed UnimplementedLoginRuleServiceServer -// for forward compatibility +// for forward compatibility. // // LoginRuleService provides CRUD methods for the LoginRule resource. type LoginRuleServiceServer interface { @@ -159,9 +159,12 @@ type LoginRuleServiceServer interface { mustEmbedUnimplementedLoginRuleServiceServer() } -// UnimplementedLoginRuleServiceServer must be embedded to have forward compatible implementations. -type UnimplementedLoginRuleServiceServer struct { -} +// UnimplementedLoginRuleServiceServer 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 UnimplementedLoginRuleServiceServer struct{} func (UnimplementedLoginRuleServiceServer) CreateLoginRule(context.Context, *CreateLoginRuleRequest) (*LoginRule, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateLoginRule not implemented") @@ -182,6 +185,7 @@ func (UnimplementedLoginRuleServiceServer) TestLoginRule(context.Context, *TestL return nil, status.Errorf(codes.Unimplemented, "method TestLoginRule not implemented") } func (UnimplementedLoginRuleServiceServer) mustEmbedUnimplementedLoginRuleServiceServer() {} +func (UnimplementedLoginRuleServiceServer) testEmbeddedByValue() {} // UnsafeLoginRuleServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to LoginRuleServiceServer will @@ -191,6 +195,13 @@ type UnsafeLoginRuleServiceServer interface { } func RegisterLoginRuleServiceServer(s grpc.ServiceRegistrar, srv LoginRuleServiceServer) { + // If the following call pancis, it indicates UnimplementedLoginRuleServiceServer 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(&LoginRuleService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/machineid/v1/bot_instance_service_grpc.pb.go b/api/gen/proto/go/teleport/machineid/v1/bot_instance_service_grpc.pb.go index 94d2617a7231e..520fa3209acae 100644 --- a/api/gen/proto/go/teleport/machineid/v1/bot_instance_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/machineid/v1/bot_instance_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/machineid/v1/bot_instance_service.proto @@ -30,8 +30,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 ( BotInstanceService_GetBotInstance_FullMethodName = "/teleport.machineid.v1.BotInstanceService/GetBotInstance" @@ -106,7 +106,7 @@ func (c *botInstanceServiceClient) SubmitHeartbeat(ctx context.Context, in *Subm // BotInstanceServiceServer is the server API for BotInstanceService service. // All implementations must embed UnimplementedBotInstanceServiceServer -// for forward compatibility +// for forward compatibility. // // BotInstanceService provides functions to record and manage bot instances. type BotInstanceServiceServer interface { @@ -121,9 +121,12 @@ type BotInstanceServiceServer interface { mustEmbedUnimplementedBotInstanceServiceServer() } -// UnimplementedBotInstanceServiceServer must be embedded to have forward compatible implementations. -type UnimplementedBotInstanceServiceServer struct { -} +// UnimplementedBotInstanceServiceServer 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 UnimplementedBotInstanceServiceServer struct{} func (UnimplementedBotInstanceServiceServer) GetBotInstance(context.Context, *GetBotInstanceRequest) (*BotInstance, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBotInstance not implemented") @@ -138,6 +141,7 @@ func (UnimplementedBotInstanceServiceServer) SubmitHeartbeat(context.Context, *S return nil, status.Errorf(codes.Unimplemented, "method SubmitHeartbeat not implemented") } func (UnimplementedBotInstanceServiceServer) mustEmbedUnimplementedBotInstanceServiceServer() {} +func (UnimplementedBotInstanceServiceServer) testEmbeddedByValue() {} // UnsafeBotInstanceServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to BotInstanceServiceServer will @@ -147,6 +151,13 @@ type UnsafeBotInstanceServiceServer interface { } func RegisterBotInstanceServiceServer(s grpc.ServiceRegistrar, srv BotInstanceServiceServer) { + // If the following call pancis, it indicates UnimplementedBotInstanceServiceServer 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(&BotInstanceService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/machineid/v1/bot_service_grpc.pb.go b/api/gen/proto/go/teleport/machineid/v1/bot_service_grpc.pb.go index cad254d963677..2223fcc4bd3aa 100644 --- a/api/gen/proto/go/teleport/machineid/v1/bot_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/machineid/v1/bot_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/machineid/v1/bot_service.proto @@ -30,8 +30,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 ( BotService_GetBot_FullMethodName = "/teleport.machineid.v1.BotService/GetBot" @@ -143,7 +143,7 @@ func (c *botServiceClient) DeleteBot(ctx context.Context, in *DeleteBotRequest, // BotServiceServer is the server API for BotService service. // All implementations must embed UnimplementedBotServiceServer -// for forward compatibility +// for forward compatibility. // // BotService provides methods to manage Teleport Bots type BotServiceServer interface { @@ -173,9 +173,12 @@ type BotServiceServer interface { mustEmbedUnimplementedBotServiceServer() } -// UnimplementedBotServiceServer must be embedded to have forward compatible implementations. -type UnimplementedBotServiceServer struct { -} +// UnimplementedBotServiceServer 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 UnimplementedBotServiceServer struct{} func (UnimplementedBotServiceServer) GetBot(context.Context, *GetBotRequest) (*Bot, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBot not implemented") @@ -196,6 +199,7 @@ func (UnimplementedBotServiceServer) DeleteBot(context.Context, *DeleteBotReques return nil, status.Errorf(codes.Unimplemented, "method DeleteBot not implemented") } func (UnimplementedBotServiceServer) mustEmbedUnimplementedBotServiceServer() {} +func (UnimplementedBotServiceServer) testEmbeddedByValue() {} // UnsafeBotServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to BotServiceServer will @@ -205,6 +209,13 @@ type UnsafeBotServiceServer interface { } func RegisterBotServiceServer(s grpc.ServiceRegistrar, srv BotServiceServer) { + // If the following call pancis, it indicates UnimplementedBotServiceServer 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(&BotService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/machineid/v1/workload_identity_service_grpc.pb.go b/api/gen/proto/go/teleport/machineid/v1/workload_identity_service_grpc.pb.go index 5d600458af5c8..aba1cac59fba5 100644 --- a/api/gen/proto/go/teleport/machineid/v1/workload_identity_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/machineid/v1/workload_identity_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/machineid/v1/workload_identity_service.proto @@ -29,8 +29,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 ( WorkloadIdentityService_SignX509SVIDs_FullMethodName = "/teleport.machineid.v1.WorkloadIdentityService/SignX509SVIDs" @@ -68,7 +68,7 @@ func (c *workloadIdentityServiceClient) SignX509SVIDs(ctx context.Context, in *S // WorkloadIdentityServiceServer is the server API for WorkloadIdentityService service. // All implementations must embed UnimplementedWorkloadIdentityServiceServer -// for forward compatibility +// for forward compatibility. // // WorkloadIdentityService provides the signing of workload identity documents. // It currently only supports signing SPIFFE x509 SVIDs. @@ -79,15 +79,19 @@ type WorkloadIdentityServiceServer interface { mustEmbedUnimplementedWorkloadIdentityServiceServer() } -// UnimplementedWorkloadIdentityServiceServer must be embedded to have forward compatible implementations. -type UnimplementedWorkloadIdentityServiceServer struct { -} +// UnimplementedWorkloadIdentityServiceServer 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 UnimplementedWorkloadIdentityServiceServer struct{} func (UnimplementedWorkloadIdentityServiceServer) SignX509SVIDs(context.Context, *SignX509SVIDsRequest) (*SignX509SVIDsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SignX509SVIDs not implemented") } func (UnimplementedWorkloadIdentityServiceServer) mustEmbedUnimplementedWorkloadIdentityServiceServer() { } +func (UnimplementedWorkloadIdentityServiceServer) testEmbeddedByValue() {} // UnsafeWorkloadIdentityServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to WorkloadIdentityServiceServer will @@ -97,6 +101,13 @@ type UnsafeWorkloadIdentityServiceServer interface { } func RegisterWorkloadIdentityServiceServer(s grpc.ServiceRegistrar, srv WorkloadIdentityServiceServer) { + // If the following call pancis, it indicates UnimplementedWorkloadIdentityServiceServer 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(&WorkloadIdentityService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/notifications/v1/notifications_service_grpc.pb.go b/api/gen/proto/go/teleport/notifications/v1/notifications_service_grpc.pb.go index 1774ed66652fe..0a24d73cc69aa 100644 --- a/api/gen/proto/go/teleport/notifications/v1/notifications_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/notifications/v1/notifications_service_grpc.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/notifications/v1/notifications_service.proto @@ -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 ( NotificationService_CreateUserNotification_FullMethodName = "/teleport.notifications.v1.NotificationService/CreateUserNotification" @@ -148,7 +148,7 @@ func (c *notificationServiceClient) UpsertUserLastSeenNotification(ctx context.C // NotificationServiceServer is the server API for NotificationService service. // All implementations must embed UnimplementedNotificationServiceServer -// for forward compatibility +// for forward compatibility. // // NotificationService provides CRUD operations for notifications resources. type NotificationServiceServer interface { @@ -169,9 +169,12 @@ type NotificationServiceServer interface { mustEmbedUnimplementedNotificationServiceServer() } -// UnimplementedNotificationServiceServer must be embedded to have forward compatible implementations. -type UnimplementedNotificationServiceServer struct { -} +// UnimplementedNotificationServiceServer 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 UnimplementedNotificationServiceServer struct{} func (UnimplementedNotificationServiceServer) CreateUserNotification(context.Context, *CreateUserNotificationRequest) (*Notification, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateUserNotification not implemented") @@ -195,6 +198,7 @@ func (UnimplementedNotificationServiceServer) UpsertUserLastSeenNotification(con return nil, status.Errorf(codes.Unimplemented, "method UpsertUserLastSeenNotification not implemented") } func (UnimplementedNotificationServiceServer) mustEmbedUnimplementedNotificationServiceServer() {} +func (UnimplementedNotificationServiceServer) testEmbeddedByValue() {} // UnsafeNotificationServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to NotificationServiceServer will @@ -204,6 +208,13 @@ type UnsafeNotificationServiceServer interface { } func RegisterNotificationServiceServer(s grpc.ServiceRegistrar, srv NotificationServiceServer) { + // If the following call pancis, it indicates UnimplementedNotificationServiceServer 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(&NotificationService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/okta/v1/okta_service_grpc.pb.go b/api/gen/proto/go/teleport/okta/v1/okta_service_grpc.pb.go index 4a3ea01a1f53e..05ca5841e8274 100644 --- a/api/gen/proto/go/teleport/okta/v1/okta_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/okta/v1/okta_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/okta/v1/okta_service.proto @@ -31,8 +31,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 ( OktaService_ListOktaImportRules_FullMethodName = "/teleport.okta.v1.OktaService/ListOktaImportRules" @@ -224,7 +224,7 @@ func (c *oktaServiceClient) DeleteAllOktaAssignments(ctx context.Context, in *De // OktaServiceServer is the server API for OktaService service. // All implementations must embed UnimplementedOktaServiceServer -// for forward compatibility +// for forward compatibility. // // OktaService provides CRUD methods for Okta resources. type OktaServiceServer interface { @@ -257,9 +257,12 @@ type OktaServiceServer interface { mustEmbedUnimplementedOktaServiceServer() } -// UnimplementedOktaServiceServer must be embedded to have forward compatible implementations. -type UnimplementedOktaServiceServer struct { -} +// UnimplementedOktaServiceServer 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 UnimplementedOktaServiceServer struct{} func (UnimplementedOktaServiceServer) ListOktaImportRules(context.Context, *ListOktaImportRulesRequest) (*ListOktaImportRulesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListOktaImportRules not implemented") @@ -301,6 +304,7 @@ func (UnimplementedOktaServiceServer) DeleteAllOktaAssignments(context.Context, return nil, status.Errorf(codes.Unimplemented, "method DeleteAllOktaAssignments not implemented") } func (UnimplementedOktaServiceServer) mustEmbedUnimplementedOktaServiceServer() {} +func (UnimplementedOktaServiceServer) testEmbeddedByValue() {} // UnsafeOktaServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to OktaServiceServer will @@ -310,6 +314,13 @@ type UnsafeOktaServiceServer interface { } func RegisterOktaServiceServer(s grpc.ServiceRegistrar, srv OktaServiceServer) { + // If the following call pancis, it indicates UnimplementedOktaServiceServer 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(&OktaService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/plugins/v1/plugin_service_grpc.pb.go b/api/gen/proto/go/teleport/plugins/v1/plugin_service_grpc.pb.go index 1ea0bb21d8d4c..aab519692c473 100644 --- a/api/gen/proto/go/teleport/plugins/v1/plugin_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/plugins/v1/plugin_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/plugins/v1/plugin_service.proto @@ -31,8 +31,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 ( PluginService_CreatePlugin_FullMethodName = "/teleport.plugins.v1.PluginService/CreatePlugin" @@ -202,7 +202,7 @@ func (c *pluginServiceClient) Cleanup(ctx context.Context, in *CleanupRequest, o // PluginServiceServer is the server API for PluginService service. // All implementations must embed UnimplementedPluginServiceServer -// for forward compatibility +// for forward compatibility. // // PluginService provides CRUD operations for Plugin resources. type PluginServiceServer interface { @@ -235,9 +235,12 @@ type PluginServiceServer interface { mustEmbedUnimplementedPluginServiceServer() } -// UnimplementedPluginServiceServer must be embedded to have forward compatible implementations. -type UnimplementedPluginServiceServer struct { -} +// UnimplementedPluginServiceServer 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 UnimplementedPluginServiceServer struct{} func (UnimplementedPluginServiceServer) CreatePlugin(context.Context, *CreatePluginRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method CreatePlugin not implemented") @@ -273,6 +276,7 @@ func (UnimplementedPluginServiceServer) Cleanup(context.Context, *CleanupRequest return nil, status.Errorf(codes.Unimplemented, "method Cleanup not implemented") } func (UnimplementedPluginServiceServer) mustEmbedUnimplementedPluginServiceServer() {} +func (UnimplementedPluginServiceServer) testEmbeddedByValue() {} // UnsafePluginServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PluginServiceServer will @@ -282,6 +286,13 @@ type UnsafePluginServiceServer interface { } func RegisterPluginServiceServer(s grpc.ServiceRegistrar, srv PluginServiceServer) { + // If the following call pancis, it indicates UnimplementedPluginServiceServer 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(&PluginService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/presence/v1/service_grpc.pb.go b/api/gen/proto/go/teleport/presence/v1/service_grpc.pb.go index 973054bb808c7..85f0ff52f8a96 100644 --- a/api/gen/proto/go/teleport/presence/v1/service_grpc.pb.go +++ b/api/gen/proto/go/teleport/presence/v1/service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/presence/v1/service.proto @@ -31,8 +31,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 ( PresenceService_GetRemoteCluster_FullMethodName = "/teleport.presence.v1.PresenceService/GetRemoteCluster" @@ -107,7 +107,7 @@ func (c *presenceServiceClient) DeleteRemoteCluster(ctx context.Context, in *Del // PresenceServiceServer is the server API for PresenceService service. // All implementations must embed UnimplementedPresenceServiceServer -// for forward compatibility +// for forward compatibility. // // PresenceService provides methods to manage presence of RemoteClusters type PresenceServiceServer interface { @@ -122,9 +122,12 @@ type PresenceServiceServer interface { mustEmbedUnimplementedPresenceServiceServer() } -// UnimplementedPresenceServiceServer must be embedded to have forward compatible implementations. -type UnimplementedPresenceServiceServer struct { -} +// UnimplementedPresenceServiceServer 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 UnimplementedPresenceServiceServer struct{} func (UnimplementedPresenceServiceServer) GetRemoteCluster(context.Context, *GetRemoteClusterRequest) (*types.RemoteClusterV3, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRemoteCluster not implemented") @@ -139,6 +142,7 @@ func (UnimplementedPresenceServiceServer) DeleteRemoteCluster(context.Context, * return nil, status.Errorf(codes.Unimplemented, "method DeleteRemoteCluster not implemented") } func (UnimplementedPresenceServiceServer) mustEmbedUnimplementedPresenceServiceServer() {} +func (UnimplementedPresenceServiceServer) testEmbeddedByValue() {} // UnsafePresenceServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PresenceServiceServer will @@ -148,6 +152,13 @@ type UnsafePresenceServiceServer interface { } func RegisterPresenceServiceServer(s grpc.ServiceRegistrar, srv PresenceServiceServer) { + // If the following call pancis, it indicates UnimplementedPresenceServiceServer 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(&PresenceService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/resourceusage/v1/resourceusage_service_grpc.pb.go b/api/gen/proto/go/teleport/resourceusage/v1/resourceusage_service_grpc.pb.go index c82b4821e7e16..e610e182fbb77 100644 --- a/api/gen/proto/go/teleport/resourceusage/v1/resourceusage_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/resourceusage/v1/resourceusage_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/resourceusage/v1/resourceusage_service.proto @@ -29,8 +29,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 ( ResourceUsageService_GetUsage_FullMethodName = "/teleport.resourceusage.v1.ResourceUsageService/GetUsage" @@ -66,7 +66,7 @@ func (c *resourceUsageServiceClient) GetUsage(ctx context.Context, in *GetUsageR // ResourceUsageServiceServer is the server API for ResourceUsageService service. // All implementations must embed UnimplementedResourceUsageServiceServer -// for forward compatibility +// for forward compatibility. // // ResourceUsageService is a service to fetch information about the usage of limited resources on usage-billed plans. type ResourceUsageServiceServer interface { @@ -75,14 +75,18 @@ type ResourceUsageServiceServer interface { mustEmbedUnimplementedResourceUsageServiceServer() } -// UnimplementedResourceUsageServiceServer must be embedded to have forward compatible implementations. -type UnimplementedResourceUsageServiceServer struct { -} +// UnimplementedResourceUsageServiceServer 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 UnimplementedResourceUsageServiceServer struct{} func (UnimplementedResourceUsageServiceServer) GetUsage(context.Context, *GetUsageRequest) (*GetUsageResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUsage not implemented") } func (UnimplementedResourceUsageServiceServer) mustEmbedUnimplementedResourceUsageServiceServer() {} +func (UnimplementedResourceUsageServiceServer) testEmbeddedByValue() {} // UnsafeResourceUsageServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ResourceUsageServiceServer will @@ -92,6 +96,13 @@ type UnsafeResourceUsageServiceServer interface { } func RegisterResourceUsageServiceServer(s grpc.ServiceRegistrar, srv ResourceUsageServiceServer) { + // If the following call pancis, it indicates UnimplementedResourceUsageServiceServer 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(&ResourceUsageService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/samlidp/v1/samlidp_grpc.pb.go b/api/gen/proto/go/teleport/samlidp/v1/samlidp_grpc.pb.go index 41f6c31477cac..366cfe60b1c36 100644 --- a/api/gen/proto/go/teleport/samlidp/v1/samlidp_grpc.pb.go +++ b/api/gen/proto/go/teleport/samlidp/v1/samlidp_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/samlidp/v1/samlidp.proto @@ -29,8 +29,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 ( SAMLIdPService_ProcessSAMLIdPRequest_FullMethodName = "/teleport.samlidp.v1.SAMLIdPService/ProcessSAMLIdPRequest" @@ -79,7 +79,7 @@ func (c *sAMLIdPServiceClient) TestSAMLIdPAttributeMapping(ctx context.Context, // SAMLIdPServiceServer is the server API for SAMLIdPService service. // All implementations must embed UnimplementedSAMLIdPServiceServer -// for forward compatibility +// for forward compatibility. // // SAMLIdPService provides utility methods for the SAML identity provider. type SAMLIdPServiceServer interface { @@ -90,9 +90,12 @@ type SAMLIdPServiceServer interface { mustEmbedUnimplementedSAMLIdPServiceServer() } -// UnimplementedSAMLIdPServiceServer must be embedded to have forward compatible implementations. -type UnimplementedSAMLIdPServiceServer struct { -} +// UnimplementedSAMLIdPServiceServer 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 UnimplementedSAMLIdPServiceServer struct{} func (UnimplementedSAMLIdPServiceServer) ProcessSAMLIdPRequest(context.Context, *ProcessSAMLIdPRequestRequest) (*ProcessSAMLIdPRequestResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProcessSAMLIdPRequest not implemented") @@ -101,6 +104,7 @@ func (UnimplementedSAMLIdPServiceServer) TestSAMLIdPAttributeMapping(context.Con return nil, status.Errorf(codes.Unimplemented, "method TestSAMLIdPAttributeMapping not implemented") } func (UnimplementedSAMLIdPServiceServer) mustEmbedUnimplementedSAMLIdPServiceServer() {} +func (UnimplementedSAMLIdPServiceServer) testEmbeddedByValue() {} // UnsafeSAMLIdPServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SAMLIdPServiceServer will @@ -110,6 +114,13 @@ type UnsafeSAMLIdPServiceServer interface { } func RegisterSAMLIdPServiceServer(s grpc.ServiceRegistrar, srv SAMLIdPServiceServer) { + // If the following call pancis, it indicates UnimplementedSAMLIdPServiceServer 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(&SAMLIdPService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/scim/v1/scim_service_grpc.pb.go b/api/gen/proto/go/teleport/scim/v1/scim_service_grpc.pb.go index 3f0a50f31614f..a11499a4f02d6 100644 --- a/api/gen/proto/go/teleport/scim/v1/scim_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/scim/v1/scim_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/scim/v1/scim_service.proto @@ -30,8 +30,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 ( SCIMService_ListSCIMResources_FullMethodName = "/teleport.scim.v1.SCIMService/ListSCIMResources" @@ -121,7 +121,7 @@ func (c *sCIMServiceClient) DeleteSCIMResource(ctx context.Context, in *DeleteSC // SCIMServiceServer is the server API for SCIMService service. // All implementations must embed UnimplementedSCIMServiceServer -// for forward compatibility +// for forward compatibility. // // SCIMService implements a SCIM gateway for external IDPs for user provisioning type SCIMServiceServer interface { @@ -140,9 +140,12 @@ type SCIMServiceServer interface { mustEmbedUnimplementedSCIMServiceServer() } -// UnimplementedSCIMServiceServer must be embedded to have forward compatible implementations. -type UnimplementedSCIMServiceServer struct { -} +// UnimplementedSCIMServiceServer 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 UnimplementedSCIMServiceServer struct{} func (UnimplementedSCIMServiceServer) ListSCIMResources(context.Context, *ListSCIMResourcesRequest) (*ResourceList, error) { return nil, status.Errorf(codes.Unimplemented, "method ListSCIMResources not implemented") @@ -160,6 +163,7 @@ func (UnimplementedSCIMServiceServer) DeleteSCIMResource(context.Context, *Delet return nil, status.Errorf(codes.Unimplemented, "method DeleteSCIMResource not implemented") } func (UnimplementedSCIMServiceServer) mustEmbedUnimplementedSCIMServiceServer() {} +func (UnimplementedSCIMServiceServer) testEmbeddedByValue() {} // UnsafeSCIMServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SCIMServiceServer will @@ -169,6 +173,13 @@ type UnsafeSCIMServiceServer interface { } func RegisterSCIMServiceServer(s grpc.ServiceRegistrar, srv SCIMServiceServer) { + // If the following call pancis, it indicates UnimplementedSCIMServiceServer 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(&SCIMService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/secreports/v1/secreports_service_grpc.pb.go b/api/gen/proto/go/teleport/secreports/v1/secreports_service_grpc.pb.go index bc25d091ee6f6..237c05958ca32 100644 --- a/api/gen/proto/go/teleport/secreports/v1/secreports_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/secreports/v1/secreports_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/secreports/v1/secreports_service.proto @@ -30,8 +30,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 ( SecReportsService_UpsertAuditQuery_FullMethodName = "/teleport.secreports.v1.SecReportsService/UpsertAuditQuery" @@ -236,7 +236,7 @@ func (c *secReportsServiceClient) GetSchema(ctx context.Context, in *GetSchemaRe // SecReportsServiceServer is the server API for SecReportsService service. // All implementations must embed UnimplementedSecReportsServiceServer -// for forward compatibility +// for forward compatibility. // // SecReportsService is a service that manages security reports. type SecReportsServiceServer interface { @@ -271,9 +271,12 @@ type SecReportsServiceServer interface { mustEmbedUnimplementedSecReportsServiceServer() } -// UnimplementedSecReportsServiceServer must be embedded to have forward compatible implementations. -type UnimplementedSecReportsServiceServer struct { -} +// UnimplementedSecReportsServiceServer 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 UnimplementedSecReportsServiceServer struct{} func (UnimplementedSecReportsServiceServer) UpsertAuditQuery(context.Context, *UpsertAuditQueryRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method UpsertAuditQuery not implemented") @@ -318,6 +321,7 @@ func (UnimplementedSecReportsServiceServer) GetSchema(context.Context, *GetSchem return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") } func (UnimplementedSecReportsServiceServer) mustEmbedUnimplementedSecReportsServiceServer() {} +func (UnimplementedSecReportsServiceServer) testEmbeddedByValue() {} // UnsafeSecReportsServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SecReportsServiceServer will @@ -327,6 +331,13 @@ type UnsafeSecReportsServiceServer interface { } func RegisterSecReportsServiceServer(s grpc.ServiceRegistrar, srv SecReportsServiceServer) { + // If the following call pancis, it indicates UnimplementedSecReportsServiceServer 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(&SecReportsService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/transport/v1/transport_service_grpc.pb.go b/api/gen/proto/go/teleport/transport/v1/transport_service_grpc.pb.go index 5f4dae9862ac8..ac73fd815f5ff 100644 --- a/api/gen/proto/go/teleport/transport/v1/transport_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/transport/v1/transport_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/transport/v1/transport_service.proto @@ -29,8 +29,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 ( TransportService_GetClusterDetails_FullMethodName = "/teleport.transport.v1.TransportService/GetClusterDetails" @@ -57,13 +57,13 @@ type TransportServiceClient interface { // The client must first send a DialTarget before the connection is established. Agent frames // will be populated if SSH Agent forwarding is enabled for the connection. SSH frames contain // raw SSH payload to be processed by an x/crypto/ssh.Client or x/crypto/ssh.Server. - ProxySSH(ctx context.Context, opts ...grpc.CallOption) (TransportService_ProxySSHClient, error) + ProxySSH(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ProxySSHRequest, ProxySSHResponse], error) // ProxyCluster establishes a connection to the target cluster. // // The client must first send a ProxyClusterRequest with the desired cluster name before the // connection is established. After which the connection can be used to construct a new // auth.Client to the tunneled cluster. - ProxyCluster(ctx context.Context, opts ...grpc.CallOption) (TransportService_ProxyClusterClient, error) + ProxyCluster(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ProxyClusterRequest, ProxyClusterResponse], error) } type transportServiceClient struct { @@ -84,73 +84,35 @@ func (c *transportServiceClient) GetClusterDetails(ctx context.Context, in *GetC return out, nil } -func (c *transportServiceClient) ProxySSH(ctx context.Context, opts ...grpc.CallOption) (TransportService_ProxySSHClient, error) { +func (c *transportServiceClient) ProxySSH(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ProxySSHRequest, ProxySSHResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &TransportService_ServiceDesc.Streams[0], TransportService_ProxySSH_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &transportServiceProxySSHClient{ClientStream: stream} + x := &grpc.GenericClientStream[ProxySSHRequest, ProxySSHResponse]{ClientStream: stream} return x, nil } -type TransportService_ProxySSHClient interface { - Send(*ProxySSHRequest) error - Recv() (*ProxySSHResponse, error) - grpc.ClientStream -} - -type transportServiceProxySSHClient struct { - grpc.ClientStream -} - -func (x *transportServiceProxySSHClient) Send(m *ProxySSHRequest) error { - return x.ClientStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type TransportService_ProxySSHClient = grpc.BidiStreamingClient[ProxySSHRequest, ProxySSHResponse] -func (x *transportServiceProxySSHClient) Recv() (*ProxySSHResponse, error) { - m := new(ProxySSHResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *transportServiceClient) ProxyCluster(ctx context.Context, opts ...grpc.CallOption) (TransportService_ProxyClusterClient, error) { +func (c *transportServiceClient) ProxyCluster(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ProxyClusterRequest, ProxyClusterResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &TransportService_ServiceDesc.Streams[1], TransportService_ProxyCluster_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &transportServiceProxyClusterClient{ClientStream: stream} + x := &grpc.GenericClientStream[ProxyClusterRequest, ProxyClusterResponse]{ClientStream: stream} return x, nil } -type TransportService_ProxyClusterClient interface { - Send(*ProxyClusterRequest) error - Recv() (*ProxyClusterResponse, error) - grpc.ClientStream -} - -type transportServiceProxyClusterClient struct { - grpc.ClientStream -} - -func (x *transportServiceProxyClusterClient) Send(m *ProxyClusterRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *transportServiceProxyClusterClient) Recv() (*ProxyClusterResponse, error) { - m := new(ProxyClusterResponse) - 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 TransportService_ProxyClusterClient = grpc.BidiStreamingClient[ProxyClusterRequest, ProxyClusterResponse] // TransportServiceServer is the server API for TransportService service. // All implementations must embed UnimplementedTransportServiceServer -// for forward compatibility +// for forward compatibility. // // TransportService provides methods to proxy connections to various Teleport instances. // @@ -167,30 +129,34 @@ type TransportServiceServer interface { // The client must first send a DialTarget before the connection is established. Agent frames // will be populated if SSH Agent forwarding is enabled for the connection. SSH frames contain // raw SSH payload to be processed by an x/crypto/ssh.Client or x/crypto/ssh.Server. - ProxySSH(TransportService_ProxySSHServer) error + ProxySSH(grpc.BidiStreamingServer[ProxySSHRequest, ProxySSHResponse]) error // ProxyCluster establishes a connection to the target cluster. // // The client must first send a ProxyClusterRequest with the desired cluster name before the // connection is established. After which the connection can be used to construct a new // auth.Client to the tunneled cluster. - ProxyCluster(TransportService_ProxyClusterServer) error + ProxyCluster(grpc.BidiStreamingServer[ProxyClusterRequest, ProxyClusterResponse]) error mustEmbedUnimplementedTransportServiceServer() } -// UnimplementedTransportServiceServer must be embedded to have forward compatible implementations. -type UnimplementedTransportServiceServer struct { -} +// UnimplementedTransportServiceServer 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 UnimplementedTransportServiceServer struct{} func (UnimplementedTransportServiceServer) GetClusterDetails(context.Context, *GetClusterDetailsRequest) (*GetClusterDetailsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetClusterDetails not implemented") } -func (UnimplementedTransportServiceServer) ProxySSH(TransportService_ProxySSHServer) error { +func (UnimplementedTransportServiceServer) ProxySSH(grpc.BidiStreamingServer[ProxySSHRequest, ProxySSHResponse]) error { return status.Errorf(codes.Unimplemented, "method ProxySSH not implemented") } -func (UnimplementedTransportServiceServer) ProxyCluster(TransportService_ProxyClusterServer) error { +func (UnimplementedTransportServiceServer) ProxyCluster(grpc.BidiStreamingServer[ProxyClusterRequest, ProxyClusterResponse]) error { return status.Errorf(codes.Unimplemented, "method ProxyCluster not implemented") } func (UnimplementedTransportServiceServer) mustEmbedUnimplementedTransportServiceServer() {} +func (UnimplementedTransportServiceServer) testEmbeddedByValue() {} // UnsafeTransportServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to TransportServiceServer will @@ -200,6 +166,13 @@ type UnsafeTransportServiceServer interface { } func RegisterTransportServiceServer(s grpc.ServiceRegistrar, srv TransportServiceServer) { + // If the following call pancis, it indicates UnimplementedTransportServiceServer 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(&TransportService_ServiceDesc, srv) } @@ -222,56 +195,18 @@ func _TransportService_GetClusterDetails_Handler(srv interface{}, ctx context.Co } func _TransportService_ProxySSH_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TransportServiceServer).ProxySSH(&transportServiceProxySSHServer{ServerStream: stream}) -} - -type TransportService_ProxySSHServer interface { - Send(*ProxySSHResponse) error - Recv() (*ProxySSHRequest, error) - grpc.ServerStream -} - -type transportServiceProxySSHServer struct { - grpc.ServerStream + return srv.(TransportServiceServer).ProxySSH(&grpc.GenericServerStream[ProxySSHRequest, ProxySSHResponse]{ServerStream: stream}) } -func (x *transportServiceProxySSHServer) Send(m *ProxySSHResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *transportServiceProxySSHServer) Recv() (*ProxySSHRequest, error) { - m := new(ProxySSHRequest) - 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 TransportService_ProxySSHServer = grpc.BidiStreamingServer[ProxySSHRequest, ProxySSHResponse] func _TransportService_ProxyCluster_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TransportServiceServer).ProxyCluster(&transportServiceProxyClusterServer{ServerStream: stream}) + return srv.(TransportServiceServer).ProxyCluster(&grpc.GenericServerStream[ProxyClusterRequest, ProxyClusterResponse]{ServerStream: stream}) } -type TransportService_ProxyClusterServer interface { - Send(*ProxyClusterResponse) error - Recv() (*ProxyClusterRequest, error) - grpc.ServerStream -} - -type transportServiceProxyClusterServer struct { - grpc.ServerStream -} - -func (x *transportServiceProxyClusterServer) Send(m *ProxyClusterResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *transportServiceProxyClusterServer) Recv() (*ProxyClusterRequest, error) { - m := new(ProxyClusterRequest) - 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 TransportService_ProxyClusterServer = grpc.BidiStreamingServer[ProxyClusterRequest, ProxyClusterResponse] // TransportService_ServiceDesc is the grpc.ServiceDesc for TransportService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/api/gen/proto/go/teleport/trust/v1/trust_service_grpc.pb.go b/api/gen/proto/go/teleport/trust/v1/trust_service_grpc.pb.go index 3915be697442e..2b5e384451063 100644 --- a/api/gen/proto/go/teleport/trust/v1/trust_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/trust/v1/trust_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/trust/v1/trust_service.proto @@ -31,8 +31,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 ( TrustService_GetCertAuthority_FullMethodName = "/teleport.trust.v1.TrustService/GetCertAuthority" @@ -147,7 +147,7 @@ func (c *trustServiceClient) GenerateHostCert(ctx context.Context, in *GenerateH // TrustServiceServer is the server API for TrustService service. // All implementations must embed UnimplementedTrustServiceServer -// for forward compatibility +// for forward compatibility. // // TrustService provides methods to manage certificate authorities. type TrustServiceServer interface { @@ -169,9 +169,12 @@ type TrustServiceServer interface { mustEmbedUnimplementedTrustServiceServer() } -// UnimplementedTrustServiceServer must be embedded to have forward compatible implementations. -type UnimplementedTrustServiceServer struct { -} +// UnimplementedTrustServiceServer 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 UnimplementedTrustServiceServer struct{} func (UnimplementedTrustServiceServer) GetCertAuthority(context.Context, *GetCertAuthorityRequest) (*types.CertAuthorityV2, error) { return nil, status.Errorf(codes.Unimplemented, "method GetCertAuthority not implemented") @@ -195,6 +198,7 @@ func (UnimplementedTrustServiceServer) GenerateHostCert(context.Context, *Genera return nil, status.Errorf(codes.Unimplemented, "method GenerateHostCert not implemented") } func (UnimplementedTrustServiceServer) mustEmbedUnimplementedTrustServiceServer() {} +func (UnimplementedTrustServiceServer) testEmbeddedByValue() {} // UnsafeTrustServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to TrustServiceServer will @@ -204,6 +208,13 @@ type UnsafeTrustServiceServer interface { } func RegisterTrustServiceServer(s grpc.ServiceRegistrar, srv TrustServiceServer) { + // If the following call pancis, it indicates UnimplementedTrustServiceServer 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(&TrustService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/userloginstate/v1/userloginstate_service_grpc.pb.go b/api/gen/proto/go/teleport/userloginstate/v1/userloginstate_service_grpc.pb.go index 521a09fdfc699..1f085cb26b756 100644 --- a/api/gen/proto/go/teleport/userloginstate/v1/userloginstate_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/userloginstate/v1/userloginstate_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/userloginstate/v1/userloginstate_service.proto @@ -30,8 +30,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 ( UserLoginStateService_GetUserLoginStates_FullMethodName = "/teleport.userloginstate.v1.UserLoginStateService/GetUserLoginStates" @@ -119,7 +119,7 @@ func (c *userLoginStateServiceClient) DeleteAllUserLoginStates(ctx context.Conte // UserLoginStateServiceServer is the server API for UserLoginStateService service. // All implementations must embed UnimplementedUserLoginStateServiceServer -// for forward compatibility +// for forward compatibility. // // UserLoginStateService provides CRUD methods for user login state resources. type UserLoginStateServiceServer interface { @@ -136,9 +136,12 @@ type UserLoginStateServiceServer interface { mustEmbedUnimplementedUserLoginStateServiceServer() } -// UnimplementedUserLoginStateServiceServer must be embedded to have forward compatible implementations. -type UnimplementedUserLoginStateServiceServer struct { -} +// UnimplementedUserLoginStateServiceServer 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 UnimplementedUserLoginStateServiceServer struct{} func (UnimplementedUserLoginStateServiceServer) GetUserLoginStates(context.Context, *GetUserLoginStatesRequest) (*GetUserLoginStatesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUserLoginStates not implemented") @@ -156,6 +159,7 @@ func (UnimplementedUserLoginStateServiceServer) DeleteAllUserLoginStates(context return nil, status.Errorf(codes.Unimplemented, "method DeleteAllUserLoginStates not implemented") } func (UnimplementedUserLoginStateServiceServer) mustEmbedUnimplementedUserLoginStateServiceServer() {} +func (UnimplementedUserLoginStateServiceServer) testEmbeddedByValue() {} // UnsafeUserLoginStateServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to UserLoginStateServiceServer will @@ -165,6 +169,13 @@ type UnsafeUserLoginStateServiceServer interface { } func RegisterUserLoginStateServiceServer(s grpc.ServiceRegistrar, srv UserLoginStateServiceServer) { + // If the following call pancis, it indicates UnimplementedUserLoginStateServiceServer 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(&UserLoginStateService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/users/v1/users_service_grpc.pb.go b/api/gen/proto/go/teleport/users/v1/users_service_grpc.pb.go index 271665bfecaa4..8fcbd9d2e7b64 100644 --- a/api/gen/proto/go/teleport/users/v1/users_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/users/v1/users_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/users/v1/users_service.proto @@ -30,8 +30,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 ( UsersService_GetUser_FullMethodName = "/teleport.users.v1.UsersService/GetUser" @@ -132,7 +132,7 @@ func (c *usersServiceClient) DeleteUser(ctx context.Context, in *DeleteUserReque // UsersServiceServer is the server API for UsersService service. // All implementations must embed UnimplementedUsersServiceServer -// for forward compatibility +// for forward compatibility. // // UsersService provides methods to manage Teleport users. type UsersServiceServer interface { @@ -151,9 +151,12 @@ type UsersServiceServer interface { mustEmbedUnimplementedUsersServiceServer() } -// UnimplementedUsersServiceServer must be embedded to have forward compatible implementations. -type UnimplementedUsersServiceServer struct { -} +// UnimplementedUsersServiceServer 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 UnimplementedUsersServiceServer struct{} func (UnimplementedUsersServiceServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") @@ -174,6 +177,7 @@ func (UnimplementedUsersServiceServer) DeleteUser(context.Context, *DeleteUserRe return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented") } func (UnimplementedUsersServiceServer) mustEmbedUnimplementedUsersServiceServer() {} +func (UnimplementedUsersServiceServer) testEmbeddedByValue() {} // UnsafeUsersServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to UsersServiceServer will @@ -183,6 +187,13 @@ type UnsafeUsersServiceServer interface { } func RegisterUsersServiceServer(s grpc.ServiceRegistrar, srv UsersServiceServer) { + // If the following call pancis, it indicates UnimplementedUsersServiceServer 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(&UsersService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/teleport/vnet/v1/vnet_config_service_grpc.pb.go b/api/gen/proto/go/teleport/vnet/v1/vnet_config_service_grpc.pb.go index e17d0a3d1d21f..778c3e4252322 100644 --- a/api/gen/proto/go/teleport/vnet/v1/vnet_config_service_grpc.pb.go +++ b/api/gen/proto/go/teleport/vnet/v1/vnet_config_service_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/vnet/v1/vnet_config_service.proto @@ -30,8 +30,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 ( VnetConfigService_GetVnetConfig_FullMethodName = "/teleport.vnet.v1.VnetConfigService/GetVnetConfig" @@ -119,7 +119,7 @@ func (c *vnetConfigServiceClient) DeleteVnetConfig(ctx context.Context, in *Dele // VnetConfigServiceServer is the server API for VnetConfigService service. // All implementations must embed UnimplementedVnetConfigServiceServer -// for forward compatibility +// for forward compatibility. // // VnetConfigService provides an API to manage the singleton VnetConfig. type VnetConfigServiceServer interface { @@ -136,9 +136,12 @@ type VnetConfigServiceServer interface { mustEmbedUnimplementedVnetConfigServiceServer() } -// UnimplementedVnetConfigServiceServer must be embedded to have forward compatible implementations. -type UnimplementedVnetConfigServiceServer struct { -} +// UnimplementedVnetConfigServiceServer 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 UnimplementedVnetConfigServiceServer struct{} func (UnimplementedVnetConfigServiceServer) GetVnetConfig(context.Context, *GetVnetConfigRequest) (*VnetConfig, error) { return nil, status.Errorf(codes.Unimplemented, "method GetVnetConfig not implemented") @@ -156,6 +159,7 @@ func (UnimplementedVnetConfigServiceServer) DeleteVnetConfig(context.Context, *D return nil, status.Errorf(codes.Unimplemented, "method DeleteVnetConfig not implemented") } func (UnimplementedVnetConfigServiceServer) mustEmbedUnimplementedVnetConfigServiceServer() {} +func (UnimplementedVnetConfigServiceServer) testEmbeddedByValue() {} // UnsafeVnetConfigServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to VnetConfigServiceServer will @@ -165,6 +169,13 @@ type UnsafeVnetConfigServiceServer interface { } func RegisterVnetConfigServiceServer(s grpc.ServiceRegistrar, srv VnetConfigServiceServer) { + // If the following call pancis, it indicates UnimplementedVnetConfigServiceServer 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(&VnetConfigService_ServiceDesc, srv) } diff --git a/api/gen/proto/go/userpreferences/v1/userpreferences_grpc.pb.go b/api/gen/proto/go/userpreferences/v1/userpreferences_grpc.pb.go index c7163c0936509..f4dc0f68258fb 100644 --- a/api/gen/proto/go/userpreferences/v1/userpreferences_grpc.pb.go +++ b/api/gen/proto/go/userpreferences/v1/userpreferences_grpc.pb.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/userpreferences/v1/userpreferences.proto @@ -30,8 +30,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 ( UserPreferencesService_GetUserPreferences_FullMethodName = "/teleport.userpreferences.v1.UserPreferencesService/GetUserPreferences" @@ -80,7 +80,7 @@ func (c *userPreferencesServiceClient) UpsertUserPreferences(ctx context.Context // UserPreferencesServiceServer is the server API for UserPreferencesService service. // All implementations must embed UnimplementedUserPreferencesServiceServer -// for forward compatibility +// for forward compatibility. // // UserPreferencesService is a service that stores user settings. type UserPreferencesServiceServer interface { @@ -91,9 +91,12 @@ type UserPreferencesServiceServer interface { mustEmbedUnimplementedUserPreferencesServiceServer() } -// UnimplementedUserPreferencesServiceServer must be embedded to have forward compatible implementations. -type UnimplementedUserPreferencesServiceServer struct { -} +// UnimplementedUserPreferencesServiceServer 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 UnimplementedUserPreferencesServiceServer struct{} func (UnimplementedUserPreferencesServiceServer) GetUserPreferences(context.Context, *GetUserPreferencesRequest) (*GetUserPreferencesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUserPreferences not implemented") @@ -103,6 +106,7 @@ func (UnimplementedUserPreferencesServiceServer) UpsertUserPreferences(context.C } func (UnimplementedUserPreferencesServiceServer) mustEmbedUnimplementedUserPreferencesServiceServer() { } +func (UnimplementedUserPreferencesServiceServer) testEmbeddedByValue() {} // UnsafeUserPreferencesServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to UserPreferencesServiceServer will @@ -112,6 +116,13 @@ type UnsafeUserPreferencesServiceServer interface { } func RegisterUserPreferencesServiceServer(s grpc.ServiceRegistrar, srv UserPreferencesServiceServer) { + // If the following call pancis, it indicates UnimplementedUserPreferencesServiceServer 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(&UserPreferencesService_ServiceDesc, srv) } diff --git a/gen/proto/go/accessgraph/v1alpha/access_graph_service_grpc.pb.go b/gen/proto/go/accessgraph/v1alpha/access_graph_service_grpc.pb.go index 7f0812c5f881f..5f1ddcb26c27c 100644 --- a/gen/proto/go/accessgraph/v1alpha/access_graph_service_grpc.pb.go +++ b/gen/proto/go/accessgraph/v1alpha/access_graph_service_grpc.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: accessgraph/v1alpha/access_graph_service.proto @@ -32,8 +32,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 ( AccessGraphService_Query_FullMethodName = "/accessgraph.v1alpha.AccessGraphService/Query" @@ -64,11 +64,11 @@ type AccessGraphServiceClient interface { // This stream is used to sync the access graph with the Teleport database state. // Once Teleport finishes syncing the current state, it sends a sync command // to the access graph service and resumes sending events. - EventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_EventsStreamClient, error) + EventsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[EventsStreamRequest, EventsStreamResponse], error) // EventsStreamV2 is a stream of commands to the access graph service. // This stream works the same way as EventsStream, but it returns a stream of events // instead of a single response. - EventsStreamV2(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_EventsStreamV2Client, error) + EventsStreamV2(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[EventsStreamV2Request, EventsStreamV2Response], error) // Register submits a new tenant representing this Teleport cluster to the TAG service, // identified by its HostCA certificate. // The method is idempotent: it succeeds if the tenant has already registered and has the specific CA associated. @@ -87,11 +87,11 @@ type AccessGraphServiceClient interface { // Teleport Discovery Service creates a stream to the access graph service // and pushes all AWS resources and following events to it. // This stream is used to sync the access graph with the AWS database state. - AWSEventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_AWSEventsStreamClient, error) + AWSEventsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[AWSEventsStreamRequest, AWSEventsStreamResponse], error) // GitlabEventsStream is a stream of commands to the Gitlab importer. - GitlabEventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_GitlabEventsStreamClient, error) + GitlabEventsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[GitlabEventsStreamRequest, GitlabEventsStreamResponse], error) // EntraEventsStream is a stream of commands to the Entra ID SSO importer. - EntraEventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_EntraEventsStreamClient, error) + EntraEventsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[EntraEventsStreamRequest, EntraEventsStreamResponse], error) } type accessGraphServiceClient struct { @@ -122,72 +122,31 @@ func (c *accessGraphServiceClient) GetFile(ctx context.Context, in *GetFileReque return out, nil } -func (c *accessGraphServiceClient) EventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_EventsStreamClient, error) { +func (c *accessGraphServiceClient) EventsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[EventsStreamRequest, EventsStreamResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &AccessGraphService_ServiceDesc.Streams[0], AccessGraphService_EventsStream_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &accessGraphServiceEventsStreamClient{ClientStream: stream} + x := &grpc.GenericClientStream[EventsStreamRequest, EventsStreamResponse]{ClientStream: stream} return x, nil } -type AccessGraphService_EventsStreamClient interface { - Send(*EventsStreamRequest) error - CloseAndRecv() (*EventsStreamResponse, error) - grpc.ClientStream -} - -type accessGraphServiceEventsStreamClient struct { - grpc.ClientStream -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AccessGraphService_EventsStreamClient = grpc.ClientStreamingClient[EventsStreamRequest, EventsStreamResponse] -func (x *accessGraphServiceEventsStreamClient) Send(m *EventsStreamRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *accessGraphServiceEventsStreamClient) CloseAndRecv() (*EventsStreamResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(EventsStreamResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *accessGraphServiceClient) EventsStreamV2(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_EventsStreamV2Client, error) { +func (c *accessGraphServiceClient) EventsStreamV2(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[EventsStreamV2Request, EventsStreamV2Response], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &AccessGraphService_ServiceDesc.Streams[1], AccessGraphService_EventsStreamV2_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &accessGraphServiceEventsStreamV2Client{ClientStream: stream} + x := &grpc.GenericClientStream[EventsStreamV2Request, EventsStreamV2Response]{ClientStream: stream} return x, nil } -type AccessGraphService_EventsStreamV2Client interface { - Send(*EventsStreamV2Request) error - Recv() (*EventsStreamV2Response, error) - grpc.ClientStream -} - -type accessGraphServiceEventsStreamV2Client struct { - grpc.ClientStream -} - -func (x *accessGraphServiceEventsStreamV2Client) Send(m *EventsStreamV2Request) error { - return x.ClientStream.SendMsg(m) -} - -func (x *accessGraphServiceEventsStreamV2Client) Recv() (*EventsStreamV2Response, error) { - m := new(EventsStreamV2Response) - 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 AccessGraphService_EventsStreamV2Client = grpc.BidiStreamingClient[EventsStreamV2Request, EventsStreamV2Response] func (c *accessGraphServiceClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -209,108 +168,48 @@ func (c *accessGraphServiceClient) ReplaceCAs(ctx context.Context, in *ReplaceCA return out, nil } -func (c *accessGraphServiceClient) AWSEventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_AWSEventsStreamClient, error) { +func (c *accessGraphServiceClient) AWSEventsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[AWSEventsStreamRequest, AWSEventsStreamResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &AccessGraphService_ServiceDesc.Streams[2], AccessGraphService_AWSEventsStream_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &accessGraphServiceAWSEventsStreamClient{ClientStream: stream} + x := &grpc.GenericClientStream[AWSEventsStreamRequest, AWSEventsStreamResponse]{ClientStream: stream} return x, nil } -type AccessGraphService_AWSEventsStreamClient interface { - Send(*AWSEventsStreamRequest) error - CloseAndRecv() (*AWSEventsStreamResponse, error) - grpc.ClientStream -} - -type accessGraphServiceAWSEventsStreamClient struct { - grpc.ClientStream -} - -func (x *accessGraphServiceAWSEventsStreamClient) Send(m *AWSEventsStreamRequest) error { - return x.ClientStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AccessGraphService_AWSEventsStreamClient = grpc.ClientStreamingClient[AWSEventsStreamRequest, AWSEventsStreamResponse] -func (x *accessGraphServiceAWSEventsStreamClient) CloseAndRecv() (*AWSEventsStreamResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(AWSEventsStreamResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *accessGraphServiceClient) GitlabEventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_GitlabEventsStreamClient, error) { +func (c *accessGraphServiceClient) GitlabEventsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[GitlabEventsStreamRequest, GitlabEventsStreamResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &AccessGraphService_ServiceDesc.Streams[3], AccessGraphService_GitlabEventsStream_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &accessGraphServiceGitlabEventsStreamClient{ClientStream: stream} + x := &grpc.GenericClientStream[GitlabEventsStreamRequest, GitlabEventsStreamResponse]{ClientStream: stream} return x, nil } -type AccessGraphService_GitlabEventsStreamClient interface { - Send(*GitlabEventsStreamRequest) error - Recv() (*GitlabEventsStreamResponse, error) - grpc.ClientStream -} - -type accessGraphServiceGitlabEventsStreamClient struct { - grpc.ClientStream -} - -func (x *accessGraphServiceGitlabEventsStreamClient) Send(m *GitlabEventsStreamRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *accessGraphServiceGitlabEventsStreamClient) Recv() (*GitlabEventsStreamResponse, error) { - m := new(GitlabEventsStreamResponse) - 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 AccessGraphService_GitlabEventsStreamClient = grpc.BidiStreamingClient[GitlabEventsStreamRequest, GitlabEventsStreamResponse] -func (c *accessGraphServiceClient) EntraEventsStream(ctx context.Context, opts ...grpc.CallOption) (AccessGraphService_EntraEventsStreamClient, error) { +func (c *accessGraphServiceClient) EntraEventsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[EntraEventsStreamRequest, EntraEventsStreamResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &AccessGraphService_ServiceDesc.Streams[4], AccessGraphService_EntraEventsStream_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &accessGraphServiceEntraEventsStreamClient{ClientStream: stream} + x := &grpc.GenericClientStream[EntraEventsStreamRequest, EntraEventsStreamResponse]{ClientStream: stream} return x, nil } -type AccessGraphService_EntraEventsStreamClient interface { - Send(*EntraEventsStreamRequest) error - Recv() (*EntraEventsStreamResponse, error) - grpc.ClientStream -} - -type accessGraphServiceEntraEventsStreamClient struct { - grpc.ClientStream -} - -func (x *accessGraphServiceEntraEventsStreamClient) Send(m *EntraEventsStreamRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *accessGraphServiceEntraEventsStreamClient) Recv() (*EntraEventsStreamResponse, error) { - m := new(EntraEventsStreamResponse) - 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 AccessGraphService_EntraEventsStreamClient = grpc.BidiStreamingClient[EntraEventsStreamRequest, EntraEventsStreamResponse] // AccessGraphServiceServer is the server API for AccessGraphService service. // All implementations must embed UnimplementedAccessGraphServiceServer -// for forward compatibility +// for forward compatibility. // // AccessGraphService is a service for interacting the access graph service. type AccessGraphServiceServer interface { @@ -325,11 +224,11 @@ type AccessGraphServiceServer interface { // This stream is used to sync the access graph with the Teleport database state. // Once Teleport finishes syncing the current state, it sends a sync command // to the access graph service and resumes sending events. - EventsStream(AccessGraphService_EventsStreamServer) error + EventsStream(grpc.ClientStreamingServer[EventsStreamRequest, EventsStreamResponse]) error // EventsStreamV2 is a stream of commands to the access graph service. // This stream works the same way as EventsStream, but it returns a stream of events // instead of a single response. - EventsStreamV2(AccessGraphService_EventsStreamV2Server) error + EventsStreamV2(grpc.BidiStreamingServer[EventsStreamV2Request, EventsStreamV2Response]) error // Register submits a new tenant representing this Teleport cluster to the TAG service, // identified by its HostCA certificate. // The method is idempotent: it succeeds if the tenant has already registered and has the specific CA associated. @@ -348,17 +247,20 @@ type AccessGraphServiceServer interface { // Teleport Discovery Service creates a stream to the access graph service // and pushes all AWS resources and following events to it. // This stream is used to sync the access graph with the AWS database state. - AWSEventsStream(AccessGraphService_AWSEventsStreamServer) error + AWSEventsStream(grpc.ClientStreamingServer[AWSEventsStreamRequest, AWSEventsStreamResponse]) error // GitlabEventsStream is a stream of commands to the Gitlab importer. - GitlabEventsStream(AccessGraphService_GitlabEventsStreamServer) error + GitlabEventsStream(grpc.BidiStreamingServer[GitlabEventsStreamRequest, GitlabEventsStreamResponse]) error // EntraEventsStream is a stream of commands to the Entra ID SSO importer. - EntraEventsStream(AccessGraphService_EntraEventsStreamServer) error + EntraEventsStream(grpc.BidiStreamingServer[EntraEventsStreamRequest, EntraEventsStreamResponse]) error mustEmbedUnimplementedAccessGraphServiceServer() } -// UnimplementedAccessGraphServiceServer must be embedded to have forward compatible implementations. -type UnimplementedAccessGraphServiceServer struct { -} +// UnimplementedAccessGraphServiceServer 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 UnimplementedAccessGraphServiceServer struct{} func (UnimplementedAccessGraphServiceServer) Query(context.Context, *QueryRequest) (*QueryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") @@ -366,10 +268,10 @@ func (UnimplementedAccessGraphServiceServer) Query(context.Context, *QueryReques func (UnimplementedAccessGraphServiceServer) GetFile(context.Context, *GetFileRequest) (*GetFileResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetFile not implemented") } -func (UnimplementedAccessGraphServiceServer) EventsStream(AccessGraphService_EventsStreamServer) error { +func (UnimplementedAccessGraphServiceServer) EventsStream(grpc.ClientStreamingServer[EventsStreamRequest, EventsStreamResponse]) error { return status.Errorf(codes.Unimplemented, "method EventsStream not implemented") } -func (UnimplementedAccessGraphServiceServer) EventsStreamV2(AccessGraphService_EventsStreamV2Server) error { +func (UnimplementedAccessGraphServiceServer) EventsStreamV2(grpc.BidiStreamingServer[EventsStreamV2Request, EventsStreamV2Response]) error { return status.Errorf(codes.Unimplemented, "method EventsStreamV2 not implemented") } func (UnimplementedAccessGraphServiceServer) Register(context.Context, *RegisterRequest) (*RegisterResponse, error) { @@ -378,16 +280,17 @@ func (UnimplementedAccessGraphServiceServer) Register(context.Context, *Register func (UnimplementedAccessGraphServiceServer) ReplaceCAs(context.Context, *ReplaceCAsRequest) (*ReplaceCAsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReplaceCAs not implemented") } -func (UnimplementedAccessGraphServiceServer) AWSEventsStream(AccessGraphService_AWSEventsStreamServer) error { +func (UnimplementedAccessGraphServiceServer) AWSEventsStream(grpc.ClientStreamingServer[AWSEventsStreamRequest, AWSEventsStreamResponse]) error { return status.Errorf(codes.Unimplemented, "method AWSEventsStream not implemented") } -func (UnimplementedAccessGraphServiceServer) GitlabEventsStream(AccessGraphService_GitlabEventsStreamServer) error { +func (UnimplementedAccessGraphServiceServer) GitlabEventsStream(grpc.BidiStreamingServer[GitlabEventsStreamRequest, GitlabEventsStreamResponse]) error { return status.Errorf(codes.Unimplemented, "method GitlabEventsStream not implemented") } -func (UnimplementedAccessGraphServiceServer) EntraEventsStream(AccessGraphService_EntraEventsStreamServer) error { +func (UnimplementedAccessGraphServiceServer) EntraEventsStream(grpc.BidiStreamingServer[EntraEventsStreamRequest, EntraEventsStreamResponse]) error { return status.Errorf(codes.Unimplemented, "method EntraEventsStream not implemented") } func (UnimplementedAccessGraphServiceServer) mustEmbedUnimplementedAccessGraphServiceServer() {} +func (UnimplementedAccessGraphServiceServer) testEmbeddedByValue() {} // UnsafeAccessGraphServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AccessGraphServiceServer will @@ -397,6 +300,13 @@ type UnsafeAccessGraphServiceServer interface { } func RegisterAccessGraphServiceServer(s grpc.ServiceRegistrar, srv AccessGraphServiceServer) { + // If the following call pancis, it indicates UnimplementedAccessGraphServiceServer 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(&AccessGraphService_ServiceDesc, srv) } @@ -437,56 +347,18 @@ func _AccessGraphService_GetFile_Handler(srv interface{}, ctx context.Context, d } func _AccessGraphService_EventsStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AccessGraphServiceServer).EventsStream(&accessGraphServiceEventsStreamServer{ServerStream: stream}) -} - -type AccessGraphService_EventsStreamServer interface { - SendAndClose(*EventsStreamResponse) error - Recv() (*EventsStreamRequest, error) - grpc.ServerStream -} - -type accessGraphServiceEventsStreamServer struct { - grpc.ServerStream -} - -func (x *accessGraphServiceEventsStreamServer) SendAndClose(m *EventsStreamResponse) error { - return x.ServerStream.SendMsg(m) + return srv.(AccessGraphServiceServer).EventsStream(&grpc.GenericServerStream[EventsStreamRequest, EventsStreamResponse]{ServerStream: stream}) } -func (x *accessGraphServiceEventsStreamServer) Recv() (*EventsStreamRequest, error) { - m := new(EventsStreamRequest) - 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 AccessGraphService_EventsStreamServer = grpc.ClientStreamingServer[EventsStreamRequest, EventsStreamResponse] func _AccessGraphService_EventsStreamV2_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AccessGraphServiceServer).EventsStreamV2(&accessGraphServiceEventsStreamV2Server{ServerStream: stream}) + return srv.(AccessGraphServiceServer).EventsStreamV2(&grpc.GenericServerStream[EventsStreamV2Request, EventsStreamV2Response]{ServerStream: stream}) } -type AccessGraphService_EventsStreamV2Server interface { - Send(*EventsStreamV2Response) error - Recv() (*EventsStreamV2Request, error) - grpc.ServerStream -} - -type accessGraphServiceEventsStreamV2Server struct { - grpc.ServerStream -} - -func (x *accessGraphServiceEventsStreamV2Server) Send(m *EventsStreamV2Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *accessGraphServiceEventsStreamV2Server) Recv() (*EventsStreamV2Request, error) { - m := new(EventsStreamV2Request) - 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 AccessGraphService_EventsStreamV2Server = grpc.BidiStreamingServer[EventsStreamV2Request, EventsStreamV2Response] func _AccessGraphService_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(RegisterRequest) @@ -525,82 +397,25 @@ func _AccessGraphService_ReplaceCAs_Handler(srv interface{}, ctx context.Context } func _AccessGraphService_AWSEventsStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AccessGraphServiceServer).AWSEventsStream(&accessGraphServiceAWSEventsStreamServer{ServerStream: stream}) -} - -type AccessGraphService_AWSEventsStreamServer interface { - SendAndClose(*AWSEventsStreamResponse) error - Recv() (*AWSEventsStreamRequest, error) - grpc.ServerStream -} - -type accessGraphServiceAWSEventsStreamServer struct { - grpc.ServerStream -} - -func (x *accessGraphServiceAWSEventsStreamServer) SendAndClose(m *AWSEventsStreamResponse) error { - return x.ServerStream.SendMsg(m) + return srv.(AccessGraphServiceServer).AWSEventsStream(&grpc.GenericServerStream[AWSEventsStreamRequest, AWSEventsStreamResponse]{ServerStream: stream}) } -func (x *accessGraphServiceAWSEventsStreamServer) Recv() (*AWSEventsStreamRequest, error) { - m := new(AWSEventsStreamRequest) - 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 AccessGraphService_AWSEventsStreamServer = grpc.ClientStreamingServer[AWSEventsStreamRequest, AWSEventsStreamResponse] func _AccessGraphService_GitlabEventsStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AccessGraphServiceServer).GitlabEventsStream(&accessGraphServiceGitlabEventsStreamServer{ServerStream: stream}) -} - -type AccessGraphService_GitlabEventsStreamServer interface { - Send(*GitlabEventsStreamResponse) error - Recv() (*GitlabEventsStreamRequest, error) - grpc.ServerStream -} - -type accessGraphServiceGitlabEventsStreamServer struct { - grpc.ServerStream -} - -func (x *accessGraphServiceGitlabEventsStreamServer) Send(m *GitlabEventsStreamResponse) error { - return x.ServerStream.SendMsg(m) + return srv.(AccessGraphServiceServer).GitlabEventsStream(&grpc.GenericServerStream[GitlabEventsStreamRequest, GitlabEventsStreamResponse]{ServerStream: stream}) } -func (x *accessGraphServiceGitlabEventsStreamServer) Recv() (*GitlabEventsStreamRequest, error) { - m := new(GitlabEventsStreamRequest) - 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 AccessGraphService_GitlabEventsStreamServer = grpc.BidiStreamingServer[GitlabEventsStreamRequest, GitlabEventsStreamResponse] func _AccessGraphService_EntraEventsStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AccessGraphServiceServer).EntraEventsStream(&accessGraphServiceEntraEventsStreamServer{ServerStream: stream}) -} - -type AccessGraphService_EntraEventsStreamServer interface { - Send(*EntraEventsStreamResponse) error - Recv() (*EntraEventsStreamRequest, error) - grpc.ServerStream -} - -type accessGraphServiceEntraEventsStreamServer struct { - grpc.ServerStream -} - -func (x *accessGraphServiceEntraEventsStreamServer) Send(m *EntraEventsStreamResponse) error { - return x.ServerStream.SendMsg(m) + return srv.(AccessGraphServiceServer).EntraEventsStream(&grpc.GenericServerStream[EntraEventsStreamRequest, EntraEventsStreamResponse]{ServerStream: stream}) } -func (x *accessGraphServiceEntraEventsStreamServer) Recv() (*EntraEventsStreamRequest, error) { - m := new(EntraEventsStreamRequest) - 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 AccessGraphService_EntraEventsStreamServer = grpc.BidiStreamingServer[EntraEventsStreamRequest, EntraEventsStreamResponse] // AccessGraphService_ServiceDesc is the grpc.ServiceDesc for AccessGraphService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/gen/proto/go/teleport/lib/teleterm/v1/service_grpc.pb.go b/gen/proto/go/teleport/lib/teleterm/v1/service_grpc.pb.go index f389a1704c7e7..1af4f8cd62df8 100644 --- a/gen/proto/go/teleport/lib/teleterm/v1/service_grpc.pb.go +++ b/gen/proto/go/teleport/lib/teleterm/v1/service_grpc.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/lib/teleterm/v1/service.proto @@ -32,8 +32,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 ( TerminalService_UpdateTshdEventsServerAddress_FullMethodName = "/teleport.lib.teleterm.v1.TerminalService/UpdateTshdEventsServerAddress" @@ -171,11 +171,11 @@ type TerminalServiceClient interface { // <- Send list of credentials (e.g. usernames) associated with device // -> Receive the index number associated with the selected credential in list // <- End - LoginPasswordless(ctx context.Context, opts ...grpc.CallOption) (TerminalService_LoginPasswordlessClient, error) + LoginPasswordless(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LoginPasswordlessRequest, LoginPasswordlessResponse], error) // ClusterLogin logs out a user from cluster Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*EmptyResponse, error) // TransferFile sends a request to download/upload a file - TransferFile(ctx context.Context, in *FileTransferRequest, opts ...grpc.CallOption) (TerminalService_TransferFileClient, error) + TransferFile(ctx context.Context, in *FileTransferRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileTransferProgress], error) // ReportUsageEvent allows to send usage events that are then anonymized and forwarded to prehog ReportUsageEvent(ctx context.Context, in *ReportUsageEventRequest, opts ...grpc.CallOption) (*EmptyResponse, error) // UpdateHeadlessAuthenticationState updates a headless authentication resource's state. @@ -491,37 +491,18 @@ func (c *terminalServiceClient) Login(ctx context.Context, in *LoginRequest, opt return out, nil } -func (c *terminalServiceClient) LoginPasswordless(ctx context.Context, opts ...grpc.CallOption) (TerminalService_LoginPasswordlessClient, error) { +func (c *terminalServiceClient) LoginPasswordless(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LoginPasswordlessRequest, LoginPasswordlessResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &TerminalService_ServiceDesc.Streams[0], TerminalService_LoginPasswordless_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &terminalServiceLoginPasswordlessClient{ClientStream: stream} + x := &grpc.GenericClientStream[LoginPasswordlessRequest, LoginPasswordlessResponse]{ClientStream: stream} return x, nil } -type TerminalService_LoginPasswordlessClient interface { - Send(*LoginPasswordlessRequest) error - Recv() (*LoginPasswordlessResponse, error) - grpc.ClientStream -} - -type terminalServiceLoginPasswordlessClient struct { - grpc.ClientStream -} - -func (x *terminalServiceLoginPasswordlessClient) Send(m *LoginPasswordlessRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *terminalServiceLoginPasswordlessClient) Recv() (*LoginPasswordlessResponse, error) { - m := new(LoginPasswordlessResponse) - 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 TerminalService_LoginPasswordlessClient = grpc.BidiStreamingClient[LoginPasswordlessRequest, LoginPasswordlessResponse] func (c *terminalServiceClient) Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*EmptyResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -533,13 +514,13 @@ func (c *terminalServiceClient) Logout(ctx context.Context, in *LogoutRequest, o return out, nil } -func (c *terminalServiceClient) TransferFile(ctx context.Context, in *FileTransferRequest, opts ...grpc.CallOption) (TerminalService_TransferFileClient, error) { +func (c *terminalServiceClient) TransferFile(ctx context.Context, in *FileTransferRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileTransferProgress], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &TerminalService_ServiceDesc.Streams[1], TerminalService_TransferFile_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &terminalServiceTransferFileClient{ClientStream: stream} + x := &grpc.GenericClientStream[FileTransferRequest, FileTransferProgress]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -549,22 +530,8 @@ func (c *terminalServiceClient) TransferFile(ctx context.Context, in *FileTransf return x, nil } -type TerminalService_TransferFileClient interface { - Recv() (*FileTransferProgress, error) - grpc.ClientStream -} - -type terminalServiceTransferFileClient struct { - grpc.ClientStream -} - -func (x *terminalServiceTransferFileClient) Recv() (*FileTransferProgress, error) { - m := new(FileTransferProgress) - 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 TerminalService_TransferFileClient = grpc.ServerStreamingClient[FileTransferProgress] func (c *terminalServiceClient) ReportUsageEvent(ctx context.Context, in *ReportUsageEventRequest, opts ...grpc.CallOption) (*EmptyResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -678,7 +645,7 @@ func (c *terminalServiceClient) AuthenticateWebDevice(ctx context.Context, in *A // TerminalServiceServer is the server API for TerminalService service. // All implementations must embed UnimplementedTerminalServiceServer -// for forward compatibility +// for forward compatibility. // // TerminalService is used by the Electron app to communicate with the tsh daemon. // @@ -768,11 +735,11 @@ type TerminalServiceServer interface { // <- Send list of credentials (e.g. usernames) associated with device // -> Receive the index number associated with the selected credential in list // <- End - LoginPasswordless(TerminalService_LoginPasswordlessServer) error + LoginPasswordless(grpc.BidiStreamingServer[LoginPasswordlessRequest, LoginPasswordlessResponse]) error // ClusterLogin logs out a user from cluster Logout(context.Context, *LogoutRequest) (*EmptyResponse, error) // TransferFile sends a request to download/upload a file - TransferFile(*FileTransferRequest, TerminalService_TransferFileServer) error + TransferFile(*FileTransferRequest, grpc.ServerStreamingServer[FileTransferProgress]) error // ReportUsageEvent allows to send usage events that are then anonymized and forwarded to prehog ReportUsageEvent(context.Context, *ReportUsageEventRequest) (*EmptyResponse, error) // UpdateHeadlessAuthenticationState updates a headless authentication resource's state. @@ -811,9 +778,12 @@ type TerminalServiceServer interface { mustEmbedUnimplementedTerminalServiceServer() } -// UnimplementedTerminalServiceServer must be embedded to have forward compatible implementations. -type UnimplementedTerminalServiceServer struct { -} +// UnimplementedTerminalServiceServer 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 UnimplementedTerminalServiceServer struct{} func (UnimplementedTerminalServiceServer) UpdateTshdEventsServerAddress(context.Context, *UpdateTshdEventsServerAddressRequest) (*UpdateTshdEventsServerAddressResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateTshdEventsServerAddress not implemented") @@ -896,13 +866,13 @@ func (UnimplementedTerminalServiceServer) GetCluster(context.Context, *GetCluste func (UnimplementedTerminalServiceServer) Login(context.Context, *LoginRequest) (*EmptyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Login not implemented") } -func (UnimplementedTerminalServiceServer) LoginPasswordless(TerminalService_LoginPasswordlessServer) error { +func (UnimplementedTerminalServiceServer) LoginPasswordless(grpc.BidiStreamingServer[LoginPasswordlessRequest, LoginPasswordlessResponse]) error { return status.Errorf(codes.Unimplemented, "method LoginPasswordless not implemented") } func (UnimplementedTerminalServiceServer) Logout(context.Context, *LogoutRequest) (*EmptyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Logout not implemented") } -func (UnimplementedTerminalServiceServer) TransferFile(*FileTransferRequest, TerminalService_TransferFileServer) error { +func (UnimplementedTerminalServiceServer) TransferFile(*FileTransferRequest, grpc.ServerStreamingServer[FileTransferProgress]) error { return status.Errorf(codes.Unimplemented, "method TransferFile not implemented") } func (UnimplementedTerminalServiceServer) ReportUsageEvent(context.Context, *ReportUsageEventRequest) (*EmptyResponse, error) { @@ -939,6 +909,7 @@ func (UnimplementedTerminalServiceServer) AuthenticateWebDevice(context.Context, return nil, status.Errorf(codes.Unimplemented, "method AuthenticateWebDevice not implemented") } func (UnimplementedTerminalServiceServer) mustEmbedUnimplementedTerminalServiceServer() {} +func (UnimplementedTerminalServiceServer) testEmbeddedByValue() {} // UnsafeTerminalServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to TerminalServiceServer will @@ -948,6 +919,13 @@ type UnsafeTerminalServiceServer interface { } func RegisterTerminalServiceServer(s grpc.ServiceRegistrar, srv TerminalServiceServer) { + // If the following call pancis, it indicates UnimplementedTerminalServiceServer 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(&TerminalService_ServiceDesc, srv) } @@ -1438,30 +1416,11 @@ func _TerminalService_Login_Handler(srv interface{}, ctx context.Context, dec fu } func _TerminalService_LoginPasswordless_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TerminalServiceServer).LoginPasswordless(&terminalServiceLoginPasswordlessServer{ServerStream: stream}) -} - -type TerminalService_LoginPasswordlessServer interface { - Send(*LoginPasswordlessResponse) error - Recv() (*LoginPasswordlessRequest, error) - grpc.ServerStream -} - -type terminalServiceLoginPasswordlessServer struct { - grpc.ServerStream -} - -func (x *terminalServiceLoginPasswordlessServer) Send(m *LoginPasswordlessResponse) error { - return x.ServerStream.SendMsg(m) + return srv.(TerminalServiceServer).LoginPasswordless(&grpc.GenericServerStream[LoginPasswordlessRequest, LoginPasswordlessResponse]{ServerStream: stream}) } -func (x *terminalServiceLoginPasswordlessServer) Recv() (*LoginPasswordlessRequest, error) { - m := new(LoginPasswordlessRequest) - 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 TerminalService_LoginPasswordlessServer = grpc.BidiStreamingServer[LoginPasswordlessRequest, LoginPasswordlessResponse] func _TerminalService_Logout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(LogoutRequest) @@ -1486,21 +1445,11 @@ func _TerminalService_TransferFile_Handler(srv interface{}, stream grpc.ServerSt if err := stream.RecvMsg(m); err != nil { return err } - return srv.(TerminalServiceServer).TransferFile(m, &terminalServiceTransferFileServer{ServerStream: stream}) -} - -type TerminalService_TransferFileServer interface { - Send(*FileTransferProgress) error - grpc.ServerStream -} - -type terminalServiceTransferFileServer struct { - grpc.ServerStream + return srv.(TerminalServiceServer).TransferFile(m, &grpc.GenericServerStream[FileTransferRequest, FileTransferProgress]{ServerStream: stream}) } -func (x *terminalServiceTransferFileServer) Send(m *FileTransferProgress) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type TerminalService_TransferFileServer = grpc.ServerStreamingServer[FileTransferProgress] func _TerminalService_ReportUsageEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReportUsageEventRequest) diff --git a/gen/proto/go/teleport/lib/teleterm/v1/tshd_events_service_grpc.pb.go b/gen/proto/go/teleport/lib/teleterm/v1/tshd_events_service_grpc.pb.go index bd558541e9342..7dc9087c46d05 100644 --- a/gen/proto/go/teleport/lib/teleterm/v1/tshd_events_service_grpc.pb.go +++ b/gen/proto/go/teleport/lib/teleterm/v1/tshd_events_service_grpc.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/lib/teleterm/v1/tshd_events_service.proto @@ -32,8 +32,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 ( TshdEventsService_Relogin_FullMethodName = "/teleport.lib.teleterm.v1.TshdEventsService/Relogin" @@ -147,7 +147,7 @@ func (c *tshdEventsServiceClient) ReportUnexpectedVnetShutdown(ctx context.Conte // TshdEventsServiceServer is the server API for TshdEventsService service. // All implementations must embed UnimplementedTshdEventsServiceServer -// for forward compatibility +// for forward compatibility. // // TshdEventsService is served by the Electron app. The tsh daemon calls this service to notify the // app about actions that happen outside of the app itself. @@ -179,9 +179,12 @@ type TshdEventsServiceServer interface { mustEmbedUnimplementedTshdEventsServiceServer() } -// UnimplementedTshdEventsServiceServer must be embedded to have forward compatible implementations. -type UnimplementedTshdEventsServiceServer struct { -} +// UnimplementedTshdEventsServiceServer 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 UnimplementedTshdEventsServiceServer struct{} func (UnimplementedTshdEventsServiceServer) Relogin(context.Context, *ReloginRequest) (*ReloginResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Relogin not implemented") @@ -202,6 +205,7 @@ func (UnimplementedTshdEventsServiceServer) ReportUnexpectedVnetShutdown(context return nil, status.Errorf(codes.Unimplemented, "method ReportUnexpectedVnetShutdown not implemented") } func (UnimplementedTshdEventsServiceServer) mustEmbedUnimplementedTshdEventsServiceServer() {} +func (UnimplementedTshdEventsServiceServer) testEmbeddedByValue() {} // UnsafeTshdEventsServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to TshdEventsServiceServer will @@ -211,6 +215,13 @@ type UnsafeTshdEventsServiceServer interface { } func RegisterTshdEventsServiceServer(s grpc.ServiceRegistrar, srv TshdEventsServiceServer) { + // If the following call pancis, it indicates UnimplementedTshdEventsServiceServer 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(&TshdEventsService_ServiceDesc, srv) } diff --git a/gen/proto/go/teleport/lib/teleterm/vnet/v1/vnet_service_grpc.pb.go b/gen/proto/go/teleport/lib/teleterm/vnet/v1/vnet_service_grpc.pb.go index 2987dd3c82811..a3b9e909eeaa2 100644 --- a/gen/proto/go/teleport/lib/teleterm/vnet/v1/vnet_service_grpc.pb.go +++ b/gen/proto/go/teleport/lib/teleterm/vnet/v1/vnet_service_grpc.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/lib/teleterm/vnet/v1/vnet_service.proto @@ -31,8 +31,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 ( VnetService_Start_FullMethodName = "/teleport.lib.teleterm.vnet.v1.VnetService/Start" @@ -116,7 +116,7 @@ func (c *vnetServiceClient) GetBackgroundItemStatus(ctx context.Context, in *Get // VnetServiceServer is the server API for VnetService service. // All implementations must embed UnimplementedVnetServiceServer -// for forward compatibility +// for forward compatibility. // // VnetService provides methods to manage a VNet instance. type VnetServiceServer interface { @@ -140,9 +140,12 @@ type VnetServiceServer interface { mustEmbedUnimplementedVnetServiceServer() } -// UnimplementedVnetServiceServer must be embedded to have forward compatible implementations. -type UnimplementedVnetServiceServer struct { -} +// UnimplementedVnetServiceServer 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 UnimplementedVnetServiceServer struct{} func (UnimplementedVnetServiceServer) Start(context.Context, *StartRequest) (*StartResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Start not implemented") @@ -157,6 +160,7 @@ func (UnimplementedVnetServiceServer) GetBackgroundItemStatus(context.Context, * return nil, status.Errorf(codes.Unimplemented, "method GetBackgroundItemStatus not implemented") } func (UnimplementedVnetServiceServer) mustEmbedUnimplementedVnetServiceServer() {} +func (UnimplementedVnetServiceServer) testEmbeddedByValue() {} // UnsafeVnetServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to VnetServiceServer will @@ -166,6 +170,13 @@ type UnsafeVnetServiceServer interface { } func RegisterVnetServiceServer(s grpc.ServiceRegistrar, srv VnetServiceServer) { + // If the following call pancis, it indicates UnimplementedVnetServiceServer 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(&VnetService_ServiceDesc, srv) } diff --git a/lib/multiplexer/test/ping_grpc.pb.go b/lib/multiplexer/test/ping_grpc.pb.go index 4c882f1a4aae8..33e683f0f58af 100644 --- a/lib/multiplexer/test/ping_grpc.pb.go +++ b/lib/multiplexer/test/ping_grpc.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc (unknown) // source: teleport/lib/multiplexer/test/ping.proto @@ -32,8 +32,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 ( Pinger_Ping_FullMethodName = "/teleport.lib.multiplexer.test.Pinger/Ping" @@ -68,7 +68,7 @@ func (c *pingerClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallO // PingerServer is the server API for Pinger service. // All implementations must embed UnimplementedPingerServer -// for forward compatibility +// for forward compatibility. // // Pinger is a service used in tests type PingerServer interface { @@ -76,14 +76,18 @@ type PingerServer interface { mustEmbedUnimplementedPingerServer() } -// UnimplementedPingerServer must be embedded to have forward compatible implementations. -type UnimplementedPingerServer struct { -} +// UnimplementedPingerServer 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 UnimplementedPingerServer struct{} func (UnimplementedPingerServer) Ping(context.Context, *Request) (*Response, error) { return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") } func (UnimplementedPingerServer) mustEmbedUnimplementedPingerServer() {} +func (UnimplementedPingerServer) testEmbeddedByValue() {} // UnsafePingerServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PingerServer will @@ -93,6 +97,13 @@ type UnsafePingerServer interface { } func RegisterPingerServer(s grpc.ServiceRegistrar, srv PingerServer) { + // If the following call pancis, it indicates UnimplementedPingerServer 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(&Pinger_ServiceDesc, srv) } From 72c26f250b31e14c5db269e803bc2f2e5d7259ed Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Mon, 29 Jul 2024 11:47:49 -0300 Subject: [PATCH 3/3] Fix various Unimplemented{Service}Server pointer embeds --- api/client/client_test.go | 4 ++-- api/client/joinservice_test.go | 2 +- api/client/proxy/client_test.go | 7 +++---- integration/proxy/teleterm_test.go | 2 +- lib/joinserver/joinserver.go | 2 +- lib/teleterm/daemon/daemon_test.go | 2 +- lib/uds/cred_test.go | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/api/client/client_test.go b/api/client/client_test.go index 788ad961a8d8f..76181279b1e1a 100644 --- a/api/client/client_test.go +++ b/api/client/client_test.go @@ -46,7 +46,7 @@ func TestMain(m *testing.M) { } type pingService struct { - *proto.UnimplementedAuthServiceServer + proto.UnimplementedAuthServiceServer userAgentFromLastCallValue atomic.Value } @@ -192,7 +192,7 @@ func TestWaitForConnectionReady(t *testing.T) { } type listResourcesService struct { - *proto.UnimplementedAuthServiceServer + proto.UnimplementedAuthServiceServer } func (s *listResourcesService) ListResources(ctx context.Context, req *proto.ListResourcesRequest) (*proto.ListResourcesResponse, error) { diff --git a/api/client/joinservice_test.go b/api/client/joinservice_test.go index a8a8509866d67..c0068f4be47f7 100644 --- a/api/client/joinservice_test.go +++ b/api/client/joinservice_test.go @@ -34,7 +34,7 @@ import ( ) type mockJoinServiceServer struct { - *proto.UnimplementedJoinServiceServer + proto.UnimplementedJoinServiceServer registerUsingTPMMethod func(srv proto.JoinService_RegisterUsingTPMMethodServer) error } diff --git a/api/client/proxy/client_test.go b/api/client/proxy/client_test.go index 7cb788e5e76af..6a1671aaf8f37 100644 --- a/api/client/proxy/client_test.go +++ b/api/client/proxy/client_test.go @@ -114,16 +114,15 @@ type fakeGRPCServer struct { } type fakeAuthServer struct { - *proto.UnimplementedAuthServiceServer + proto.UnimplementedAuthServiceServer listener net.Listener srv *grpc.Server } func newFakeAuthServer(t *testing.T, conn net.Conn) *fakeAuthServer { f := &fakeAuthServer{ - listener: newOneShotListener(conn), - UnimplementedAuthServiceServer: &proto.UnimplementedAuthServiceServer{}, - srv: grpc.NewServer(), + listener: newOneShotListener(conn), + srv: grpc.NewServer(), } t.Cleanup(f.Stop) diff --git a/integration/proxy/teleterm_test.go b/integration/proxy/teleterm_test.go index 8608111886aec..e6172b0e3e664 100644 --- a/integration/proxy/teleterm_test.go +++ b/integration/proxy/teleterm_test.go @@ -297,7 +297,7 @@ func testGatewayCertRenewal(ctx context.Context, t *testing.T, params gatewayCer } type mockTSHDEventsService struct { - *api.UnimplementedTshdEventsServiceServer + api.UnimplementedTshdEventsServiceServer t *testing.T tc *libclient.TeleportClient diff --git a/lib/joinserver/joinserver.go b/lib/joinserver/joinserver.go index 1fee288d99fae..5e56bd39e9c84 100644 --- a/lib/joinserver/joinserver.go +++ b/lib/joinserver/joinserver.go @@ -62,7 +62,7 @@ type joinServiceClient interface { // server. On the Auth Server, this is passed to auth.ServerWithRoles and // through to auth.Server to be handled. type JoinServiceGRPCServer struct { - *proto.UnimplementedJoinServiceServer + proto.UnimplementedJoinServiceServer joinServiceClient joinServiceClient clock clockwork.Clock diff --git a/lib/teleterm/daemon/daemon_test.go b/lib/teleterm/daemon/daemon_test.go index 4046043d805d0..827a9c13cba9c 100644 --- a/lib/teleterm/daemon/daemon_test.go +++ b/lib/teleterm/daemon/daemon_test.go @@ -581,7 +581,7 @@ func TestImportantModalSemaphore(t *testing.T) { } type mockTSHDEventsService struct { - *api.UnimplementedTshdEventsServiceServer + api.UnimplementedTshdEventsServiceServer reloginErr error reloginCount atomic.Uint32 sendNotificationCount atomic.Uint32 diff --git a/lib/uds/cred_test.go b/lib/uds/cred_test.go index fa296ef847e70..d496758db3bbd 100644 --- a/lib/uds/cred_test.go +++ b/lib/uds/cred_test.go @@ -76,7 +76,7 @@ func TestGetCreds(t *testing.T) { } type service struct { - *machineidv1.UnimplementedBotServiceServer + machineidv1.UnimplementedBotServiceServer lastCalledCreds *Creds }