- add: utils library

- add: packet-service to handle game client packets
- fix: health check for database-service
- fix: health check for auth-service
This commit is contained in:
2024-12-09 23:10:26 -05:00
parent 20e86dd117
commit e5c961d1b4
25 changed files with 1176 additions and 120 deletions

View File

@@ -0,0 +1,24 @@
use crate::auth::auth_service_client::AuthServiceClient;
use crate::auth::{LoginRequest, LoginResponse};
use tonic::transport::Channel;
pub struct AuthClient {
client: AuthServiceClient<Channel>,
}
impl AuthClient {
pub async fn connect(endpoint: &str) -> Result<Self, Box<dyn std::error::Error>> {
let client = AuthServiceClient::connect(endpoint.to_string()).await?;
Ok(AuthClient { client })
}
pub async fn login(&mut self, username: &str, password: &str) -> Result<LoginResponse, Box<dyn std::error::Error + Send + Sync>> {
let request = LoginRequest {
username: username.to_string(),
password: password.to_string(),
};
let response = self.client.login(request).await?;
Ok(response.into_inner())
}
}