24 lines
804 B
Rust
24 lines
804 B
Rust
use std::{any::type_name, collections::HashMap, net::{IpAddr, Ipv4Addr}, path::{Path, PathBuf}, sync::LazyLock};
|
|
|
|
use crate::{config::{P2pConfig, PartialP2pConfig, StorageConfig}, error::Error };
|
|
use libp2p::{swarm::SwarmEvent, Multiaddr, PeerId};
|
|
use sea_orm::{prelude::*, Database};
|
|
use sea_orm_migration::MigratorTrait;
|
|
use tokio::sync::{OnceCell, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
|
|
|
mod config;
|
|
pub use config::*;
|
|
mod database_connection;
|
|
pub use database_connection::*;
|
|
use uuid::{ContextV7, Timestamp, Uuid};
|
|
|
|
pub fn generate_uuid() -> Uuid {
|
|
Uuid::new_v7(Timestamp::now(ContextV7::new()))
|
|
}
|
|
|
|
pub static DEFAULT_LISTEN_IPS: &[IpAddr] = &[IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))];
|
|
|
|
|
|
fn uninitialized_message<T>(var: T) -> String {
|
|
format!("{} is uninitialized!", &stringify!(var))
|
|
}
|