1#![recursion_limit = "256"]
31
32cfg_if::cfg_if! {
33 if #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] {
34 #[cfg(any(feature = "rt-async-std", feature = "rt-tokio"))]
35 compile_error!("features \"rt-async-std\" and \"rt-tokio\" can not be specified for WASM");
36 } else {
37 #[cfg(all(feature = "rt-async-std", feature = "rt-tokio"))]
38 compile_error!(
39 "feature \"rt-async-std\" and feature \"rt-tokio\" cannot be enabled at the same time"
40 );
41 #[cfg(not(any(feature = "rt-async-std", feature = "rt-tokio")))]
42 compile_error!("exactly one of feature \"rt-async-std\" or feature \"rt-tokio\" must be specified");
43 }
44}
45
46#[macro_use]
47extern crate alloc;
48
49mod attachment_manager;
50#[cfg(feature = "unstable-blockstore")]
51mod block_store;
52mod component;
53mod core_context;
54mod crypto;
55mod logging;
56mod network_manager;
57mod protected_store;
58mod routing_table;
59mod rpc_processor;
60mod stats_accounting;
61mod storage_manager;
62mod table_store;
63mod veilid_api;
64mod veilid_config;
65
66pub use self::component::VeilidComponentGuard;
70pub use self::core_context::{api_startup, api_startup_json, UpdateCallback};
71pub use self::logging::{
72 ApiTracingLayer, FmtStripVeilidFields, VeilidLayerFilter, VeilidLayerFilterConfig,
73 VeilidLayerLogKeyFilter, VeilidLogDirective, VeilidLogKey, VeilidLogKeyFilterMode,
74 VEILID_LOG_KEY_FIELD,
75};
76#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
77pub use self::logging::{LogOutput, LogOutputKind, VeilidTracing};
78pub use self::veilid_api::*;
79pub use self::veilid_config::*;
80pub use async_trait;
82pub use tracing;
84pub use tracing_subscriber;
86pub use veilid_tools as tools;
88
89#[cfg(target_os = "android")]
90pub use veilid_api::android::veilid_core_setup_android;
91
92#[cfg(any(test, feature = "test-util"))]
93#[doc(hidden)]
94pub mod tests;
95
96cfg_if::cfg_if! {
97 if #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] {
98 pub use wasm_bindgen::prelude::*;
99 pub use tsify::*;
100 }
101}
102
103#[must_use]
105pub fn veilid_version_string() -> String {
106 env!("CARGO_PKG_VERSION").to_owned()
107}
108
109#[must_use]
111pub fn veilid_version() -> (u32, u32, u32) {
112 (
113 u32::from_str(env!("CARGO_PKG_VERSION_MAJOR")).unwrap_or_log(),
114 u32::from_str(env!("CARGO_PKG_VERSION_MINOR")).unwrap_or_log(),
115 u32::from_str(env!("CARGO_PKG_VERSION_PATCH")).unwrap_or_log(),
116 )
117}
118
119#[cfg(not(build_docs))]
120include!(env!("BOSION_PATH"));
121
122#[must_use]
124pub fn veilid_features() -> Vec<String> {
125 cfg_if! {
126 if #[cfg(build_docs)] {
127 vec!["default".to_string()]
128 } else {
129 let features = Bosion::CRATE_FEATURES.to_vec();
130 features.into_iter().map(String::from).collect()
131 }
132 }
133}
134
135mod veilid_capnp {
139 #![allow(
140 clippy::all,
141 clippy::must_use_candidate,
142 clippy::large_futures,
143 clippy::large_stack_arrays,
144 clippy::large_stack_frames,
145 clippy::large_types_passed_by_value,
146 clippy::unused_async,
147 clippy::ptr_cast_constness
148 )]
149 include!("../proto/veilid_capnp.rs");
150}
151
152use self::attachment_manager::TickEvent;
153use self::component::*;
154use self::core_context::RegisteredComponents;
155#[allow(unused_imports)]
156use self::logging::{
157 debug_duration, record_duration, record_duration_fut, MeasureDebugFuture, MeasureFuture,
158 VeilidComponentLogFacilities, VeilidComponentLogFacility, DEBUGWARN,
159};
160use self::stats_accounting::*;
161
162use async_trait::*;
163use cfg_if::*;
164use enumset::*;
165use eyre::{bail, eyre, Report as EyreReport, Result as EyreResult, WrapErr};
166use futures_util::stream::{FuturesOrdered, FuturesUnordered, StreamExt as _};
167use get_size::*;
168use indent::*;
169use parking_lot::*;
170use schemars::JsonSchema;
171use serde::*;
172use stop_token::{future::FutureExt as _, *};
173use thiserror::Error as ThisError;
174use tracing::*;
175use veilid_tools::*;
176
177