2025-06-20 08:42:02 +09:00
|
|
|
use std::{any::type_name, collections::HashMap, net::{IpAddr, Ipv4Addr}, path::{Path, PathBuf}, sync::LazyLock};
|
2025-05-30 09:26:47 +09:00
|
|
|
|
2025-06-22 11:29:44 +09:00
|
|
|
use crate::{config::{P2pConfig, PartialP2pConfig, StorageConfig}, error::Error };
|
2025-06-05 09:23:24 +09:00
|
|
|
use libp2p::{swarm::SwarmEvent, Multiaddr, PeerId};
|
2025-06-10 07:47:37 +09:00
|
|
|
use sea_orm::{prelude::*, Database};
|
|
|
|
use sea_orm_migration::MigratorTrait;
|
2025-06-22 11:29:44 +09:00
|
|
|
use tokio::sync::{OnceCell, RwLock, RwLockReadGuard, RwLockWriteGuard};
|
2025-05-25 17:19:37 +09:00
|
|
|
|
2025-06-20 07:28:51 +09:00
|
|
|
mod config;
|
2025-07-05 10:30:55 +09:00
|
|
|
pub use config::*;
|
2025-06-19 07:24:44 +09:00
|
|
|
mod database_connection;
|
2025-06-20 07:28:51 +09:00
|
|
|
pub use database_connection::*;
|
2025-06-17 07:20:24 +09:00
|
|
|
use uuid::{ContextV7, Timestamp, Uuid};
|
|
|
|
|
|
|
|
pub fn generate_uuid() -> Uuid {
|
|
|
|
Uuid::new_v7(Timestamp::now(ContextV7::new()))
|
|
|
|
}
|
2025-05-25 17:19:37 +09:00
|
|
|
|
2025-06-01 15:18:17 +09:00
|
|
|
pub static DEFAULT_LISTEN_IPS: &[IpAddr] = &[IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))];
|
|
|
|
|
2025-05-30 09:26:47 +09:00
|
|
|
|
2025-06-20 08:42:02 +09:00
|
|
|
fn uninitialized_message<T>(var: T) -> String {
|
|
|
|
format!("{} is uninitialized!", &stringify!(var))
|
|
|
|
}
|