feat: add mimalloc dependency and update memory allocator; remove unused ASCII art
parent
ffd93a6b72
commit
3cbd0d5e22
|
@ -393,6 +393,7 @@ dependencies = [
|
|||
"clap",
|
||||
"figment",
|
||||
"futures",
|
||||
"mimalloc",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"serde",
|
||||
|
@ -757,6 +758,16 @@ version = "0.2.174"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||
|
||||
[[package]]
|
||||
name = "libmimalloc-sys"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf88cd67e9de251c1781dbe2f641a1a3ad66eaae831b8a2c38fbdc5ddae16d4d"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.8.0"
|
||||
|
@ -781,6 +792,15 @@ version = "2.7.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||
|
||||
[[package]]
|
||||
name = "mimalloc"
|
||||
version = "0.1.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1791cbe101e95af5764f06f20f6760521f7158f69dbf9d6baf941ee1bf6bc40"
|
||||
dependencies = [
|
||||
"libmimalloc-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.9"
|
||||
|
@ -955,7 +975,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"socket2",
|
||||
"tracing",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -4,6 +4,7 @@ version = "0.1.0"
|
|||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
mimalloc = { version = "*" }
|
||||
anyhow = "1.0"
|
||||
backon = "1"
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
|
|
|
@ -167,24 +167,7 @@ pub static TEST_MESSAGE_BODY: LazyLock<Value> = LazyLock::new(|| {
|
|||
})
|
||||
});
|
||||
|
||||
// ASCII art for Gemini
|
||||
pub const GEMINI_ASCII: &str = r#"
|
||||
______ _ _
|
||||
/ ____/___ ____ ___ (_)____ (_)
|
||||
/ / __ / _ \ / __ `__ \ / // __ \ / /
|
||||
/ /_/ // __// / / / / // // / / // /
|
||||
\____/ \___//_/ /_/ /_//_//_/ /_//_/
|
||||
"#;
|
||||
|
||||
// LazyLock for the application banner
|
||||
pub static BANNER: LazyLock<String> = LazyLock::new(|| {
|
||||
format!(
|
||||
"{}\n{}\nKey Checker - Configuration Status\n{}",
|
||||
GEMINI_ASCII,
|
||||
"=".repeat(42),
|
||||
"=".repeat(42)
|
||||
)
|
||||
});
|
||||
|
||||
fn default_api_host() -> Url {
|
||||
DEFAULT_CONFIG.api_host.clone()
|
||||
|
|
|
@ -2,4 +2,4 @@ mod basic_client;
|
|||
mod basic_config;
|
||||
|
||||
pub use basic_client::client_builder;
|
||||
pub use basic_config::{BANNER, KeyCheckerConfig, TEST_MESSAGE_BODY};
|
||||
pub use basic_config::{KeyCheckerConfig, TEST_MESSAGE_BODY};
|
||||
|
|
18
src/lib.rs
18
src/lib.rs
|
@ -1,5 +1,15 @@
|
|||
pub mod config;
|
||||
pub mod types;
|
||||
pub mod key_validator;
|
||||
pub mod adapters;
|
||||
pub mod validation;
|
||||
pub mod config;
|
||||
pub mod key_validator;
|
||||
pub mod types;
|
||||
pub mod validation;
|
||||
|
||||
// ASCII art for Gemini
|
||||
pub const BANNER: &str = r#"
|
||||
______ _ _
|
||||
/ ____/___ ____ ___ (_)____ (_)
|
||||
/ / __ / _ \ / __ `__ \ / // __ \ / /
|
||||
/ /_/ // __// / / / / // // / / // /
|
||||
\____/ \___//_/ /_/ /_//_//_/ /_//_/
|
||||
"#;
|
||||
|
||||
|
|
18
src/main.rs
18
src/main.rs
|
@ -1,7 +1,15 @@
|
|||
use anyhow::Result;
|
||||
use gemini_keychecker::adapters::load_keys;
|
||||
use gemini_keychecker::config::{BANNER, KeyCheckerConfig, client_builder};
|
||||
use gemini_keychecker::validation::ValidationService;
|
||||
use gemini_keychecker::{
|
||||
BANNER,
|
||||
adapters::load_keys,
|
||||
config::{KeyCheckerConfig, client_builder},
|
||||
validation::ValidationService,
|
||||
};
|
||||
|
||||
use mimalloc::MiMalloc;
|
||||
|
||||
#[global_allocator]
|
||||
static GLOBAL: MiMalloc = MiMalloc;
|
||||
|
||||
/// Main function - orchestrates the key validation process
|
||||
#[tokio::main]
|
||||
|
@ -9,8 +17,8 @@ async fn main() -> Result<()> {
|
|||
let config = KeyCheckerConfig::load_config().unwrap();
|
||||
|
||||
// Display banner and configuration status at startup
|
||||
println!("{}", *BANNER);
|
||||
println!("{}", config);
|
||||
println!("{BANNER}");
|
||||
println!("{config}");
|
||||
|
||||
let keys = load_keys(config.input_path.as_path())?;
|
||||
let client = client_builder(&config)?;
|
||||
|
|
Loading…
Reference in New Issue