diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs --- a/services/identity/src/client_service.rs +++ b/services/identity/src/client_service.rs @@ -11,6 +11,7 @@ use tonic::Response; use tracing::{debug, error, info, warn}; +use crate::comm_service::tunnelbroker; // Workspace crate imports use crate::config::CONFIG; use crate::constants::{error_types, tonic_status_messages}; @@ -1341,8 +1342,7 @@ "Attempting to terminate Tunnelbroker sessions for devices: {:?}", device_ids.as_slice() ); - let result = - crate::tunnelbroker::terminate_device_sessions(&device_ids).await; + let result = tunnelbroker::terminate_device_sessions(&device_ids).await; consume_error(result); }); } diff --git a/services/identity/src/backup.rs b/services/identity/src/comm_service/backup.rs rename from services/identity/src/backup.rs rename to services/identity/src/comm_service/backup.rs diff --git a/services/identity/src/tunnelbroker.rs b/services/identity/src/comm_service/tunnelbroker.rs rename from services/identity/src/tunnelbroker.rs rename to services/identity/src/comm_service/tunnelbroker.rs diff --git a/services/identity/src/database/device_list.rs b/services/identity/src/database/device_list.rs --- a/services/identity/src/database/device_list.rs +++ b/services/identity/src/database/device_list.rs @@ -20,6 +20,7 @@ use crate::{ client_service::FlattenedDeviceKeyUpload, + comm_service::tunnelbroker, constants::{ devices_table::{self, *}, error_types, USERS_TABLE, USERS_TABLE_DEVICELIST_TIMESTAMP_ATTRIBUTE_NAME, @@ -1547,8 +1548,7 @@ "Attempting to delete Tunnelbroker data for device: {}", &device_id ); - let result = - crate::tunnelbroker::delete_devices_data(&[device_id]).await; + let result = tunnelbroker::delete_devices_data(&[device_id]).await; consume_error(result); }); } diff --git a/services/identity/src/database/one_time_keys.rs b/services/identity/src/database/one_time_keys.rs --- a/services/identity/src/database/one_time_keys.rs +++ b/services/identity/src/database/one_time_keys.rs @@ -17,6 +17,7 @@ use tracing::{debug, error, info, warn}; use crate::{ + comm_service::tunnelbroker, constants::{ error_types, MAX_ONE_TIME_KEYS, ONE_TIME_KEY_UPLOAD_LIMIT_PER_ACCOUNT, }, @@ -60,8 +61,7 @@ let device_id = device_id.to_string(); tokio::spawn(async move { debug!("Attempting to request more keys for device: {}", &device_id); - let result = - crate::tunnelbroker::send_refresh_keys_request(&device_id).await; + let result = tunnelbroker::send_refresh_keys_request(&device_id).await; consume_error(result); }); } diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs --- a/services/identity/src/grpc_services/authenticated.rs +++ b/services/identity/src/grpc_services/authenticated.rs @@ -1,5 +1,6 @@ use std::collections::{HashMap, HashSet}; +use crate::comm_service::{backup, tunnelbroker}; use crate::config::CONFIG; use crate::database::{DeviceListUpdate, PlatformDetails}; use crate::device_list::validation::DeviceListValidator; @@ -102,7 +103,7 @@ "Attempting to delete Tunnelbroker data for devices: {:?}", device_ids.as_slice() ); - let result = crate::tunnelbroker::delete_devices_data(&device_ids).await; + let result = tunnelbroker::delete_devices_data(&device_ids).await; consume_error(result); }); } @@ -401,8 +402,7 @@ ); let device_ids: Vec<&str> = device_list.device_ids.iter().map(AsRef::as_ref).collect(); - let result = - crate::tunnelbroker::send_device_list_update(&device_ids).await; + let result = tunnelbroker::send_device_list_update(&device_ids).await; consume_error(result); }); @@ -956,7 +956,7 @@ debug!("Attempting to delete Backup data for user: {}", &user_id); let (device_list_result, delete_backup_result) = tokio::join!( self.db_client.get_current_device_list(user_id), - crate::backup::delete_backup_user_data(user_id, &self.comm_auth_service) + backup::delete_backup_user_data(user_id, &self.comm_auth_service) ); let device_ids = device_list_result? @@ -969,7 +969,7 @@ "Attempting to delete Tunnelbroker data for devices: {:?}", device_ids ); - crate::tunnelbroker::delete_devices_data(&device_ids).await?; + tunnelbroker::delete_devices_data(&device_ids).await?; Ok(()) } diff --git a/services/identity/src/main.rs b/services/identity/src/main.rs --- a/services/identity/src/main.rs +++ b/services/identity/src/main.rs @@ -7,7 +7,6 @@ use tonic::transport::Server; use tonic_web::GrpcWebLayer; -mod backup; mod client_service; mod config; pub mod constants; @@ -29,9 +28,13 @@ mod siwe; mod sync_identity_search; mod token; -mod tunnelbroker; mod websockets; +mod comm_service { + pub mod backup; + pub mod tunnelbroker; +} + use constants::{COMM_SERVICES_USE_JSON_LOGS, IDENTITY_SERVICE_SOCKET_ADDR}; use cors::cors_layer; use keygen::generate_and_persist_keypair;