make 'src/common' actually common
- delete no longer needed lookup_ipv4 - delete no longer needed path_exists - move gen_tls_client_config from common to client - move gen_tls_server_config from common to server
This commit is contained in:
parent
f2c4d46ffe
commit
66af765def
|
@ -5,7 +5,7 @@ use tokio::net::TcpStream;
|
|||
use tokio_rustls::webpki::DNSNameRef;
|
||||
use tokio_rustls::TlsConnector;
|
||||
|
||||
use crate::common::misc::gen_tls_client_config::gen_tls_client_config;
|
||||
use crate::client::network::gen_tls_client_config::gen_tls_client_config;
|
||||
|
||||
use rand::distributions::Alphanumeric;
|
||||
use rand::{thread_rng, Rng};
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
pub mod cmd;
|
||||
pub mod handle_data;
|
||||
pub mod gen_tls_client_config;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
use std::net::{SocketAddr, ToSocketAddrs};
|
||||
|
||||
/// Looks up a string hostname and port, returns a SocketAddr represnting that hostname and port.
|
||||
///
|
||||
/// Arguments:
|
||||
/// host - hostname to search.
|
||||
/// port - port on hostname to search.
|
||||
///
|
||||
/// Returns: SocketAddr
|
||||
pub fn lookup_ipv4(host: &str, port: u16) -> SocketAddr {
|
||||
let addrs = (host, port).to_socket_addrs().unwrap();
|
||||
for addr in addrs {
|
||||
if let SocketAddr::V4(_) = addr {
|
||||
return addr;
|
||||
}
|
||||
}
|
||||
|
||||
unreachable!("Cannot lookup address");
|
||||
}
|
|
@ -1,7 +1,3 @@
|
|||
pub mod assert_msg;
|
||||
pub mod gen_tls_client_config;
|
||||
pub mod gen_tls_server_config;
|
||||
pub mod lookup_ipv4;
|
||||
pub mod path_exists;
|
||||
pub mod return_flags;
|
||||
pub mod servers_pool;
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
/// Simple copy-pasta for checking for path existance.
|
||||
///
|
||||
/// Used in gen_log() and libtrader_init_log(). Checks if path is exists or not.
|
||||
///
|
||||
/// Arguments:
|
||||
/// path - The path to check
|
||||
pub fn path_exists(path: &str) -> bool {
|
||||
std::fs::metadata(path).is_ok()
|
||||
}
|
|
@ -9,7 +9,7 @@ use tokio_rustls::TlsAcceptor;
|
|||
|
||||
use std::net::ToSocketAddrs;
|
||||
|
||||
use crate::common::misc::gen_tls_server_config::gen_tls_server_config;
|
||||
use crate::server::network::gen_tls_server_config::gen_tls_server_config;
|
||||
|
||||
use crate::server::db::config::{DB_ACC_PASS, DB_ACC_USER};
|
||||
use crate::server::db::initializer::db_connect;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
pub mod cmd;
|
||||
pub mod handle_data;
|
||||
pub mod jwt_wrapper;
|
||||
pub mod gen_tls_server_config;
|
||||
|
|
Loading…
Reference in New Issue