diff --git a/api/proto/pb/auth.pb.go b/api/proto/pb/auth.pb.go index d42e94008..92d3f5cb0 100644 --- a/api/proto/pb/auth.pb.go +++ b/api/proto/pb/auth.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.21.12 +// protoc-gen-go v1.36.11 +// protoc v6.33.2 // source: proto/auth.proto package pb @@ -12,6 +12,7 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -22,20 +23,17 @@ const ( ) type AuthRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AuthRequest) Reset() { *x = AuthRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_auth_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AuthRequest) String() string { @@ -46,7 +44,7 @@ func (*AuthRequest) ProtoMessage() {} func (x *AuthRequest) ProtoReflect() protoreflect.Message { mi := &file_proto_auth_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -69,22 +67,19 @@ func (x *AuthRequest) GetToken() string { } type AuthReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` unknownFields protoimpl.UnknownFields - - Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` - Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` - ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + sizeCache protoimpl.SizeCache } func (x *AuthReply) Reset() { *x = AuthReply{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_auth_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_auth_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AuthReply) String() string { @@ -95,7 +90,7 @@ func (*AuthReply) ProtoMessage() {} func (x *AuthReply) ProtoReflect() protoreflect.Message { mi := &file_proto_auth_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -133,42 +128,37 @@ func (x *AuthReply) GetExpiresAt() *timestamppb.Timestamp { var File_proto_auth_proto protoreflect.FileDescriptor -var file_proto_auth_proto_rawDesc = []byte{ - 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x23, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x80, 0x01, 0x0a, 0x09, 0x41, 0x75, 0x74, - 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x12, 0x39, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x32, 0x32, 0x0a, 0x04, 0x41, - 0x75, 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x0c, 0x49, 0x73, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x7a, 0x65, 0x64, 0x12, 0x0c, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x0a, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, - 0x0a, 0x5a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} +const file_proto_auth_proto_rawDesc = "" + + "\n" + + "\x10proto/auth.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"#\n" + + "\vAuthRequest\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\"\x80\x01\n" + + "\tAuthReply\x12\x1e\n" + + "\n" + + "authorized\x18\x01 \x01(\bR\n" + + "authorized\x12\x18\n" + + "\asubject\x18\x02 \x01(\tR\asubject\x129\n" + + "\n" + + "expires_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\texpiresAt22\n" + + "\x04Auth\x12*\n" + + "\fIsAuthorized\x12\f.AuthRequest\x1a\n" + + ".AuthReply\"\x00B\n" + + "Z\bproto/pbb\x06proto3" var ( file_proto_auth_proto_rawDescOnce sync.Once - file_proto_auth_proto_rawDescData = file_proto_auth_proto_rawDesc + file_proto_auth_proto_rawDescData []byte ) func file_proto_auth_proto_rawDescGZIP() []byte { file_proto_auth_proto_rawDescOnce.Do(func() { - file_proto_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_auth_proto_rawDescData) + file_proto_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_auth_proto_rawDesc), len(file_proto_auth_proto_rawDesc))) }) return file_proto_auth_proto_rawDescData } var file_proto_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_proto_auth_proto_goTypes = []interface{}{ +var file_proto_auth_proto_goTypes = []any{ (*AuthRequest)(nil), // 0: AuthRequest (*AuthReply)(nil), // 1: AuthReply (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp @@ -189,37 +179,11 @@ func file_proto_auth_proto_init() { if File_proto_auth_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_proto_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_auth_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_auth_proto_rawDesc), len(file_proto_auth_proto_rawDesc)), NumEnums: 0, NumMessages: 2, NumExtensions: 0, @@ -230,7 +194,6 @@ func file_proto_auth_proto_init() { MessageInfos: file_proto_auth_proto_msgTypes, }.Build() File_proto_auth_proto = out.File - file_proto_auth_proto_rawDesc = nil file_proto_auth_proto_goTypes = nil file_proto_auth_proto_depIdxs = nil } diff --git a/api/proto/pb/auth_grpc.pb.go b/api/proto/pb/auth_grpc.pb.go index 9e6d264d1..6896a3e50 100644 --- a/api/proto/pb/auth_grpc.pb.go +++ b/api/proto/pb/auth_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.12 +// - protoc-gen-go-grpc v1.6.0 +// - protoc v6.33.2 // source: proto/auth.proto package pb @@ -15,8 +15,12 @@ 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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Auth_IsAuthorized_FullMethodName = "/Auth/IsAuthorized" +) // AuthClient is the client API for Auth service. // @@ -34,8 +38,9 @@ func NewAuthClient(cc grpc.ClientConnInterface) AuthClient { } func (c *authClient) IsAuthorized(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AuthReply) - err := c.cc.Invoke(ctx, "/Auth/IsAuthorized", in, out, opts...) + err := c.cc.Invoke(ctx, Auth_IsAuthorized_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -44,20 +49,24 @@ func (c *authClient) IsAuthorized(ctx context.Context, in *AuthRequest, opts ... // AuthServer is the server API for Auth service. // All implementations must embed UnimplementedAuthServer -// for forward compatibility +// for forward compatibility. type AuthServer interface { IsAuthorized(context.Context, *AuthRequest) (*AuthReply, error) mustEmbedUnimplementedAuthServer() } -// UnimplementedAuthServer must be embedded to have forward compatible implementations. -type UnimplementedAuthServer struct { -} +// UnimplementedAuthServer 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 UnimplementedAuthServer struct{} func (UnimplementedAuthServer) IsAuthorized(context.Context, *AuthRequest) (*AuthReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsAuthorized not implemented") + return nil, status.Error(codes.Unimplemented, "method IsAuthorized not implemented") } func (UnimplementedAuthServer) mustEmbedUnimplementedAuthServer() {} +func (UnimplementedAuthServer) testEmbeddedByValue() {} // UnsafeAuthServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AuthServer will @@ -67,6 +76,13 @@ type UnsafeAuthServer interface { } func RegisterAuthServer(s grpc.ServiceRegistrar, srv AuthServer) { + // If the following call panics, it indicates UnimplementedAuthServer 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(&Auth_ServiceDesc, srv) } @@ -80,7 +96,7 @@ func _Auth_IsAuthorized_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Auth/IsAuthorized", + FullMethod: Auth_IsAuthorized_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AuthServer).IsAuthorized(ctx, req.(*AuthRequest)) diff --git a/api/proto/pb/vehicle.pb.go b/api/proto/pb/vehicle.pb.go index 14b1c6d1f..3b78bc870 100644 --- a/api/proto/pb/vehicle.pb.go +++ b/api/proto/pb/vehicle.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.21.12 +// protoc-gen-go v1.36.11 +// protoc v6.33.2 // source: proto/vehicle.proto package pb @@ -11,6 +11,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -21,22 +22,19 @@ const ( ) type NewRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Config map[string]string `protobuf:"bytes,3,rep,name=config,proto3" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Config map[string]string `protobuf:"bytes,3,rep,name=config,proto3" json:"config,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + sizeCache protoimpl.SizeCache } func (x *NewRequest) Reset() { *x = NewRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_vehicle_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_vehicle_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NewRequest) String() string { @@ -47,7 +45,7 @@ func (*NewRequest) ProtoMessage() {} func (x *NewRequest) ProtoReflect() protoreflect.Message { mi := &file_proto_vehicle_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -84,20 +82,17 @@ func (x *NewRequest) GetConfig() map[string]string { } type NewReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + VehicleId int64 `protobuf:"varint,1,opt,name=vehicle_id,json=vehicleId,proto3" json:"vehicle_id,omitempty"` unknownFields protoimpl.UnknownFields - - VehicleId int64 `protobuf:"varint,1,opt,name=vehicle_id,json=vehicleId,proto3" json:"vehicle_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *NewReply) Reset() { *x = NewReply{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_vehicle_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_vehicle_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *NewReply) String() string { @@ -108,7 +103,7 @@ func (*NewReply) ProtoMessage() {} func (x *NewReply) ProtoReflect() protoreflect.Message { mi := &file_proto_vehicle_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -131,21 +126,18 @@ func (x *NewReply) GetVehicleId() int64 { } type SoCRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + VehicleId int64 `protobuf:"varint,2,opt,name=vehicle_id,json=vehicleId,proto3" json:"vehicle_id,omitempty"` unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - VehicleId int64 `protobuf:"varint,2,opt,name=vehicle_id,json=vehicleId,proto3" json:"vehicle_id,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SoCRequest) Reset() { *x = SoCRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_vehicle_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_vehicle_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SoCRequest) String() string { @@ -156,7 +148,7 @@ func (*SoCRequest) ProtoMessage() {} func (x *SoCRequest) ProtoReflect() protoreflect.Message { mi := &file_proto_vehicle_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -186,20 +178,17 @@ func (x *SoCRequest) GetVehicleId() int64 { } type SoCReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Soc float64 `protobuf:"fixed64,1,opt,name=soc,proto3" json:"soc,omitempty"` unknownFields protoimpl.UnknownFields - - Soc float64 `protobuf:"fixed64,1,opt,name=soc,proto3" json:"soc,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SoCReply) Reset() { *x = SoCReply{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_vehicle_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_vehicle_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SoCReply) String() string { @@ -210,7 +199,7 @@ func (*SoCReply) ProtoMessage() {} func (x *SoCReply) ProtoReflect() protoreflect.Message { mi := &file_proto_vehicle_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -234,50 +223,46 @@ func (x *SoCReply) GetSoc() float64 { var File_proto_vehicle_proto protoreflect.FileDescriptor -var file_proto_vehicle_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa2, 0x01, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2f, - 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, - 0x39, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x29, 0x0a, 0x08, 0x4e, 0x65, - 0x77, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x65, 0x68, 0x69, 0x63, 0x6c, - 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x76, 0x65, 0x68, 0x69, - 0x63, 0x6c, 0x65, 0x49, 0x64, 0x22, 0x41, 0x0a, 0x0a, 0x53, 0x6f, 0x43, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x65, 0x68, - 0x69, 0x63, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x76, - 0x65, 0x68, 0x69, 0x63, 0x6c, 0x65, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x08, 0x53, 0x6f, 0x43, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x6f, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x03, 0x73, 0x6f, 0x63, 0x32, 0x4b, 0x0a, 0x07, 0x56, 0x65, 0x68, 0x69, 0x63, 0x6c, - 0x65, 0x12, 0x1f, 0x0a, 0x03, 0x4e, 0x65, 0x77, 0x12, 0x0b, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x09, 0x2e, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x1f, 0x0a, 0x03, 0x53, 0x6f, 0x43, 0x12, 0x0b, 0x2e, 0x53, 0x6f, 0x43, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x09, 0x2e, 0x53, 0x6f, 0x43, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_proto_vehicle_proto_rawDesc = "" + + "\n" + + "\x13proto/vehicle.proto\"\xa2\x01\n" + + "\n" + + "NewRequest\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12/\n" + + "\x06config\x18\x03 \x03(\v2\x17.NewRequest.ConfigEntryR\x06config\x1a9\n" + + "\vConfigEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\")\n" + + "\bNewReply\x12\x1d\n" + + "\n" + + "vehicle_id\x18\x01 \x01(\x03R\tvehicleId\"A\n" + + "\n" + + "SoCRequest\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\x12\x1d\n" + + "\n" + + "vehicle_id\x18\x02 \x01(\x03R\tvehicleId\"\x1c\n" + + "\bSoCReply\x12\x10\n" + + "\x03soc\x18\x01 \x01(\x01R\x03soc2K\n" + + "\aVehicle\x12\x1f\n" + + "\x03New\x12\v.NewRequest\x1a\t.NewReply\"\x00\x12\x1f\n" + + "\x03SoC\x12\v.SoCRequest\x1a\t.SoCReply\"\x00B\n" + + "Z\bproto/pbb\x06proto3" var ( file_proto_vehicle_proto_rawDescOnce sync.Once - file_proto_vehicle_proto_rawDescData = file_proto_vehicle_proto_rawDesc + file_proto_vehicle_proto_rawDescData []byte ) func file_proto_vehicle_proto_rawDescGZIP() []byte { file_proto_vehicle_proto_rawDescOnce.Do(func() { - file_proto_vehicle_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_vehicle_proto_rawDescData) + file_proto_vehicle_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_vehicle_proto_rawDesc), len(file_proto_vehicle_proto_rawDesc))) }) return file_proto_vehicle_proto_rawDescData } var file_proto_vehicle_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_proto_vehicle_proto_goTypes = []interface{}{ +var file_proto_vehicle_proto_goTypes = []any{ (*NewRequest)(nil), // 0: NewRequest (*NewReply)(nil), // 1: NewReply (*SoCRequest)(nil), // 2: SoCRequest @@ -302,61 +287,11 @@ func file_proto_vehicle_proto_init() { if File_proto_vehicle_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_proto_vehicle_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NewRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_vehicle_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NewReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_vehicle_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SoCRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_vehicle_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SoCReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_vehicle_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_vehicle_proto_rawDesc), len(file_proto_vehicle_proto_rawDesc)), NumEnums: 0, NumMessages: 5, NumExtensions: 0, @@ -367,7 +302,6 @@ func file_proto_vehicle_proto_init() { MessageInfos: file_proto_vehicle_proto_msgTypes, }.Build() File_proto_vehicle_proto = out.File - file_proto_vehicle_proto_rawDesc = nil file_proto_vehicle_proto_goTypes = nil file_proto_vehicle_proto_depIdxs = nil } diff --git a/api/proto/pb/vehicle_grpc.pb.go b/api/proto/pb/vehicle_grpc.pb.go index b945043ac..a2f41af4a 100644 --- a/api/proto/pb/vehicle_grpc.pb.go +++ b/api/proto/pb/vehicle_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.12 +// - protoc-gen-go-grpc v1.6.0 +// - protoc v6.33.2 // source: proto/vehicle.proto package pb @@ -15,8 +15,13 @@ 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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Vehicle_New_FullMethodName = "/Vehicle/New" + Vehicle_SoC_FullMethodName = "/Vehicle/SoC" +) // VehicleClient is the client API for Vehicle service. // @@ -35,8 +40,9 @@ func NewVehicleClient(cc grpc.ClientConnInterface) VehicleClient { } func (c *vehicleClient) New(ctx context.Context, in *NewRequest, opts ...grpc.CallOption) (*NewReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(NewReply) - err := c.cc.Invoke(ctx, "/Vehicle/New", in, out, opts...) + err := c.cc.Invoke(ctx, Vehicle_New_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -44,8 +50,9 @@ func (c *vehicleClient) New(ctx context.Context, in *NewRequest, opts ...grpc.Ca } func (c *vehicleClient) SoC(ctx context.Context, in *SoCRequest, opts ...grpc.CallOption) (*SoCReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SoCReply) - err := c.cc.Invoke(ctx, "/Vehicle/SoC", in, out, opts...) + err := c.cc.Invoke(ctx, Vehicle_SoC_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -54,24 +61,28 @@ func (c *vehicleClient) SoC(ctx context.Context, in *SoCRequest, opts ...grpc.Ca // VehicleServer is the server API for Vehicle service. // All implementations must embed UnimplementedVehicleServer -// for forward compatibility +// for forward compatibility. type VehicleServer interface { New(context.Context, *NewRequest) (*NewReply, error) SoC(context.Context, *SoCRequest) (*SoCReply, error) mustEmbedUnimplementedVehicleServer() } -// UnimplementedVehicleServer must be embedded to have forward compatible implementations. -type UnimplementedVehicleServer struct { -} +// UnimplementedVehicleServer 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 UnimplementedVehicleServer struct{} func (UnimplementedVehicleServer) New(context.Context, *NewRequest) (*NewReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method New not implemented") + return nil, status.Error(codes.Unimplemented, "method New not implemented") } func (UnimplementedVehicleServer) SoC(context.Context, *SoCRequest) (*SoCReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method SoC not implemented") + return nil, status.Error(codes.Unimplemented, "method SoC not implemented") } func (UnimplementedVehicleServer) mustEmbedUnimplementedVehicleServer() {} +func (UnimplementedVehicleServer) testEmbeddedByValue() {} // UnsafeVehicleServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to VehicleServer will @@ -81,6 +92,13 @@ type UnsafeVehicleServer interface { } func RegisterVehicleServer(s grpc.ServiceRegistrar, srv VehicleServer) { + // If the following call panics, it indicates UnimplementedVehicleServer 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(&Vehicle_ServiceDesc, srv) } @@ -94,7 +112,7 @@ func _Vehicle_New_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Vehicle/New", + FullMethod: Vehicle_New_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VehicleServer).New(ctx, req.(*NewRequest)) @@ -112,7 +130,7 @@ func _Vehicle_SoC_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Vehicle/SoC", + FullMethod: Vehicle_SoC_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(VehicleServer).SoC(ctx, req.(*SoCRequest)) diff --git a/api/proto/pb/victron.pb.go b/api/proto/pb/victron.pb.go index fa4d17af6..d7ca2d357 100644 --- a/api/proto/pb/victron.pb.go +++ b/api/proto/pb/victron.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 +// protoc-gen-go v1.36.11 +// protoc v6.33.2 // source: proto/victron.proto package pb @@ -11,6 +11,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -21,23 +22,20 @@ const ( ) type VictronRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + ProductId string `protobuf:"bytes,1,opt,name=productId,proto3" json:"productId,omitempty"` + VrmId string `protobuf:"bytes,2,opt,name=vrmId,proto3" json:"vrmId,omitempty"` + Serial string `protobuf:"bytes,3,opt,name=serial,proto3" json:"serial,omitempty"` + Board string `protobuf:"bytes,4,opt,name=board,proto3" json:"board,omitempty"` unknownFields protoimpl.UnknownFields - - ProductId string `protobuf:"bytes,1,opt,name=productId,proto3" json:"productId,omitempty"` - VrmId string `protobuf:"bytes,2,opt,name=vrmId,proto3" json:"vrmId,omitempty"` - Serial string `protobuf:"bytes,3,opt,name=serial,proto3" json:"serial,omitempty"` - Board string `protobuf:"bytes,4,opt,name=board,proto3" json:"board,omitempty"` + sizeCache protoimpl.SizeCache } func (x *VictronRequest) Reset() { *x = VictronRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_victron_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_victron_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *VictronRequest) String() string { @@ -48,7 +46,7 @@ func (*VictronRequest) ProtoMessage() {} func (x *VictronRequest) ProtoReflect() protoreflect.Message { mi := &file_proto_victron_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -92,21 +90,18 @@ func (x *VictronRequest) GetBoard() string { } type VictronReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` unknownFields protoimpl.UnknownFields - - Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"` - Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + sizeCache protoimpl.SizeCache } func (x *VictronReply) Reset() { *x = VictronReply{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_victron_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_proto_victron_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *VictronReply) String() string { @@ -117,7 +112,7 @@ func (*VictronReply) ProtoMessage() {} func (x *VictronReply) ProtoReflect() protoreflect.Message { mi := &file_proto_victron_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -148,42 +143,37 @@ func (x *VictronReply) GetSubject() string { var File_proto_victron_proto protoreflect.FileDescriptor -var file_proto_victron_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x69, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x72, 0x0a, 0x0e, 0x56, 0x69, 0x63, 0x74, 0x72, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, - 0x63, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, - 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x72, 0x6d, 0x49, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x72, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, - 0x65, 0x72, 0x69, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x72, - 0x69, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x22, 0x48, 0x0a, 0x0c, 0x56, 0x69, 0x63, - 0x74, 0x72, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x32, 0x3c, 0x0a, 0x07, 0x56, 0x69, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x12, 0x31, - 0x0a, 0x0d, 0x49, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x0f, 0x2e, 0x56, 0x69, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x0d, 0x2e, 0x56, 0x69, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_proto_victron_proto_rawDesc = "" + + "\n" + + "\x13proto/victron.proto\"r\n" + + "\x0eVictronRequest\x12\x1c\n" + + "\tproductId\x18\x01 \x01(\tR\tproductId\x12\x14\n" + + "\x05vrmId\x18\x02 \x01(\tR\x05vrmId\x12\x16\n" + + "\x06serial\x18\x03 \x01(\tR\x06serial\x12\x14\n" + + "\x05board\x18\x04 \x01(\tR\x05board\"H\n" + + "\fVictronReply\x12\x1e\n" + + "\n" + + "authorized\x18\x01 \x01(\bR\n" + + "authorized\x12\x18\n" + + "\asubject\x18\x02 \x01(\tR\asubject2<\n" + + "\aVictron\x121\n" + + "\rIsValidDevice\x12\x0f.VictronRequest\x1a\r.VictronReply\"\x00B\n" + + "Z\bproto/pbb\x06proto3" var ( file_proto_victron_proto_rawDescOnce sync.Once - file_proto_victron_proto_rawDescData = file_proto_victron_proto_rawDesc + file_proto_victron_proto_rawDescData []byte ) func file_proto_victron_proto_rawDescGZIP() []byte { file_proto_victron_proto_rawDescOnce.Do(func() { - file_proto_victron_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_victron_proto_rawDescData) + file_proto_victron_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_victron_proto_rawDesc), len(file_proto_victron_proto_rawDesc))) }) return file_proto_victron_proto_rawDescData } var file_proto_victron_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_proto_victron_proto_goTypes = []interface{}{ +var file_proto_victron_proto_goTypes = []any{ (*VictronRequest)(nil), // 0: VictronRequest (*VictronReply)(nil), // 1: VictronReply } @@ -202,37 +192,11 @@ func file_proto_victron_proto_init() { if File_proto_victron_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_proto_victron_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VictronRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_victron_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VictronReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_victron_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_victron_proto_rawDesc), len(file_proto_victron_proto_rawDesc)), NumEnums: 0, NumMessages: 2, NumExtensions: 0, @@ -243,7 +207,6 @@ func file_proto_victron_proto_init() { MessageInfos: file_proto_victron_proto_msgTypes, }.Build() File_proto_victron_proto = out.File - file_proto_victron_proto_rawDesc = nil file_proto_victron_proto_goTypes = nil file_proto_victron_proto_depIdxs = nil } diff --git a/api/proto/pb/victron_grpc.pb.go b/api/proto/pb/victron_grpc.pb.go index c93af9444..9c22d2cb6 100644 --- a/api/proto/pb/victron_grpc.pb.go +++ b/api/proto/pb/victron_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v5.26.1 +// - protoc-gen-go-grpc v1.6.0 +// - protoc v6.33.2 // source: proto/victron.proto package pb @@ -15,8 +15,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.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Victron_IsValidDevice_FullMethodName = "/Victron/IsValidDevice" @@ -38,8 +38,9 @@ func NewVictronClient(cc grpc.ClientConnInterface) VictronClient { } func (c *victronClient) IsValidDevice(ctx context.Context, in *VictronRequest, opts ...grpc.CallOption) (*VictronReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VictronReply) - err := c.cc.Invoke(ctx, Victron_IsValidDevice_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Victron_IsValidDevice_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -48,20 +49,24 @@ func (c *victronClient) IsValidDevice(ctx context.Context, in *VictronRequest, o // VictronServer is the server API for Victron service. // All implementations must embed UnimplementedVictronServer -// for forward compatibility +// for forward compatibility. type VictronServer interface { IsValidDevice(context.Context, *VictronRequest) (*VictronReply, error) mustEmbedUnimplementedVictronServer() } -// UnimplementedVictronServer must be embedded to have forward compatible implementations. -type UnimplementedVictronServer struct { -} +// UnimplementedVictronServer 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 UnimplementedVictronServer struct{} func (UnimplementedVictronServer) IsValidDevice(context.Context, *VictronRequest) (*VictronReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsValidDevice not implemented") + return nil, status.Error(codes.Unimplemented, "method IsValidDevice not implemented") } func (UnimplementedVictronServer) mustEmbedUnimplementedVictronServer() {} +func (UnimplementedVictronServer) testEmbeddedByValue() {} // UnsafeVictronServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to VictronServer will @@ -71,6 +76,13 @@ type UnsafeVictronServer interface { } func RegisterVictronServer(s grpc.ServiceRegistrar, srv VictronServer) { + // If the following call panics, it indicates UnimplementedVictronServer 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(&Victron_ServiceDesc, srv) }