diff --git a/internal/gen/controller/servers/services/session_service.pb.go b/internal/gen/controller/servers/services/session_service.pb.go index ba28f8bce..101b92969 100644 --- a/internal/gen/controller/servers/services/session_service.pb.go +++ b/internal/gen/controller/servers/services/session_service.pb.go @@ -421,7 +421,7 @@ func (x *AuthorizeConnectionResponse) GetConnectionsLeft() int32 { return 0 } -type ConnectSessionRequest struct { +type ConnectConnectionRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -433,8 +433,8 @@ type ConnectSessionRequest struct { EndpointTcpPort uint32 `protobuf:"varint,50,opt,name=endpoint_tcp_port,json=endpointTcpPort,proto3" json:"endpoint_tcp_port,omitempty"` } -func (x *ConnectSessionRequest) Reset() { - *x = ConnectSessionRequest{} +func (x *ConnectConnectionRequest) Reset() { + *x = ConnectConnectionRequest{} if protoimpl.UnsafeEnabled { mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -442,13 +442,13 @@ func (x *ConnectSessionRequest) Reset() { } } -func (x *ConnectSessionRequest) String() string { +func (x *ConnectConnectionRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ConnectSessionRequest) ProtoMessage() {} +func (*ConnectConnectionRequest) ProtoMessage() {} -func (x *ConnectSessionRequest) ProtoReflect() protoreflect.Message { +func (x *ConnectConnectionRequest) ProtoReflect() protoreflect.Message { mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -460,47 +460,47 @@ func (x *ConnectSessionRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ConnectSessionRequest.ProtoReflect.Descriptor instead. -func (*ConnectSessionRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ConnectConnectionRequest.ProtoReflect.Descriptor instead. +func (*ConnectConnectionRequest) Descriptor() ([]byte, []int) { return file_controller_servers_services_v1_session_service_proto_rawDescGZIP(), []int{6} } -func (x *ConnectSessionRequest) GetConnectionId() string { +func (x *ConnectConnectionRequest) GetConnectionId() string { if x != nil { return x.ConnectionId } return "" } -func (x *ConnectSessionRequest) GetClientTcpAddress() string { +func (x *ConnectConnectionRequest) GetClientTcpAddress() string { if x != nil { return x.ClientTcpAddress } return "" } -func (x *ConnectSessionRequest) GetClientTcpPort() uint32 { +func (x *ConnectConnectionRequest) GetClientTcpPort() uint32 { if x != nil { return x.ClientTcpPort } return 0 } -func (x *ConnectSessionRequest) GetEndpointTcpAddress() string { +func (x *ConnectConnectionRequest) GetEndpointTcpAddress() string { if x != nil { return x.EndpointTcpAddress } return "" } -func (x *ConnectSessionRequest) GetEndpointTcpPort() uint32 { +func (x *ConnectConnectionRequest) GetEndpointTcpPort() uint32 { if x != nil { return x.EndpointTcpPort } return 0 } -type ConnectSessionResponse struct { +type ConnectConnectionResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -508,8 +508,8 @@ type ConnectSessionResponse struct { Status CONNECTIONSTATUS `protobuf:"varint,10,opt,name=status,proto3,enum=controller.servers.services.v1.CONNECTIONSTATUS" json:"status,omitempty"` } -func (x *ConnectSessionResponse) Reset() { - *x = ConnectSessionResponse{} +func (x *ConnectConnectionResponse) Reset() { + *x = ConnectConnectionResponse{} if protoimpl.UnsafeEnabled { mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -517,13 +517,13 @@ func (x *ConnectSessionResponse) Reset() { } } -func (x *ConnectSessionResponse) String() string { +func (x *ConnectConnectionResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ConnectSessionResponse) ProtoMessage() {} +func (*ConnectConnectionResponse) ProtoMessage() {} -func (x *ConnectSessionResponse) ProtoReflect() protoreflect.Message { +func (x *ConnectConnectionResponse) ProtoReflect() protoreflect.Message { mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -535,18 +535,238 @@ func (x *ConnectSessionResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ConnectSessionResponse.ProtoReflect.Descriptor instead. -func (*ConnectSessionResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ConnectConnectionResponse.ProtoReflect.Descriptor instead. +func (*ConnectConnectionResponse) Descriptor() ([]byte, []int) { return file_controller_servers_services_v1_session_service_proto_rawDescGZIP(), []int{7} } -func (x *ConnectSessionResponse) GetStatus() CONNECTIONSTATUS { +func (x *ConnectConnectionResponse) GetStatus() CONNECTIONSTATUS { if x != nil { return x.Status } return CONNECTIONSTATUS_CONNECTIONSTATUS_UNSPECIFIED } +type CloseConnectionRequestData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConnectionId string `protobuf:"bytes,10,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + BytesUp uint64 `protobuf:"varint,20,opt,name=bytes_up,json=bytesUp,proto3" json:"bytes_up,omitempty"` + BytesDown uint64 `protobuf:"varint,30,opt,name=bytes_down,json=bytesDown,proto3" json:"bytes_down,omitempty"` + Reason string `protobuf:"bytes,40,opt,name=reason,proto3" json:"reason,omitempty"` +} + +func (x *CloseConnectionRequestData) Reset() { + *x = CloseConnectionRequestData{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloseConnectionRequestData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseConnectionRequestData) ProtoMessage() {} + +func (x *CloseConnectionRequestData) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseConnectionRequestData.ProtoReflect.Descriptor instead. +func (*CloseConnectionRequestData) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_session_service_proto_rawDescGZIP(), []int{8} +} + +func (x *CloseConnectionRequestData) GetConnectionId() string { + if x != nil { + return x.ConnectionId + } + return "" +} + +func (x *CloseConnectionRequestData) GetBytesUp() uint64 { + if x != nil { + return x.BytesUp + } + return 0 +} + +func (x *CloseConnectionRequestData) GetBytesDown() uint64 { + if x != nil { + return x.BytesDown + } + return 0 +} + +func (x *CloseConnectionRequestData) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +type CloseConnectionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CloseRequestData []*CloseConnectionRequestData `protobuf:"bytes,10,rep,name=close_request_data,json=closeRequestData,proto3" json:"close_request_data,omitempty"` +} + +func (x *CloseConnectionRequest) Reset() { + *x = CloseConnectionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloseConnectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseConnectionRequest) ProtoMessage() {} + +func (x *CloseConnectionRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseConnectionRequest.ProtoReflect.Descriptor instead. +func (*CloseConnectionRequest) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_session_service_proto_rawDescGZIP(), []int{9} +} + +func (x *CloseConnectionRequest) GetCloseRequestData() []*CloseConnectionRequestData { + if x != nil { + return x.CloseRequestData + } + return nil +} + +type CloseConnectionResponseData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ConnectionId string `protobuf:"bytes,10,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Status CONNECTIONSTATUS `protobuf:"varint,20,opt,name=status,proto3,enum=controller.servers.services.v1.CONNECTIONSTATUS" json:"status,omitempty"` +} + +func (x *CloseConnectionResponseData) Reset() { + *x = CloseConnectionResponseData{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloseConnectionResponseData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseConnectionResponseData) ProtoMessage() {} + +func (x *CloseConnectionResponseData) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseConnectionResponseData.ProtoReflect.Descriptor instead. +func (*CloseConnectionResponseData) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_session_service_proto_rawDescGZIP(), []int{10} +} + +func (x *CloseConnectionResponseData) GetConnectionId() string { + if x != nil { + return x.ConnectionId + } + return "" +} + +func (x *CloseConnectionResponseData) GetStatus() CONNECTIONSTATUS { + if x != nil { + return x.Status + } + return CONNECTIONSTATUS_CONNECTIONSTATUS_UNSPECIFIED +} + +type CloseConnectionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CloseResponseData []*CloseConnectionResponseData `protobuf:"bytes,10,rep,name=close_response_data,json=closeResponseData,proto3" json:"close_response_data,omitempty"` +} + +func (x *CloseConnectionResponse) Reset() { + *x = CloseConnectionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloseConnectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseConnectionResponse) ProtoMessage() {} + +func (x *CloseConnectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_servers_services_v1_session_service_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseConnectionResponse.ProtoReflect.Descriptor instead. +func (*CloseConnectionResponse) Descriptor() ([]byte, []int) { + return file_controller_servers_services_v1_session_service_proto_rawDescGZIP(), []int{11} +} + +func (x *CloseConnectionResponse) GetCloseResponseData() []*CloseConnectionResponseData { + if x != nil { + return x.CloseResponseData + } + return nil +} + var File_controller_servers_services_v1_session_service_proto protoreflect.FileDescriptor var file_controller_servers_services_v1_session_service_proto_rawDesc = []byte{ @@ -632,69 +852,113 @@ var file_controller_servers_services_v1_session_service_proto_rawDesc = []byte{ 0x53, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x6c, 0x65, 0x66, 0x74, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x4c, 0x65, 0x66, 0x74, 0x22, 0xf0, 0x01, 0x0a, 0x15, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, - 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x63, - 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x63, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x63, 0x70, 0x5f, - 0x70, 0x6f, 0x72, 0x74, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x54, 0x63, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x30, 0x0a, 0x14, 0x65, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x74, 0x63, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x54, 0x63, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x65, - 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x74, 0x63, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, - 0x18, 0x32, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x54, 0x63, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x62, 0x0a, 0x16, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x48, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x4c, 0x65, 0x66, 0x74, 0x22, 0xf3, 0x01, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x5f, 0x74, 0x63, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x14, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x10, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x63, 0x70, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x74, + 0x63, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x63, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x30, 0x0a, 0x14, + 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x74, 0x63, 0x70, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x65, 0x6e, 0x64, 0x70, + 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x63, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2a, + 0x0a, 0x11, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x74, 0x63, 0x70, 0x5f, 0x70, + 0x6f, 0x72, 0x74, 0x18, 0x32, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x65, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x54, 0x63, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x65, 0x0a, 0x19, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, + 0x49, 0x4f, 0x4e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x22, 0x93, 0x01, 0x0a, 0x1a, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, + 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x75, + 0x70, 0x18, 0x14, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x62, 0x79, 0x74, 0x65, 0x73, 0x55, 0x70, + 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x18, 0x1e, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x62, 0x79, 0x74, 0x65, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x12, + 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x82, 0x01, 0x0a, 0x16, 0x43, 0x6c, 0x6f, 0x73, + 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x68, 0x0a, 0x12, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3a, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x73, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x61, 0x74, 0x61, 0x22, 0x8c, 0x01, 0x0a, + 0x1b, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x0d, + 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x48, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x54, 0x41, - 0x54, 0x55, 0x53, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0xae, 0x04, 0x0a, 0x0e, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7e, - 0x0a, 0x0d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x84, - 0x01, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x54, 0x55, 0x53, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x86, 0x01, 0x0a, 0x17, + 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x13, 0x63, 0x6c, 0x6f, 0x73, 0x65, + 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x61, 0x74, + 0x61, 0x52, 0x11, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x44, 0x61, 0x74, 0x61, 0x32, 0xbe, 0x05, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7e, 0x0a, 0x0d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, + 0x70, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x84, 0x01, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x90, + 0x01, 0x0a, 0x13, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, + 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x8a, 0x01, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x39, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x84, + 0x01, 0x0a, 0x0f, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x63, 0x74, 0x69, - 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x90, 0x01, 0x0a, 0x13, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3a, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x3b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x81, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x51, 0x5a, 0x4f, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, - 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x6f, 0x73, + 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x51, 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, + 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -709,7 +973,7 @@ func file_controller_servers_services_v1_session_service_proto_rawDescGZIP() []b return file_controller_servers_services_v1_session_service_proto_rawDescData } -var file_controller_servers_services_v1_session_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_controller_servers_services_v1_session_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_controller_servers_services_v1_session_service_proto_goTypes = []interface{}{ (*LookupSessionRequest)(nil), // 0: controller.servers.services.v1.LookupSessionRequest (*LookupSessionResponse)(nil), // 1: controller.servers.services.v1.LookupSessionResponse @@ -717,34 +981,43 @@ var file_controller_servers_services_v1_session_service_proto_goTypes = []interf (*ActivateSessionResponse)(nil), // 3: controller.servers.services.v1.ActivateSessionResponse (*AuthorizeConnectionRequest)(nil), // 4: controller.servers.services.v1.AuthorizeConnectionRequest (*AuthorizeConnectionResponse)(nil), // 5: controller.servers.services.v1.AuthorizeConnectionResponse - (*ConnectSessionRequest)(nil), // 6: controller.servers.services.v1.ConnectSessionRequest - (*ConnectSessionResponse)(nil), // 7: controller.servers.services.v1.ConnectSessionResponse - (*targets.SessionAuthorizationData)(nil), // 8: controller.api.resources.targets.v1.SessionAuthorizationData - (*timestamp.Timestamp)(nil), // 9: google.protobuf.Timestamp - (SESSIONSTATUS)(0), // 10: controller.servers.services.v1.SESSIONSTATUS - (CONNECTIONSTATUS)(0), // 11: controller.servers.services.v1.CONNECTIONSTATUS + (*ConnectConnectionRequest)(nil), // 6: controller.servers.services.v1.ConnectConnectionRequest + (*ConnectConnectionResponse)(nil), // 7: controller.servers.services.v1.ConnectConnectionResponse + (*CloseConnectionRequestData)(nil), // 8: controller.servers.services.v1.CloseConnectionRequestData + (*CloseConnectionRequest)(nil), // 9: controller.servers.services.v1.CloseConnectionRequest + (*CloseConnectionResponseData)(nil), // 10: controller.servers.services.v1.CloseConnectionResponseData + (*CloseConnectionResponse)(nil), // 11: controller.servers.services.v1.CloseConnectionResponse + (*targets.SessionAuthorizationData)(nil), // 12: controller.api.resources.targets.v1.SessionAuthorizationData + (*timestamp.Timestamp)(nil), // 13: google.protobuf.Timestamp + (SESSIONSTATUS)(0), // 14: controller.servers.services.v1.SESSIONSTATUS + (CONNECTIONSTATUS)(0), // 15: controller.servers.services.v1.CONNECTIONSTATUS } var file_controller_servers_services_v1_session_service_proto_depIdxs = []int32{ - 8, // 0: controller.servers.services.v1.LookupSessionResponse.authorization:type_name -> controller.api.resources.targets.v1.SessionAuthorizationData - 9, // 1: controller.servers.services.v1.LookupSessionResponse.expiration:type_name -> google.protobuf.Timestamp - 10, // 2: controller.servers.services.v1.LookupSessionResponse.status:type_name -> controller.servers.services.v1.SESSIONSTATUS - 10, // 3: controller.servers.services.v1.ActivateSessionRequest.status:type_name -> controller.servers.services.v1.SESSIONSTATUS - 10, // 4: controller.servers.services.v1.ActivateSessionResponse.status:type_name -> controller.servers.services.v1.SESSIONSTATUS - 11, // 5: controller.servers.services.v1.AuthorizeConnectionResponse.status:type_name -> controller.servers.services.v1.CONNECTIONSTATUS - 11, // 6: controller.servers.services.v1.ConnectSessionResponse.status:type_name -> controller.servers.services.v1.CONNECTIONSTATUS - 0, // 7: controller.servers.services.v1.SessionService.LookupSession:input_type -> controller.servers.services.v1.LookupSessionRequest - 2, // 8: controller.servers.services.v1.SessionService.ActivateSession:input_type -> controller.servers.services.v1.ActivateSessionRequest - 4, // 9: controller.servers.services.v1.SessionService.AuthorizeConnection:input_type -> controller.servers.services.v1.AuthorizeConnectionRequest - 6, // 10: controller.servers.services.v1.SessionService.ConnectSession:input_type -> controller.servers.services.v1.ConnectSessionRequest - 1, // 11: controller.servers.services.v1.SessionService.LookupSession:output_type -> controller.servers.services.v1.LookupSessionResponse - 3, // 12: controller.servers.services.v1.SessionService.ActivateSession:output_type -> controller.servers.services.v1.ActivateSessionResponse - 5, // 13: controller.servers.services.v1.SessionService.AuthorizeConnection:output_type -> controller.servers.services.v1.AuthorizeConnectionResponse - 7, // 14: controller.servers.services.v1.SessionService.ConnectSession:output_type -> controller.servers.services.v1.ConnectSessionResponse - 11, // [11:15] is the sub-list for method output_type - 7, // [7:11] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 12, // 0: controller.servers.services.v1.LookupSessionResponse.authorization:type_name -> controller.api.resources.targets.v1.SessionAuthorizationData + 13, // 1: controller.servers.services.v1.LookupSessionResponse.expiration:type_name -> google.protobuf.Timestamp + 14, // 2: controller.servers.services.v1.LookupSessionResponse.status:type_name -> controller.servers.services.v1.SESSIONSTATUS + 14, // 3: controller.servers.services.v1.ActivateSessionRequest.status:type_name -> controller.servers.services.v1.SESSIONSTATUS + 14, // 4: controller.servers.services.v1.ActivateSessionResponse.status:type_name -> controller.servers.services.v1.SESSIONSTATUS + 15, // 5: controller.servers.services.v1.AuthorizeConnectionResponse.status:type_name -> controller.servers.services.v1.CONNECTIONSTATUS + 15, // 6: controller.servers.services.v1.ConnectConnectionResponse.status:type_name -> controller.servers.services.v1.CONNECTIONSTATUS + 8, // 7: controller.servers.services.v1.CloseConnectionRequest.close_request_data:type_name -> controller.servers.services.v1.CloseConnectionRequestData + 15, // 8: controller.servers.services.v1.CloseConnectionResponseData.status:type_name -> controller.servers.services.v1.CONNECTIONSTATUS + 10, // 9: controller.servers.services.v1.CloseConnectionResponse.close_response_data:type_name -> controller.servers.services.v1.CloseConnectionResponseData + 0, // 10: controller.servers.services.v1.SessionService.LookupSession:input_type -> controller.servers.services.v1.LookupSessionRequest + 2, // 11: controller.servers.services.v1.SessionService.ActivateSession:input_type -> controller.servers.services.v1.ActivateSessionRequest + 4, // 12: controller.servers.services.v1.SessionService.AuthorizeConnection:input_type -> controller.servers.services.v1.AuthorizeConnectionRequest + 6, // 13: controller.servers.services.v1.SessionService.ConnectConnection:input_type -> controller.servers.services.v1.ConnectConnectionRequest + 9, // 14: controller.servers.services.v1.SessionService.CloseConnection:input_type -> controller.servers.services.v1.CloseConnectionRequest + 1, // 15: controller.servers.services.v1.SessionService.LookupSession:output_type -> controller.servers.services.v1.LookupSessionResponse + 3, // 16: controller.servers.services.v1.SessionService.ActivateSession:output_type -> controller.servers.services.v1.ActivateSessionResponse + 5, // 17: controller.servers.services.v1.SessionService.AuthorizeConnection:output_type -> controller.servers.services.v1.AuthorizeConnectionResponse + 7, // 18: controller.servers.services.v1.SessionService.ConnectConnection:output_type -> controller.servers.services.v1.ConnectConnectionResponse + 11, // 19: controller.servers.services.v1.SessionService.CloseConnection:output_type -> controller.servers.services.v1.CloseConnectionResponse + 15, // [15:20] is the sub-list for method output_type + 10, // [10:15] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_controller_servers_services_v1_session_service_proto_init() } @@ -827,7 +1100,7 @@ func file_controller_servers_services_v1_session_service_proto_init() { } } file_controller_servers_services_v1_session_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConnectSessionRequest); i { + switch v := v.(*ConnectConnectionRequest); i { case 0: return &v.state case 1: @@ -839,7 +1112,55 @@ func file_controller_servers_services_v1_session_service_proto_init() { } } file_controller_servers_services_v1_session_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ConnectSessionResponse); i { + switch v := v.(*ConnectConnectionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_session_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloseConnectionRequestData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_session_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloseConnectionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_session_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloseConnectionResponseData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_servers_services_v1_session_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloseConnectionResponse); i { case 0: return &v.state case 1: @@ -857,7 +1178,7 @@ func file_controller_servers_services_v1_session_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_controller_servers_services_v1_session_service_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, @@ -890,8 +1211,10 @@ type SessionServiceClient interface { ActivateSession(ctx context.Context, in *ActivateSessionRequest, opts ...grpc.CallOption) (*ActivateSessionResponse, error) // AuthorizeConnection allows a worker to activate a session on a controller. AuthorizeConnection(ctx context.Context, in *AuthorizeConnectionRequest, opts ...grpc.CallOption) (*AuthorizeConnectionResponse, error) - // ConnectSession updates a connection and causes a state transition - ConnectSession(ctx context.Context, in *ConnectSessionRequest, opts ...grpc.CallOption) (*ConnectSessionResponse, error) + // ConnectConnection updates a connection to set it to connected + ConnectConnection(ctx context.Context, in *ConnectConnectionRequest, opts ...grpc.CallOption) (*ConnectConnectionResponse, error) + // CloseConnections updates a connection to set it to closed + CloseConnection(ctx context.Context, in *CloseConnectionRequest, opts ...grpc.CallOption) (*CloseConnectionResponse, error) } type sessionServiceClient struct { @@ -929,9 +1252,18 @@ func (c *sessionServiceClient) AuthorizeConnection(ctx context.Context, in *Auth return out, nil } -func (c *sessionServiceClient) ConnectSession(ctx context.Context, in *ConnectSessionRequest, opts ...grpc.CallOption) (*ConnectSessionResponse, error) { - out := new(ConnectSessionResponse) - err := c.cc.Invoke(ctx, "/controller.servers.services.v1.SessionService/ConnectSession", in, out, opts...) +func (c *sessionServiceClient) ConnectConnection(ctx context.Context, in *ConnectConnectionRequest, opts ...grpc.CallOption) (*ConnectConnectionResponse, error) { + out := new(ConnectConnectionResponse) + err := c.cc.Invoke(ctx, "/controller.servers.services.v1.SessionService/ConnectConnection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sessionServiceClient) CloseConnection(ctx context.Context, in *CloseConnectionRequest, opts ...grpc.CallOption) (*CloseConnectionResponse, error) { + out := new(CloseConnectionResponse) + err := c.cc.Invoke(ctx, "/controller.servers.services.v1.SessionService/CloseConnection", in, out, opts...) if err != nil { return nil, err } @@ -947,8 +1279,10 @@ type SessionServiceServer interface { ActivateSession(context.Context, *ActivateSessionRequest) (*ActivateSessionResponse, error) // AuthorizeConnection allows a worker to activate a session on a controller. AuthorizeConnection(context.Context, *AuthorizeConnectionRequest) (*AuthorizeConnectionResponse, error) - // ConnectSession updates a connection and causes a state transition - ConnectSession(context.Context, *ConnectSessionRequest) (*ConnectSessionResponse, error) + // ConnectConnection updates a connection to set it to connected + ConnectConnection(context.Context, *ConnectConnectionRequest) (*ConnectConnectionResponse, error) + // CloseConnections updates a connection to set it to closed + CloseConnection(context.Context, *CloseConnectionRequest) (*CloseConnectionResponse, error) } // UnimplementedSessionServiceServer can be embedded to have forward compatible implementations. @@ -964,8 +1298,11 @@ func (*UnimplementedSessionServiceServer) ActivateSession(context.Context, *Acti func (*UnimplementedSessionServiceServer) AuthorizeConnection(context.Context, *AuthorizeConnectionRequest) (*AuthorizeConnectionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AuthorizeConnection not implemented") } -func (*UnimplementedSessionServiceServer) ConnectSession(context.Context, *ConnectSessionRequest) (*ConnectSessionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConnectSession not implemented") +func (*UnimplementedSessionServiceServer) ConnectConnection(context.Context, *ConnectConnectionRequest) (*ConnectConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConnectConnection not implemented") +} +func (*UnimplementedSessionServiceServer) CloseConnection(context.Context, *CloseConnectionRequest) (*CloseConnectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseConnection not implemented") } func RegisterSessionServiceServer(s *grpc.Server, srv SessionServiceServer) { @@ -1026,20 +1363,38 @@ func _SessionService_AuthorizeConnection_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } -func _SessionService_ConnectSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConnectSessionRequest) +func _SessionService_ConnectConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConnectConnectionRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SessionServiceServer).ConnectSession(ctx, in) + return srv.(SessionServiceServer).ConnectConnection(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/controller.servers.services.v1.SessionService/ConnectSession", + FullMethod: "/controller.servers.services.v1.SessionService/ConnectConnection", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SessionServiceServer).ConnectSession(ctx, req.(*ConnectSessionRequest)) + return srv.(SessionServiceServer).ConnectConnection(ctx, req.(*ConnectConnectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SessionService_CloseConnection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseConnectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SessionServiceServer).CloseConnection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/controller.servers.services.v1.SessionService/CloseConnection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SessionServiceServer).CloseConnection(ctx, req.(*CloseConnectionRequest)) } return interceptor(ctx, in, info, handler) } @@ -1061,8 +1416,12 @@ var _SessionService_serviceDesc = grpc.ServiceDesc{ Handler: _SessionService_AuthorizeConnection_Handler, }, { - MethodName: "ConnectSession", - Handler: _SessionService_ConnectSession_Handler, + MethodName: "ConnectConnection", + Handler: _SessionService_ConnectConnection_Handler, + }, + { + MethodName: "CloseConnection", + Handler: _SessionService_CloseConnection_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/internal/proto/local/controller/servers/services/v1/session_service.proto b/internal/proto/local/controller/servers/services/v1/session_service.proto index 4b8cdfa4c..a2f01c867 100644 --- a/internal/proto/local/controller/servers/services/v1/session_service.proto +++ b/internal/proto/local/controller/servers/services/v1/session_service.proto @@ -20,8 +20,11 @@ service SessionService { // AuthorizeConnection allows a worker to activate a session on a controller. rpc AuthorizeConnection(AuthorizeConnectionRequest) returns (AuthorizeConnectionResponse) {} - // ConnectSession updates a connection and causes a state transition - rpc ConnectSession(ConnectSessionRequest) returns (ConnectSessionResponse) {} + // ConnectConnection updates a connection to set it to connected + rpc ConnectConnection(ConnectConnectionRequest) returns (ConnectConnectionResponse) {} + + // CloseConnections updates a connection to set it to closed + rpc CloseConnection(CloseConnectionRequest) returns (CloseConnectionResponse) {} } message LookupSessionRequest { @@ -64,7 +67,7 @@ message AuthorizeConnectionResponse { int32 connections_left = 30; } -message ConnectSessionRequest { +message ConnectConnectionRequest { string connection_id = 10; string client_tcp_address = 20; uint32 client_tcp_port = 30; @@ -72,6 +75,26 @@ message ConnectSessionRequest { uint32 endpoint_tcp_port = 50; } -message ConnectSessionResponse { +message ConnectConnectionResponse { controller.servers.services.v1.CONNECTIONSTATUS status = 10; +} + +message CloseConnectionRequestData { + string connection_id = 10; + uint64 bytes_up = 20; + uint64 bytes_down = 30; + string reason = 40; +} + +message CloseConnectionRequest { + repeated CloseConnectionRequestData close_request_data = 10; +} + +message CloseConnectionResponseData { + string connection_id = 10; + controller.servers.services.v1.CONNECTIONSTATUS status = 20; +} + +message CloseConnectionResponse { + repeated CloseConnectionResponseData close_response_data = 10; } \ No newline at end of file diff --git a/internal/servers/controller/handlers/workers/worker_service.go b/internal/servers/controller/handlers/workers/worker_service.go index 76b99f75c..408c0ae48 100644 --- a/internal/servers/controller/handlers/workers/worker_service.go +++ b/internal/servers/controller/handlers/workers/worker_service.go @@ -235,7 +235,7 @@ func (ws *workerServiceServer) AuthorizeConnection(ctx context.Context, req *pbs return ret, nil } -func (ws *workerServiceServer) ConnectSession(ctx context.Context, req *pbs.ConnectSessionRequest) (*pbs.ConnectSessionResponse, error) { +func (ws *workerServiceServer) ConnectConnection(ctx context.Context, req *pbs.ConnectConnectionRequest) (*pbs.ConnectConnectionResponse, error) { ws.logger.Trace("got connection established information from worker", "connection_id", req.GetConnectionId()) sessRepo, err := ws.sessionRepoFn() @@ -243,7 +243,7 @@ func (ws *workerServiceServer) ConnectSession(ctx context.Context, req *pbs.Conn return nil, status.Errorf(codes.Internal, "error getting session repo: %v", err) } - connectionInfo, connStates, err := sessRepo.ConnectSession(ctx, session.ConnectWith{ + connectionInfo, connStates, err := sessRepo.ConnectConnection(ctx, session.ConnectWith{ ConnectionId: req.GetConnectionId(), ClientTcpAddress: req.GetClientTcpAddress(), ClientTcpPort: req.GetClientTcpPort(), @@ -254,12 +254,66 @@ func (ws *workerServiceServer) ConnectSession(ctx context.Context, req *pbs.Conn return nil, err } if connectionInfo == nil { - return nil, status.Error(codes.Internal, "Invalid authorize connection response.") + return nil, status.Error(codes.Internal, "Invalid connect connection response.") } - ret := &pbs.ConnectSessionResponse{ + ret := &pbs.ConnectConnectionResponse{ Status: connStates[0].Status.ProtoVal(), } return ret, nil } + +func (ws *workerServiceServer) CloseConnection(ctx context.Context, req *pbs.CloseConnectionRequest) (*pbs.CloseConnectionResponse, error) { + numCloses := len(req.GetCloseRequestData()) + if numCloses == 0 { + return &pbs.CloseConnectionResponse{}, nil + } + + closeWiths := make([]session.CloseWith, 0, numCloses) + closeIds := make([]string, 0, numCloses) + + for _, v := range req.GetCloseRequestData() { + closeIds = append(closeIds, v.GetConnectionId()) + closeWiths = append(closeWiths, session.CloseWith{ + ConnectionId: v.GetConnectionId(), + BytesUp: v.GetBytesUp(), + BytesDown: v.GetBytesDown(), + ClosedReason: session.ClosedReason(v.GetReason()), + }) + } + ws.logger.Trace("got connection close information from worker", "connection_ids", closeIds) + + sessRepo, err := ws.sessionRepoFn() + if err != nil { + return nil, status.Errorf(codes.Internal, "error getting session repo: %v", err) + } + + closeInfos, err := sessRepo.CloseConnections(ctx, closeWiths) + if err != nil { + return nil, err + } + if closeInfos == nil { + return nil, status.Error(codes.Internal, "Invalid close connection response.") + } + + closeData := make([]*pbs.CloseConnectionResponseData, 0, numCloses) + for _, v := range closeInfos { + if v.Connection == nil { + return nil, status.Errorf(codes.Internal, "No connection found while closing one of the connection IDs: %v", closeIds) + } + if len(v.ConnectionStates) == 0 { + return nil, status.Errorf(codes.Internal, "No connection states found while closing one of the connection IDs: %v", closeIds) + } + closeData = append(closeData, &pbs.CloseConnectionResponseData{ + ConnectionId: v.Connection.GetPublicId(), + Status: v.ConnectionStates[0].Status.ProtoVal(), + }) + } + + ret := &pbs.CloseConnectionResponse{ + CloseResponseData: closeData, + } + + return ret, nil +} diff --git a/internal/servers/worker/handler.go b/internal/servers/worker/handler.go index 2a59ab8cf..23e58d55d 100644 --- a/internal/servers/worker/handler.go +++ b/internal/servers/worker/handler.go @@ -137,6 +137,13 @@ func (w *Worker) handleProxy() http.HandlerFunc { return } + defer func() { + connectionId := ci.id + if err := w.closeConnections(r.Context(), si, []string{connectionId}); err != nil { + w.logger.Error("error marking connection closed", "error", err, "connection_id", connectionId) + } + }() + si.Lock() ci.connCtx = connCtx ci.connCancel = connCancel diff --git a/internal/servers/worker/session.go b/internal/servers/worker/session.go index b0881d9db..ba8385332 100644 --- a/internal/servers/worker/session.go +++ b/internal/servers/worker/session.go @@ -12,6 +12,7 @@ import ( "time" pbs "github.com/hashicorp/boundary/internal/gen/controller/servers/services" + "github.com/hashicorp/boundary/internal/session" ) const ( @@ -23,6 +24,7 @@ type connInfo struct { connCtx context.Context connCancel context.CancelFunc status pbs.CONNECTIONSTATUS + closeTime time.Time } type sessionInfo struct { @@ -174,7 +176,7 @@ func (w *Worker) authorizeConnection(ctx context.Context, sessionId string) (*co }, resp.GetConnectionsLeft(), nil } -func (w *Worker) connectSession(ctx context.Context, req *pbs.ConnectSessionRequest) (pbs.CONNECTIONSTATUS, error) { +func (w *Worker) connectConnection(ctx context.Context, req *pbs.ConnectConnectionRequest) (pbs.CONNECTIONSTATUS, error) { rawConn := w.controllerSessionConn.Load() if rawConn == nil { return pbs.CONNECTIONSTATUS_CONNECTIONSTATUS_UNSPECIFIED, errors.New("could not get a controller client") @@ -187,7 +189,7 @@ func (w *Worker) connectSession(ctx context.Context, req *pbs.ConnectSessionRequ return pbs.CONNECTIONSTATUS_CONNECTIONSTATUS_UNSPECIFIED, errors.New("controller client is nil") } - resp, err := conn.ConnectSession(ctx, req) + resp, err := conn.ConnectConnection(ctx, req) if err != nil { return pbs.CONNECTIONSTATUS_CONNECTIONSTATUS_UNSPECIFIED, err } @@ -198,3 +200,61 @@ func (w *Worker) connectSession(ctx context.Context, req *pbs.ConnectSessionRequ return resp.GetStatus(), nil } + +func (w *Worker) closeConnection(ctx context.Context, req *pbs.CloseConnectionRequest) (*pbs.CloseConnectionResponse, error) { + rawConn := w.controllerSessionConn.Load() + if rawConn == nil { + return nil, errors.New("could not get a controller client") + } + conn, ok := rawConn.(pbs.SessionServiceClient) + if !ok { + return nil, errors.New("could not cast atomic controller client to the real thing") + } + if conn == nil { + return nil, errors.New("controller client is nil") + } + + resp, err := conn.CloseConnection(ctx, req) + if err != nil { + return nil, err + } + if len(resp.GetCloseResponseData()) != len(req.GetCloseRequestData()) { + w.logger.Warn("mismatched number of states returned on connection closed", "expected", len(req.GetCloseRequestData()), "got", len(resp.GetCloseResponseData())) + } + + return resp, nil +} + +func (w *Worker) closeConnections(ctx context.Context, si *sessionInfo, connectionIds []string) error { + w.logger.Trace("marking connection as closed", "connection_ids", connectionIds) + + closeData := make([]*pbs.CloseConnectionRequestData, 0, len(connectionIds)) + for _, v := range connectionIds { + closeData = append(closeData, &pbs.CloseConnectionRequestData{ + ConnectionId: v, + Reason: session.UnknownReason.String(), + }) + } + closeInfo := &pbs.CloseConnectionRequest{ + CloseRequestData: closeData, + } + + connStatus, err := w.closeConnection(ctx, closeInfo) + if err != nil { + return err + } + closedIds := make([]string, 0, len(connStatus.GetCloseResponseData())) + si.Lock() + for _, v := range connStatus.GetCloseResponseData() { + closedIds = append(closedIds, v.GetConnectionId()) + if v.GetStatus() == pbs.CONNECTIONSTATUS_CONNECTIONSTATUS_CLOSED { + delete(si.connInfoMap, v.GetConnectionId()) + } else { + ci := si.connInfoMap[v.GetConnectionId()] + ci.status = v.GetStatus() + } + } + si.Unlock() + w.logger.Trace("connections successfully marked closed", "connection_ids", closedIds) + return nil +} diff --git a/internal/servers/worker/status.go b/internal/servers/worker/status.go index 9dba182ea..065eaf626 100644 --- a/internal/servers/worker/status.go +++ b/internal/servers/worker/status.go @@ -119,16 +119,20 @@ func (w *Worker) startStatusTicking(cancelCtx context.Context) { continue } si := siRaw.(*sessionInfo) + closeIds := make([]string, 0, len(result.GetJobsRequests())) si.Lock() si.status = sessInfo.GetStatus() if request.GetRequestType() == pbs.CHANGETYPE_CHANGETYPE_CANCEL { for k, v := range si.connInfoMap { v.connCancel() w.logger.Info("terminated connection", "session_id", sessionId, "connection_id", k) - v.status = pbs.CONNECTIONSTATUS_CONNECTIONSTATUS_CLOSED + closeIds = append(closeIds, k) } } si.Unlock() + if err := w.closeConnections(cancelCtx, si, closeIds); err != nil { + w.logger.Error("error marking connections closed", "error", err, "connection_ids", closeIds) + } } } } diff --git a/internal/servers/worker/tcp_proxy.go b/internal/servers/worker/tcp_proxy.go index de02461da..bf527e596 100644 --- a/internal/servers/worker/tcp_proxy.go +++ b/internal/servers/worker/tcp_proxy.go @@ -38,7 +38,7 @@ func (w *Worker) handleTcpProxyV1(connCtx context.Context, clientAddr *net.TCPAd tcpRemoteConn := remoteConn.(*net.TCPConn) endpointAddr := tcpRemoteConn.RemoteAddr().(*net.TCPAddr) - connectionInfo := &pbs.ConnectSessionRequest{ + connectionInfo := &pbs.ConnectConnectionRequest{ ConnectionId: connectionId, ClientTcpAddress: clientAddr.IP.String(), ClientTcpPort: uint32(clientAddr.Port), @@ -46,7 +46,7 @@ func (w *Worker) handleTcpProxyV1(connCtx context.Context, clientAddr *net.TCPAd EndpointTcpPort: uint32(endpointAddr.Port), } - connStatus, err := w.connectSession(connCtx, connectionInfo) + connStatus, err := w.connectConnection(connCtx, connectionInfo) if err != nil { w.logger.Error("error marking connection as connected", "error", err) conn.Close(websocket.StatusInternalError, "failed to mark connection as connected") diff --git a/internal/session/connection_closed_with.go b/internal/session/connection_closed_with.go index 51a3d65e5..f17b8f39a 100644 --- a/internal/session/connection_closed_with.go +++ b/internal/session/connection_closed_with.go @@ -9,20 +9,16 @@ import ( // CloseWith defines the boundary data that is saved in the repo when the // worker closes a connection between the client and the endpoint. type CloseWith struct { - ConnectionId string - ConnectionVersion uint32 - BytesUp uint64 - BytesDown uint64 - ClosedReason ClosedReason + ConnectionId string + BytesUp uint64 + BytesDown uint64 + ClosedReason ClosedReason } func (c CloseWith) validate() error { if c.ConnectionId == "" { return fmt.Errorf("missing connection id: %w", db.ErrInvalidParameter) } - if c.ConnectionVersion == 0 { - return fmt.Errorf("missing connection version: %w", db.ErrInvalidParameter) - } if c.ClosedReason.String() == "" { return fmt.Errorf("missing closed reason: %w", db.ErrInvalidParameter) } diff --git a/internal/session/connection_closed_with_test.go b/internal/session/connection_closed_with_test.go index c552df276..93a881295 100644 --- a/internal/session/connection_closed_with_test.go +++ b/internal/session/connection_closed_with_test.go @@ -14,11 +14,10 @@ func TestClosedWith_validate(t *testing.T) { session := TestDefaultSession(t, conn, wrapper, iamRepo) sessionConnection := TestConnection(t, conn, session.PublicId, "127.0.0.1", 22, "127.0.0.1", 2222) type fields struct { - ConnectionId string - ConnectionVersion uint32 - BytesUp uint64 - BytesDown uint64 - ClosedReason ClosedReason + ConnectionId string + BytesUp uint64 + BytesDown uint64 + ClosedReason ClosedReason } tests := []struct { name string @@ -28,27 +27,15 @@ func TestClosedWith_validate(t *testing.T) { { name: "valid", fields: fields{ - ConnectionId: sessionConnection.PublicId, - ConnectionVersion: sessionConnection.Version, - BytesUp: 1, - BytesDown: 2, - ClosedReason: ConnectionClosedByUser, + ConnectionId: sessionConnection.PublicId, + BytesUp: 1, + BytesDown: 2, + ClosedReason: ConnectionClosedByUser, }, }, { name: "missing-ConnectionId", fields: fields{ - ConnectionVersion: sessionConnection.Version, - BytesUp: 1, - BytesDown: 2, - ClosedReason: ConnectionClosedByUser, - }, - wantErr: true, - }, - { - name: "missing-ConnectionVersion", - fields: fields{ - ConnectionId: sessionConnection.PublicId, BytesUp: 1, BytesDown: 2, ClosedReason: ConnectionClosedByUser, @@ -58,10 +45,9 @@ func TestClosedWith_validate(t *testing.T) { { name: "missing-ClosedReason", fields: fields{ - ConnectionId: sessionConnection.PublicId, - ConnectionVersion: sessionConnection.Version, - BytesUp: 1, - BytesDown: 2, + ConnectionId: sessionConnection.PublicId, + BytesUp: 1, + BytesDown: 2, }, wantErr: true, }, @@ -69,11 +55,10 @@ func TestClosedWith_validate(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c := CloseWith{ - ConnectionId: tt.fields.ConnectionId, - ConnectionVersion: tt.fields.ConnectionVersion, - BytesUp: tt.fields.BytesUp, - BytesDown: tt.fields.BytesDown, - ClosedReason: tt.fields.ClosedReason, + ConnectionId: tt.fields.ConnectionId, + BytesUp: tt.fields.BytesUp, + BytesDown: tt.fields.BytesDown, + ClosedReason: tt.fields.ClosedReason, } if err := c.validate(); (err != nil) != tt.wantErr { t.Errorf("ClosedWith.validate() error = %v, wantErr %v", err, tt.wantErr) diff --git a/internal/session/repository_session.go b/internal/session/repository_session.go index a074464b4..66a3de601 100644 --- a/internal/session/repository_session.go +++ b/internal/session/repository_session.go @@ -409,8 +409,8 @@ func (r *Repository) sessionAuthzSummary(ctx context.Context, sessionId string) return info, nil } -// ConnectSession updates a connection in the repo with a state of "connected". -func (r *Repository) ConnectSession(ctx context.Context, c ConnectWith) (*Connection, []*ConnectionState, error) { +// ConnectConnection updates a connection in the repo with a state of "connected". +func (r *Repository) ConnectConnection(ctx context.Context, c ConnectWith) (*Connection, []*ConnectionState, error) { // ConnectWith.validate will check all the fields... if err := c.validate(); err != nil { return nil, nil, fmt.Errorf("connect session: %w", err) @@ -500,7 +500,6 @@ func (r *Repository) CloseConnections(ctx context.Context, closeWith []CloseWith &updateConnection, []string{"BytesUp", "BytesDown", "ClosedReason"}, nil, - db.WithVersion(&cw.ConnectionVersion), ) if err != nil { return fmt.Errorf("unable to update connection %s: %w", cw.ConnectionId, err) diff --git a/internal/session/repository_session_test.go b/internal/session/repository_session_test.go index 0df75c481..690eec033 100644 --- a/internal/session/repository_session_test.go +++ b/internal/session/repository_session_test.go @@ -491,7 +491,7 @@ func TestRepository_AuthorizeConnect(t *testing.T) { } } -func TestRepository_ConnectSession(t *testing.T) { +func TestRepository_ConnectConnection(t *testing.T) { t.Parallel() conn, _ := db.TestSetup(t, "postgres") rw := db.New(conn) @@ -581,7 +581,7 @@ func TestRepository_ConnectSession(t *testing.T) { t.Run(tt.name, func(t *testing.T) { assert, require := assert.New(t), require.New(t) - c, cs, err := repo.ConnectSession(context.Background(), tt.connectWith) + c, cs, err := repo.ConnectConnection(context.Background(), tt.connectWith) if tt.wantErr { require.Error(err) if tt.wantIsError != nil { @@ -704,11 +704,10 @@ func TestRepository_CloseConnections(t *testing.T) { c := TestConnection(t, conn, s.PublicId, "127.0.0.1", 22, "127.0.0.1", 2222) require.NoError(t, err) cw = append(cw, CloseWith{ - ConnectionId: c.PublicId, - ConnectionVersion: c.Version, - BytesUp: 1, - BytesDown: 2, - ClosedReason: ConnectionClosedByUser, + ConnectionId: c.PublicId, + BytesUp: 1, + BytesDown: 2, + ClosedReason: ConnectionClosedByUser, }) } return cw @@ -744,18 +743,6 @@ func TestRepository_CloseConnections(t *testing.T) { wantErr: true, wantIsError: db.ErrInvalidParameter, }, - { - name: "ConnectionVersion", - closeWith: func() []CloseWith { - cw := setupFn(2) - cw[1].ConnectionVersion = 0 - return cw - - }(), - reason: ClosedByUser, - wantErr: true, - wantIsError: db.ErrInvalidParameter, - }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {