1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
//! This is a library for working with anything related to gRPC communication on
//! the Minerva System. This includes the implementation of client and server
//! codes for each service, plus the DTOs representing messages sent to and from
//! remote procedure calls.
#![warn(clippy::all)]
#![warn(missing_docs)]
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use tonic::Request;
/// Returns the address of any request's sender. If non-existing, returns
/// and IPv4 address of `0.0.0.0`.
pub fn get_address<T>(req: &Request<T>) -> SocketAddr {
req.remote_addr()
.unwrap_or_else(|| SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0))
}
pub mod messages;
pub mod metadata;
pub mod products;
pub mod session;
pub mod user;