Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install capnproto libssl-dev
sudo apt-get install capnproto libjemalloc-dev libssl-dev
- name: Install binutils
run: |
cargo install cargo-binutils@0.3.6
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install capnproto libc-ares-dev libssl-dev liblua5.4-dev
sudo apt-get install capnproto libjemalloc-dev libc-ares-dev libssl-dev liblua5.4-dev
- name: Install CA Certificates
run: |
sudo apt-get install ca-certificates
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install capnproto libc-ares-dev libssl-dev liblua5.4-dev
sudo apt-get install capnproto libjemalloc-dev libc-ares-dev libssl-dev liblua5.4-dev
- name: Install CA Certificates
run: |
sudo apt-get install ca-certificates
Expand Down Expand Up @@ -332,7 +332,7 @@ jobs:
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install capnproto
sudo apt-get install capnproto libjemalloc-dev
- name: Install binutils
run: |
cargo install cargo-binutils@0.3.6
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions lib/vey-build-env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ pub use basic::check_basic;

mod openssl;
pub use openssl::check_openssl;

mod rustls;
pub use rustls::check_rustls_provider;
38 changes: 7 additions & 31 deletions lib/vey-build-env/src/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,17 @@
use std::env;

pub fn check_openssl() {
println!("cargo:rustc-check-cfg=cfg(libressl)");
println!("cargo:rustc-check-cfg=cfg(tongsuo)");
println!("cargo:rustc-check-cfg=cfg(boringssl)");
println!("cargo:rustc-check-cfg=cfg(awslc)");

if env::var("DEP_OPENSSL_LIBRESSL").is_ok() {
println!("cargo:rustc-cfg=libressl");
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=LibreSSL");
return;
}

if env::var("DEP_OPENSSL_TONGSUO").is_ok() {
println!("cargo:rustc-cfg=tongsuo");
} else if env::var("DEP_OPENSSL_TONGSUO").is_ok() {
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=Tongsuo");
return;
}

if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
println!("cargo:rustc-cfg=boringssl");
} else if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=BoringSSL");
return;
}

if env::var("DEP_OPENSSL_AWSLC").is_ok() {
println!("cargo:rustc-cfg=awslc");
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC");
return;
}

if env::var("DEP_OPENSSL_AWSLC_FIPS").is_ok() {
println!("cargo:rustc-cfg=awslc");
println!("cargo:rustc-cfg=awslc_fips");
} else if env::var("DEP_OPENSSL_AWSLC_FIPS").is_ok() {
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC-FIPS");
return;
} else if env::var("DEP_OPENSSL_AWSLC").is_ok() {
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC");
} else {
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=OpenSSL");
}

println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=OpenSSL");
}
16 changes: 8 additions & 8 deletions lib/vey-daemon/src/runtime/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ fn emit_jemalloc_stats(client: &mut StatsdClient) {

const METRIC_NAME_RUNTIME_JEMALLOC_ACTIVE: &str = "runtime.jemalloc.approximate_active";
static ACTIVE_STATS: LazyLock<Option<JemallocStatsEntry<usize>>> =
LazyLock::new(|| vey_jemalloc::stats::approximate_active());

if let Some(stats) = ACTIVE_STATS.as_ref() {
if let Some(value) = stats.value() {
client
.gauge(METRIC_NAME_RUNTIME_JEMALLOC_ACTIVE, value)
.send();
}
LazyLock::new(vey_jemalloc::stats::approximate_active);

if let Some(stats) = ACTIVE_STATS.as_ref()
&& let Some(value) = stats.value()
{
client
.gauge(METRIC_NAME_RUNTIME_JEMALLOC_ACTIVE, value)
.send();
}
}
3 changes: 3 additions & 0 deletions lib/vey-jemalloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ use core::ffi::c_int;

pub mod stats;

mod version;
pub use version::lib_version;

pub struct Jemalloc;

const ZERO_FLAG: c_int = 0x40;
Expand Down
27 changes: 27 additions & 0 deletions lib/vey-jemalloc/src/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: 2026 VEY-OSS Developers.
*/

use core::ffi::{CStr, c_char};
use core::ptr;

pub fn lib_version() -> Option<&'static CStr> {
let mut p = ptr::null::<c_char>();
let mut len = size_of_val(&p);

unsafe {
let ret = jemalloc_sys::mallctl(
c"version".as_ptr(),
ptr::from_mut(&mut p) as *mut _,
ptr::from_mut(&mut len),
ptr::null_mut(),
0,
);
if ret != 0 {
return None;
}
}

unsafe { Some(CStr::from_ptr(p)) }
}
22 changes: 16 additions & 6 deletions lib/vey-openssl/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,31 @@ use std::env;
#[allow(clippy::unusual_byte_groupings)]
fn main() {
println!("cargo:rustc-check-cfg=cfg(libressl)");
println!("cargo:rustc-check-cfg=cfg(tongsuo)");
println!("cargo:rustc-check-cfg=cfg(boringssl)");
println!("cargo:rustc-check-cfg=cfg(awslc)");
println!("cargo:rustc-check-cfg=cfg(awslc_fips)");

println!("cargo:rustc-check-cfg=cfg(ossl300)");

if env::var("DEP_OPENSSL_LIBRESSL").is_ok() {
println!("cargo:rustc-cfg=libressl");
}

if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=LibreSSL");
} else if env::var("DEP_OPENSSL_TONGSUO").is_ok() {
println!("cargo:rustc-cfg=tongsuo");
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=Tongsuo");
} else if env::var("DEP_OPENSSL_BORINGSSL").is_ok() {
println!("cargo:rustc-cfg=boringssl");
}

if env::var("DEP_OPENSSL_AWSLC").is_ok() {
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=BoringSSL");
} else if env::var("DEP_OPENSSL_AWSLC_FIPS").is_ok() {
println!("cargo:rustc-cfg=awslc");
println!("cargo:rustc-cfg=awslc_fips");
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC-FIPS");
} else if env::var("DEP_OPENSSL_AWSLC").is_ok() {
println!("cargo:rustc-cfg=awslc");
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=AWS-LC");
} else {
println!("cargo:rustc-env=VEY_OPENSSL_VARIANT=OpenSSL");
}

if let Ok(version) = env::var("DEP_OPENSSL_VERSION_NUMBER") {
Expand Down
6 changes: 6 additions & 0 deletions lib/vey-openssl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ pub use ssl::SslAsyncModeExt;
#[cfg(not(libressl))]
pub use ssl::SslLazyAcceptor;
pub use ssl::{SslAcceptor, SslConnector, SslError, SslInfoCallbackWhere, SslStream};

const OPENSSL_VARIANT: Option<&str> = option_env!("VEY_OPENSSL_VARIANT");

pub fn variant_name() -> Option<&'static str> {
OPENSSL_VARIANT
}
4 changes: 4 additions & 0 deletions lib/vey-resolver/src/driver/c_ares/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ mod config;
pub use config::CAresDriverConfig;

mod error;

pub fn lib_version() -> &'static str {
c_ares::version().0
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: 2024-2025 ByteDance and/or its affiliates.
* SPDX-FileCopyrightText: 2026 VEY-OSS Developers.
*/

use std::env;

pub fn check_rustls_provider() {
fn main() {
if env::var("CARGO_FEATURE_RUSTLS_RING").is_ok() {
println!("cargo:rustc-env=VEY_RUSTLS_PROVIDER=ring");
}
Expand Down
6 changes: 6 additions & 0 deletions lib/vey-rustls-provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use anyhow::anyhow;
use cfg_if::cfg_if;

const PROVIDER_NAME: Option<&str> = option_env!("VEY_RUSTLS_PROVIDER");

pub fn install_default() -> anyhow::Result<()> {
// TODO use cfg_select

Expand All @@ -23,3 +25,7 @@ pub fn install_default() -> anyhow::Result<()> {
}
}
}

pub fn provider_name() -> Option<&'static str> {
PROVIDER_NAME
}
2 changes: 1 addition & 1 deletion scripts/coverage/vey-bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TEST_NAME="bench-ci"
. "${SCRIPTS_DIR}/enter.sh"

# build
cargo build -p vey-bench -p vey-mkcert -p vey-proxy -p vey-proxy-ctl -p vey-statsd
cargo build --features jemalloc -p vey-bench -p vey-mkcert -p vey-proxy -p vey-proxy-ctl -p vey-statsd

all_binaries=$(find target/debug/ -maxdepth 1 -type f -perm /111 | awk '{print "-object "$0}')
all_objects=$(find target/debug/deps/ -type f -perm /111 -not -name "*.so" | awk '{print "-object "$0}')
Expand Down
2 changes: 2 additions & 0 deletions scripts/coverage/vey-bench/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ vey_bench()

set -x

"${PROJECT_DIR}"/target/debug/vey-bench version

. "${RUN_DIR}"/target_dns.sh
. "${RUN_DIR}"/target_h1.sh
. "${RUN_DIR}"/target_h2.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/coverage/vey-keyless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TEST_NAME="vey-keyless-ci"
. "${SCRIPTS_DIR}/enter.sh"

# build
cargo build --features openssl-async-job -p vey-keyless -p vey-keyless-ctl -p vey-mkcert -p vey-statsd -p vey-bench
cargo build --features jemalloc,openssl-async-job -p vey-keyless -p vey-keyless-ctl -p vey-mkcert -p vey-statsd -p vey-bench

all_binaries=$(find target/debug/ -maxdepth 1 -type f -perm /111 | awk '{print "-object "$0}')
all_objects=$(find target/debug/deps/ -type f -perm /111 -not -name "*.so" | awk '{print "-object "$0}')
Expand Down
2 changes: 2 additions & 0 deletions scripts/coverage/vey-keyless/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ test_ec()

set -x

"${PROJECT_DIR}"/target/debug/vey-keyless -Vvv

for dir in $(ls "${PROJECT_DIR}"/vey-keyless/examples)
do
example_dir="${PROJECT_DIR}/vey-keyless/examples/${dir}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/coverage/vey-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TEST_NAME="vey-proxy-ci"
. "${SCRIPTS_DIR}/enter.sh"

# build
cargo build --features lua54 -p vey-proxy -p vey-proxy-ctl -p vey-proxy-ftp -p vey-mkcert -p vey-dcgen -p vey-iploc -p vey-statsd
cargo build --features jemalloc,lua54 -p vey-proxy -p vey-proxy-ctl -p vey-proxy-ftp -p vey-mkcert -p vey-dcgen -p vey-iploc -p vey-statsd

all_binaries=$(find target/debug/ -maxdepth 1 -type f -perm /111 | awk '{print "-object "$0}')
all_objects=$(find target/debug/deps/ -type f -perm /111 -not -name "*.so" | awk '{print "-object "$0}')
Expand Down
2 changes: 2 additions & 0 deletions scripts/coverage/vey-proxy/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ vey_proxy_ftp()

set -x

"${PROJECT_DIR}"/target/debug/vey-proxy -Vvv

for dir in $(ls "${PROJECT_DIR}"/vey-proxy/examples)
do
example_dir="${PROJECT_DIR}/vey-proxy/examples/${dir}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/coverage/vey-statsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TEST_NAME="vey-statsd-ci"
. "${SCRIPTS_DIR}/enter.sh"

# build
cargo build -p vey-statsd -p vey-statsd-ctl
cargo build --features jemalloc -p vey-statsd -p vey-statsd-ctl

all_binaries=$(find target/debug/ -maxdepth 1 -type f -perm /111 | awk '{print "-object "$0}')
all_objects=$(find target/debug/deps/ -type f -perm /111 -not -name "*.so" | awk '{print "-object "$0}')
Expand Down
2 changes: 2 additions & 0 deletions scripts/coverage/vey-statsd/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ vey_statsd_ctl()

set -x

"${PROJECT_DIR}"/target/debug/vey-statsd -Vvv

for dir in $(ls "${PROJECT_DIR}/vey-statsd/examples")
do
example_dir="${PROJECT_DIR}/vey-statsd/examples/${dir}"
Expand Down
7 changes: 5 additions & 2 deletions vey-bench/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ use std::env;

fn main() {
vey_build_env::check_basic();
vey_build_env::check_openssl();
vey_build_env::check_rustls_provider();

println!("cargo:rustc-check-cfg=cfg(tongsuo)");
if env::var("DEP_OPENSSL_TONGSUO").is_ok() {
println!("cargo:rustc-cfg=tongsuo");
}

if env::var("CARGO_FEATURE_QUIC").is_ok() {
println!("cargo:rustc-env=VEY_QUIC_FEATURE=quinn");
Expand Down
13 changes: 5 additions & 8 deletions vey-bench/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,23 @@ const BUILD_DEBUG: &str = env!("VEY_BUILD_DEBUG");

const PACKAGE_VERSION: Option<&str> = option_env!("VEY_PACKAGE_VERSION");

const HICKORY_FEATURE: Option<&str> = option_env!("VEY_HICKORY_FEATURE");
const QUIC_FEATURE: Option<&str> = option_env!("VEY_QUIC_FEATURE");

const OPENSSL_VARIANT: Option<&str> = option_env!("VEY_OPENSSL_VARIANT");
const RUSTLS_PROVIDER: Option<&str> = option_env!("VEY_RUSTLS_PROVIDER");

pub fn print_version() {
println!("{PKG_NAME} {VERSION}");
print!("Features:");
if let Some(hickory) = HICKORY_FEATURE {
print!(" {hickory}");
#[cfg(feature = "jemalloc")]
if let Some(version) = vey_jemalloc::lib_version() {
print!(" jemalloc({})", version.to_string_lossy());
}
if let Some(quic) = QUIC_FEATURE {
print!(" {quic}");
}
println!();
if let Some(variant) = OPENSSL_VARIANT {
if let Some(variant) = vey_openssl::variant_name() {
println!("OpenSSL Variant: {variant}");
}
if let Some(provider) = RUSTLS_PROVIDER {
if let Some(provider) = vey_rustls_provider::provider_name() {
println!("Rustls Provider: {provider}");
}
println!("Compiler: {RUSTC_VERSION} ({RUSTC_CHANNEL})");
Expand Down
4 changes: 2 additions & 2 deletions vey-bench/src/module/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ const PROXY_TLS_ARG_ENABLE_GREASE: &str = "proxy-tls-enable-grease";
const PROXY_TLS_ARG_PERMUTE_EXTENSIONS: &str = "proxy-tls-permute-extensions";

const SESSION_CACHE_VALUES: [&str; 2] = ["off", "builtin"];
#[cfg(not(feature = "vendored-tongsuo"))]
#[cfg(not(tongsuo))]
const PROTOCOL_VALUES: [&str; 5] = ["ssl3.0", "tls1.0", "tls1.1", "tls1.2", "tls1.3"];
#[cfg(feature = "vendored-tongsuo")]
#[cfg(tongsuo)]
const PROTOCOL_VALUES: [&str; 6] = ["ssl3.0", "tls1.0", "tls1.1", "tls1.2", "tls1.3", "tlcp"];

pub(crate) trait AppendOpensslArgs {
Expand Down
14 changes: 10 additions & 4 deletions vey-dcgen/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ const OPENSSL_VARIANT: Option<&str> = option_env!("VEY_OPENSSL_VARIANT");

pub fn print_version(verbose_level: u8) {
println!("{PKG_NAME} {VERSION}");
if verbose_level > 0
&& let Some(variant) = OPENSSL_VARIANT
{
println!("OpenSSL Variant: {variant}");
if verbose_level > 0 {
print!("Features:");
#[cfg(feature = "jemalloc")]
if let Some(version) = vey_jemalloc::lib_version() {
print!(" jemalloc({})", version.to_string_lossy());
}
println!();
if let Some(variant) = OPENSSL_VARIANT {
println!("OpenSSL Variant: {variant}");
}
}
if verbose_level > 1 {
println!("Compiler: {RUSTC_VERSION} ({RUSTC_CHANNEL})");
Expand Down
Loading
Loading