pub mod body;
pub use body::*;
pub mod compile;
pub use compile::compile;
pub mod config;
pub use config::{Env, EnvReader, LoadedConfig, ProcessEnv, load, scan_rules_dir};
pub mod conn_context;
pub use conn_context::*;
pub mod error;
pub use error::*;
pub mod fetch;
pub use fetch::*;
pub mod flow_ctx;
pub use flow_ctx::*;
pub mod flow_log;
pub use flow_log::*;
pub mod ir;
pub use ir::*;
pub mod l4;
pub use l4::*;
pub mod metadata;
pub use metadata::*;
pub mod middleware;
pub use middleware::*;
pub mod phase;
pub mod predicate;
pub use predicate::*;
pub mod protocol_detect;
pub use protocol_detect::*;
pub mod preset;
pub use preset::{PresetInvocation, RuleEntry, expand_invocation};
pub mod rule;
pub mod meta {
pub const DESCRIPTION: &str = "A compact programmable proxy engine";
pub const COPYRIGHT: &str = "Copyright (C) 2025 Canmi <t@canmi.icu>";
pub const HOMEPAGE: &str = "https://vane.canmi.app";
pub const REPOSITORY: &str = "https://github.com/canmi21/vane";
pub const LICENSE: &str = "MIT";
pub const LICENSE_URL: &str = "https://opensource.org/licenses/MIT";
}
pub mod version {
use std::fmt::Write as _;
use super::meta::{COPYRIGHT, DESCRIPTION, HOMEPAGE, LICENSE_URL, REPOSITORY};
pub struct BuildInfo {
pub version: &'static str,
pub commit: &'static str,
pub build_date: &'static str,
pub rustc: &'static str,
pub cargo: &'static str,
pub features: &'static [&'static str],
pub protocols: &'static [&'static str],
}
#[must_use]
pub fn format_version(info: &BuildInfo) -> String {
const WIDTH: usize = 12;
const INDENT: &str = " ";
let mut out = String::new();
let _ = writeln!(out);
let _ = writeln!(out, "{INDENT}Vane — {DESCRIPTION}");
let _ = writeln!(out);
let _ = writeln!(
out,
"{INDENT}{label:<WIDTH$}{version} ({commit} {date})",
label = "Built:",
version = info.version,
commit = info.commit,
date = info.build_date,
);
let _ = writeln!(out, "{INDENT}{label:<WIDTH$}{value}", label = "Rust:", value = info.rustc);
let _ = writeln!(out, "{INDENT}{label:<WIDTH$}{value}", label = "Cargo:", value = info.cargo);
if !info.features.is_empty() {
let _ = writeln!(
out,
"{INDENT}{label:<WIDTH$}{value}",
label = "Features:",
value = info.features.join(", "),
);
}
if !info.protocols.is_empty() {
let _ = writeln!(
out,
"{INDENT}{label:<WIDTH$}{value}",
label = "Protocols:",
value = info.protocols.join(", "),
);
}
let _ = writeln!(out);
let _ = writeln!(out, "{INDENT}{COPYRIGHT}");
let _ = writeln!(out);
let _ = writeln!(out, "{INDENT}Released under the MIT License without restriction.");
let _ = writeln!(out, "{INDENT}This software comes with ABSOLUTELY NO WARRANTY.");
let _ = writeln!(out);
let _ = writeln!(out, "{INDENT}{label:<WIDTH$}{HOMEPAGE}", label = "Homepage:");
let _ = writeln!(out, "{INDENT}{label:<WIDTH$}{REPOSITORY}", label = "Source:");
let _ = writeln!(out, "{INDENT}{label:<WIDTH$}{LICENSE_URL}", label = "License:");
let _ = writeln!(out);
out
}
}