2021-12-07 22:09:45 -05:00
|
|
|
#![deny(clippy::all)]
|
2021-12-09 16:11:52 -05:00
|
|
|
#![deny(unused_must_use)]
|
2022-11-30 09:39:12 -05:00
|
|
|
#![recursion_limit = "256"]
|
2022-06-27 23:46:29 -04:00
|
|
|
|
|
|
|
cfg_if::cfg_if! {
|
|
|
|
if #[cfg(target_arch = "wasm32")] {
|
|
|
|
#[cfg(any(feature = "rt-async-std", feature = "rt-tokio"))]
|
|
|
|
compile_error!("features \"rt-async-std\" and \"rt-tokio\" can not be specified for WASM");
|
|
|
|
} else {
|
|
|
|
#[cfg(all(feature = "rt-async-std", feature = "rt-tokio"))]
|
|
|
|
compile_error!(
|
|
|
|
"feature \"rt-async-std\" and feature \"rt-tokio\" cannot be enabled at the same time"
|
|
|
|
);
|
|
|
|
#[cfg(not(any(feature = "rt-async-std", feature = "rt-tokio")))]
|
|
|
|
compile_error!("exactly one of feature \"rt-async-std\" or feature \"rt-tokio\" must be specified");
|
|
|
|
}
|
|
|
|
}
|
2021-11-22 11:28:30 -05:00
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate alloc;
|
|
|
|
|
2022-06-07 21:31:05 -04:00
|
|
|
mod api_tracing_layer;
|
2021-11-22 11:28:30 -05:00
|
|
|
mod attachment_manager;
|
2022-02-06 21:18:42 -05:00
|
|
|
mod core_context;
|
2022-10-30 19:29:31 -04:00
|
|
|
mod crypto;
|
2021-11-22 11:28:30 -05:00
|
|
|
mod intf;
|
|
|
|
mod network_manager;
|
|
|
|
mod receipt_manager;
|
|
|
|
mod routing_table;
|
|
|
|
mod rpc_processor;
|
2023-05-29 15:24:57 -04:00
|
|
|
mod storage_manager;
|
|
|
|
mod table_store;
|
2021-11-22 11:28:30 -05:00
|
|
|
mod veilid_api;
|
|
|
|
mod veilid_config;
|
2022-07-01 12:13:52 -04:00
|
|
|
mod veilid_layer_filter;
|
2021-11-22 11:28:30 -05:00
|
|
|
|
2022-06-07 21:31:05 -04:00
|
|
|
pub use self::api_tracing_layer::ApiTracingLayer;
|
2022-02-09 09:47:36 -05:00
|
|
|
pub use self::core_context::{api_startup, api_startup_json, UpdateCallback};
|
2021-11-22 11:28:30 -05:00
|
|
|
pub use self::veilid_api::*;
|
|
|
|
pub use self::veilid_config::*;
|
2022-07-01 12:13:52 -04:00
|
|
|
pub use self::veilid_layer_filter::*;
|
2022-11-26 21:37:23 -05:00
|
|
|
pub use veilid_tools as tools;
|
2021-11-22 11:28:30 -05:00
|
|
|
|
|
|
|
pub mod veilid_capnp {
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/proto/veilid_capnp.rs"));
|
|
|
|
}
|
|
|
|
|
|
|
|
pub mod tests;
|
2022-01-27 22:02:16 -05:00
|
|
|
|
|
|
|
pub fn veilid_version_string() -> String {
|
|
|
|
env!("CARGO_PKG_VERSION").to_owned()
|
|
|
|
}
|
|
|
|
pub fn veilid_version() -> (u32, u32, u32) {
|
|
|
|
(
|
|
|
|
u32::from_str(env!("CARGO_PKG_VERSION_MAJOR")).unwrap(),
|
|
|
|
u32::from_str(env!("CARGO_PKG_VERSION_MINOR")).unwrap(),
|
|
|
|
u32::from_str(env!("CARGO_PKG_VERSION_PATCH")).unwrap(),
|
|
|
|
)
|
|
|
|
}
|
2022-01-31 22:47:17 -05:00
|
|
|
|
2022-03-03 20:45:39 -05:00
|
|
|
#[cfg(target_os = "android")]
|
2022-12-01 14:32:02 -05:00
|
|
|
pub use intf::android::veilid_core_setup_android;
|
2022-03-03 20:45:39 -05:00
|
|
|
|
2022-11-03 22:52:18 -04:00
|
|
|
pub static DEFAULT_LOG_IGNORE_LIST: [&str; 21] = [
|
2022-06-27 23:46:29 -04:00
|
|
|
"mio",
|
2022-06-29 10:13:49 -04:00
|
|
|
"h2",
|
|
|
|
"hyper",
|
|
|
|
"tower",
|
|
|
|
"tonic",
|
2022-11-03 22:52:18 -04:00
|
|
|
"tokio",
|
|
|
|
"runtime",
|
2022-06-29 10:13:49 -04:00
|
|
|
"tokio_util",
|
|
|
|
"want",
|
2022-06-27 23:46:29 -04:00
|
|
|
"serial_test",
|
2022-01-31 22:47:17 -05:00
|
|
|
"async_std",
|
|
|
|
"async_io",
|
|
|
|
"polling",
|
|
|
|
"rustls",
|
|
|
|
"async_tungstenite",
|
|
|
|
"tungstenite",
|
|
|
|
"netlink_proto",
|
|
|
|
"netlink_sys",
|
2022-05-17 16:55:53 -04:00
|
|
|
"trust_dns_resolver",
|
|
|
|
"trust_dns_proto",
|
2022-08-22 13:27:26 -04:00
|
|
|
"attohttpc",
|
2022-01-31 22:47:17 -05:00
|
|
|
];
|
2022-11-29 19:22:33 -05:00
|
|
|
|
2023-06-08 14:07:09 -04:00
|
|
|
use cfg_if::*;
|
|
|
|
use enumset::*;
|
|
|
|
use eyre::{bail, eyre, Report as EyreReport, Result as EyreResult, WrapErr};
|
|
|
|
use futures_util::stream::FuturesUnordered;
|
2023-07-15 16:18:13 -04:00
|
|
|
use parking_lot::*;
|
2023-06-08 14:07:09 -04:00
|
|
|
use schemars::{schema_for, JsonSchema};
|
|
|
|
use serde::*;
|
|
|
|
use stop_token::*;
|
|
|
|
use thiserror::Error as ThisError;
|
2023-07-15 16:18:13 -04:00
|
|
|
use tracing::*;
|
|
|
|
use veilid_tools::*;
|