mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
doc work
This commit is contained in:
parent
8c366387eb
commit
3125c19f02
3
build_docs.sh
Executable file
3
build_docs.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cargo doc --no-deps -p veilid-core
|
||||||
|
cargo doc --no-deps -p veilid-tools
|
@ -12,10 +12,11 @@ crate-type = ["cdylib", "staticlib", "rlib"]
|
|||||||
[features]
|
[features]
|
||||||
|
|
||||||
# Common features
|
# Common features
|
||||||
default = ["enable-crypto-vld0"]
|
default = ["enable-crypto-vld0", "rt-tokio"]
|
||||||
rt-async-std = [
|
rt-async-std = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"async-std-resolver",
|
"async-std-resolver",
|
||||||
|
"trust-dns-resolver",
|
||||||
"async_executors/async_std",
|
"async_executors/async_std",
|
||||||
"rtnetlink/smol_socket",
|
"rtnetlink/smol_socket",
|
||||||
"veilid-tools/rt-async-std",
|
"veilid-tools/rt-async-std",
|
||||||
@ -52,7 +53,9 @@ network-result-extra = ["veilid-tools/network-result-extra"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
veilid-tools = { path = "../veilid-tools", features = ["tracing"] }
|
veilid-tools = { path = "../veilid-tools", features = [
|
||||||
|
"tracing",
|
||||||
|
], default-features = false }
|
||||||
paste = "1.0.14"
|
paste = "1.0.14"
|
||||||
once_cell = "1.18.0"
|
once_cell = "1.18.0"
|
||||||
owning_ref = "0.4.1"
|
owning_ref = "0.4.1"
|
||||||
|
@ -18,6 +18,7 @@ cfg_if! {
|
|||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature="rt-async-std")] {
|
if #[cfg(feature="rt-async-std")] {
|
||||||
use async_std_resolver::{config, resolver, resolver_from_system_conf, AsyncStdResolver as AsyncResolver};
|
use async_std_resolver::{config, resolver, resolver_from_system_conf, AsyncStdResolver as AsyncResolver};
|
||||||
|
use trust_dns_resolver::error::ResolveErrorKind;
|
||||||
} else if #[cfg(feature="rt-tokio")] {
|
} else if #[cfg(feature="rt-tokio")] {
|
||||||
use trust_dns_resolver::{config, TokioAsyncResolver as AsyncResolver, error::ResolveError, error::ResolveErrorKind};
|
use trust_dns_resolver::{config, TokioAsyncResolver as AsyncResolver, error::ResolveError, error::ResolveErrorKind};
|
||||||
|
|
||||||
|
@ -132,6 +132,30 @@ impl Network {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(all(feature = "rt-async-std", unix))]
|
||||||
|
{
|
||||||
|
// async-std does not directly support linger on tcpsocket yet
|
||||||
|
use std::os::fd::AsRawFd;
|
||||||
|
use std::os::fd::FromRawFd;
|
||||||
|
if let Err(e) = unsafe { socket2::Socket::from_raw_fd(tcp_stream.as_raw_fd()) }
|
||||||
|
.set_linger(Some(core::time::Duration::from_secs(0)))
|
||||||
|
{
|
||||||
|
log_net!(debug "Couldn't set TCP linger: {}", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(all(feature = "rt-async-std", windows))]
|
||||||
|
{
|
||||||
|
// async-std does not directly support linger on tcpsocket yet
|
||||||
|
use std::os::windows::io::AsRawSocket;
|
||||||
|
if let Err(e) = unsafe { socket2::socket_from_raw(tcp_stream.as_raw_socket()) }
|
||||||
|
.set_linger(Some(core::time::Duration::from_secs(0)))
|
||||||
|
{
|
||||||
|
log_net!(debug "Couldn't set TCP linger: {}", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "rt-async-std"))]
|
||||||
if let Err(e) = tcp_stream.set_linger(Some(core::time::Duration::from_secs(0))) {
|
if let Err(e) = tcp_stream.set_linger(Some(core::time::Duration::from_secs(0))) {
|
||||||
log_net!(debug "Couldn't set TCP linger: {}", e);
|
log_net!(debug "Couldn't set TCP linger: {}", e);
|
||||||
return;
|
return;
|
||||||
|
@ -19,7 +19,7 @@ use clap::{Args, Parser};
|
|||||||
use server::*;
|
use server::*;
|
||||||
use settings::LogLevel;
|
use settings::LogLevel;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::ffi::{OsString, OsStr};
|
use std::ffi::{OsStr, OsString};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use tools::*;
|
use tools::*;
|
||||||
@ -40,7 +40,6 @@ pub struct Logging {
|
|||||||
#[derive(Parser, Debug, Clone)]
|
#[derive(Parser, Debug, Clone)]
|
||||||
#[command(author, version, about)]
|
#[command(author, version, about)]
|
||||||
pub struct CmdlineArgs {
|
pub struct CmdlineArgs {
|
||||||
|
|
||||||
/// Run in daemon mode in the background
|
/// Run in daemon mode in the background
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
daemon: bool,
|
daemon: bool,
|
||||||
@ -66,7 +65,7 @@ pub struct CmdlineArgs {
|
|||||||
new_password: Option<String>,
|
new_password: Option<String>,
|
||||||
|
|
||||||
/// Do not automatically attach the server to the Veilid network
|
/// Do not automatically attach the server to the Veilid network
|
||||||
///
|
///
|
||||||
/// Default behaviour is to automatically attach the server to the Veilid network, this option disables this behaviour.
|
/// Default behaviour is to automatically attach the server to the Veilid network, this option disables this behaviour.
|
||||||
#[arg(long, value_name = "BOOL")]
|
#[arg(long, value_name = "BOOL")]
|
||||||
no_attach: bool,
|
no_attach: bool,
|
||||||
@ -75,7 +74,7 @@ pub struct CmdlineArgs {
|
|||||||
logging: Logging,
|
logging: Logging,
|
||||||
|
|
||||||
/// Turn on OpenTelemetry tracing
|
/// Turn on OpenTelemetry tracing
|
||||||
///
|
///
|
||||||
/// This option uses the GRPC OpenTelemetry protocol, not HTTP. The format for the endpoint is host:port, like 'localhost:4317'
|
/// This option uses the GRPC OpenTelemetry protocol, not HTTP. The format for the endpoint is host:port, like 'localhost:4317'
|
||||||
#[arg(long, value_name = "endpoint")]
|
#[arg(long, value_name = "endpoint")]
|
||||||
otlp: Option<String>,
|
otlp: Option<String>,
|
||||||
@ -85,14 +84,14 @@ pub struct CmdlineArgs {
|
|||||||
subnode_index: Option<u16>,
|
subnode_index: Option<u16>,
|
||||||
|
|
||||||
/// Only generate a new keypair and print it
|
/// Only generate a new keypair and print it
|
||||||
///
|
///
|
||||||
/// Generate a new keypair for a specific crypto kind and print both the key and its secret to the terminal, then exit immediately.
|
/// Generate a new keypair for a specific crypto kind and print both the key and its secret to the terminal, then exit immediately.
|
||||||
#[arg(long, value_name = "crypto_kind")]
|
#[arg(long, value_name = "crypto_kind")]
|
||||||
generate_key_pair: Option<String>,
|
generate_key_pair: Option<String>,
|
||||||
|
|
||||||
/// Set the node ids and secret keys
|
/// Set the node ids and secret keys
|
||||||
///
|
///
|
||||||
/// Specify node ids in typed key set format ('[VLD0:xxxx,VLD1:xxxx]') on the command line, a prompt appears to enter the secret key set interactively.
|
/// Specify node ids in typed key set format ('\[VLD0:xxxx,VLD1:xxxx\]') on the command line, a prompt appears to enter the secret key set interactively.
|
||||||
#[arg(long, value_name = "key_set")]
|
#[arg(long, value_name = "key_set")]
|
||||||
set_node_id: Option<String>,
|
set_node_id: Option<String>,
|
||||||
|
|
||||||
@ -156,7 +155,7 @@ fn main() -> EyreResult<()> {
|
|||||||
|
|
||||||
// Check for one-off commands
|
// Check for one-off commands
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
if args.wait_for_debug{
|
if args.wait_for_debug {
|
||||||
use bugsalot::debugger;
|
use bugsalot::debugger;
|
||||||
debugger::wait_until_attached(None).expect("state() not implemented on this platform");
|
debugger::wait_until_attached(None).expect("state() not implemented on this platform");
|
||||||
}
|
}
|
||||||
@ -204,7 +203,9 @@ fn main() -> EyreResult<()> {
|
|||||||
println!("Enabling OTLP tracing");
|
println!("Enabling OTLP tracing");
|
||||||
settingsrw.logging.otlp.enabled = true;
|
settingsrw.logging.otlp.enabled = true;
|
||||||
settingsrw.logging.otlp.grpc_endpoint = NamedSocketAddrs::from_str(
|
settingsrw.logging.otlp.grpc_endpoint = NamedSocketAddrs::from_str(
|
||||||
args.otlp.expect("should not be null because of default missing value").as_str(),
|
args.otlp
|
||||||
|
.expect("should not be null because of default missing value")
|
||||||
|
.as_str(),
|
||||||
)
|
)
|
||||||
.wrap_err("failed to parse OTLP address")?;
|
.wrap_err("failed to parse OTLP address")?;
|
||||||
settingsrw.logging.otlp.level = LogLevel::Trace;
|
settingsrw.logging.otlp.level = LogLevel::Trace;
|
||||||
@ -222,10 +223,16 @@ fn main() -> EyreResult<()> {
|
|||||||
settingsrw.core.table_store.delete = true;
|
settingsrw.core.table_store.delete = true;
|
||||||
}
|
}
|
||||||
if let Some(password) = args.password {
|
if let Some(password) = args.password {
|
||||||
settingsrw.core.protected_store.device_encryption_key_password = password;
|
settingsrw
|
||||||
|
.core
|
||||||
|
.protected_store
|
||||||
|
.device_encryption_key_password = password;
|
||||||
}
|
}
|
||||||
if let Some(new_password) = args.new_password {
|
if let Some(new_password) = args.new_password {
|
||||||
settingsrw.core.protected_store.new_device_encryption_key_password = Some(new_password);
|
settingsrw
|
||||||
|
.core
|
||||||
|
.protected_store
|
||||||
|
.new_device_encryption_key_password = Some(new_password);
|
||||||
}
|
}
|
||||||
if let Some(network_key) = args.network_key {
|
if let Some(network_key) = args.network_key {
|
||||||
settingsrw.core.network.network_key_password = Some(network_key);
|
settingsrw.core.network.network_key_password = Some(network_key);
|
||||||
@ -241,8 +248,8 @@ fn main() -> EyreResult<()> {
|
|||||||
settingsrw.logging.terminal.enabled = false;
|
settingsrw.logging.terminal.enabled = false;
|
||||||
|
|
||||||
// Split or get secret
|
// Split or get secret
|
||||||
let tks =
|
let tks = TypedKeyGroup::from_str(&key_set)
|
||||||
TypedKeyGroup::from_str(&key_set).wrap_err("failed to decode node id set from command line")?;
|
.wrap_err("failed to decode node id set from command line")?;
|
||||||
|
|
||||||
let buffer = rpassword::prompt_password("Enter secret key set (will not echo): ")
|
let buffer = rpassword::prompt_password("Enter secret key set (will not echo): ")
|
||||||
.wrap_err("invalid secret key")?;
|
.wrap_err("invalid secret key")?;
|
||||||
@ -265,7 +272,7 @@ fn main() -> EyreResult<()> {
|
|||||||
}
|
}
|
||||||
settingsrw.core.network.routing_table.bootstrap = bootstrap_list;
|
settingsrw.core.network.routing_table.bootstrap = bootstrap_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "rt-tokio")]
|
#[cfg(feature = "rt-tokio")]
|
||||||
if args.console {
|
if args.console {
|
||||||
settingsrw.logging.console.enabled = true;
|
settingsrw.logging.console.enabled = true;
|
||||||
@ -299,8 +306,8 @@ fn main() -> EyreResult<()> {
|
|||||||
let mut tks = veilid_core::TypedKeyGroup::new();
|
let mut tks = veilid_core::TypedKeyGroup::new();
|
||||||
let mut tss = veilid_core::TypedSecretGroup::new();
|
let mut tss = veilid_core::TypedSecretGroup::new();
|
||||||
for ck in veilid_core::VALID_CRYPTO_KINDS {
|
for ck in veilid_core::VALID_CRYPTO_KINDS {
|
||||||
let tkp = veilid_core::Crypto::generate_keypair(ck)
|
let tkp =
|
||||||
.wrap_err("invalid crypto kind")?;
|
veilid_core::Crypto::generate_keypair(ck).wrap_err("invalid crypto kind")?;
|
||||||
tks.add(veilid_core::TypedKey::new(tkp.kind, tkp.value.key));
|
tks.add(veilid_core::TypedKey::new(tkp.kind, tkp.value.key));
|
||||||
tss.add(veilid_core::TypedSecret::new(tkp.kind, tkp.value.secret));
|
tss.add(veilid_core::TypedSecret::new(tkp.kind, tkp.value.secret));
|
||||||
}
|
}
|
||||||
@ -312,8 +319,7 @@ fn main() -> EyreResult<()> {
|
|||||||
} else {
|
} else {
|
||||||
let ck: veilid_core::CryptoKind =
|
let ck: veilid_core::CryptoKind =
|
||||||
veilid_core::FourCC::from_str(&ckstr).wrap_err("couldn't parse crypto kind")?;
|
veilid_core::FourCC::from_str(&ckstr).wrap_err("couldn't parse crypto kind")?;
|
||||||
let tkp =
|
let tkp = veilid_core::Crypto::generate_keypair(ck).wrap_err("invalid crypto kind")?;
|
||||||
veilid_core::Crypto::generate_keypair(ck).wrap_err("invalid crypto kind")?;
|
|
||||||
println!("{}", tkp.to_string());
|
println!("{}", tkp.to_string());
|
||||||
}
|
}
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -7,29 +7,40 @@ edition = "2021"
|
|||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
# staticlib for iOS tests, cydlib for android tests, rlib for everything else
|
# staticlib for iOS tests, cydlib for android tests, rlib for everything else
|
||||||
crate-type = [ "cdylib", "staticlib", "rlib" ]
|
crate-type = ["cdylib", "staticlib", "rlib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["rt-tokio"]
|
||||||
rt-async-std = [ "async-std", "async_executors/async_std" ]
|
rt-async-std = ["async-std", "async_executors/async_std"]
|
||||||
rt-tokio = [ "tokio", "tokio-util", "async_executors/tokio_tp", "async_executors/tokio_io", "async_executors/tokio_timer" ]
|
rt-tokio = [
|
||||||
rt-wasm-bindgen = [ "async_executors/bindgen", "async_executors/timer"]
|
"tokio",
|
||||||
|
"tokio-util",
|
||||||
|
"async_executors/tokio_tp",
|
||||||
|
"async_executors/tokio_io",
|
||||||
|
"async_executors/tokio_timer",
|
||||||
|
]
|
||||||
|
rt-wasm-bindgen = ["async_executors/bindgen", "async_executors/timer"]
|
||||||
|
|
||||||
veilid_tools_android_tests = [ "dep:paranoid-android" ]
|
veilid_tools_android_tests = ["dep:paranoid-android"]
|
||||||
veilid_tools_ios_tests = [ "dep:oslog", "dep:tracing-oslog" ]
|
veilid_tools_ios_tests = ["dep:oslog", "dep:tracing-oslog"]
|
||||||
tracing = [ "dep:tracing", "dep:tracing-subscriber" ]
|
tracing = ["dep:tracing", "dep:tracing-subscriber"]
|
||||||
network-result-extra = []
|
network-result-extra = []
|
||||||
network-result-info = []
|
network-result-info = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tracing = { version = "0.1.37", features = ["log", "attributes"], optional = true }
|
tracing = { version = "0.1.37", features = [
|
||||||
|
"log",
|
||||||
|
"attributes",
|
||||||
|
], optional = true }
|
||||||
tracing-subscriber = { version = "0.3.17", optional = true }
|
tracing-subscriber = { version = "0.3.17", optional = true }
|
||||||
log = { version = "0.4.20" }
|
log = { version = "0.4.20" }
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
static_assertions = "1.1.0"
|
static_assertions = "1.1.0"
|
||||||
cfg-if = "1.0.0"
|
cfg-if = "1.0.0"
|
||||||
thiserror = "1.0.47"
|
thiserror = "1.0.47"
|
||||||
futures-util = { version = "0.3.28", default_features = false, features = ["alloc"] }
|
futures-util = { version = "0.3.28", default_features = false, features = [
|
||||||
|
"alloc",
|
||||||
|
] }
|
||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
once_cell = "1.18.0"
|
once_cell = "1.18.0"
|
||||||
stop-token = { version = "0.7.0", default-features = false }
|
stop-token = { version = "0.7.0", default-features = false }
|
||||||
@ -43,10 +54,15 @@ flume = { version = "0.11.0", features = ["async"] }
|
|||||||
# Dependencies for native builds only
|
# Dependencies for native builds only
|
||||||
# Linux, Windows, Mac, iOS, Android
|
# Linux, Windows, Mac, iOS, Android
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
async-std = { version = "1.12.0", features = ["unstable"], optional = true}
|
async-std = { version = "1.12.0", features = ["unstable"], optional = true }
|
||||||
tokio = { version = "1.32.0", features = ["full"], optional = true}
|
tokio = { version = "1.32.0", features = ["full"], optional = true }
|
||||||
tokio-util = { version = "0.7.8", features = ["compat"], optional = true}
|
tokio-util = { version = "0.7.8", features = ["compat"], optional = true }
|
||||||
futures-util = { version = "0.3.28", default-features = false, features = ["async-await", "sink", "std", "io"] }
|
futures-util = { version = "0.3.28", default-features = false, features = [
|
||||||
|
"async-await",
|
||||||
|
"sink",
|
||||||
|
"std",
|
||||||
|
"io",
|
||||||
|
] }
|
||||||
chrono = "0.4.26"
|
chrono = "0.4.26"
|
||||||
|
|
||||||
libc = "0.2.147"
|
libc = "0.2.147"
|
||||||
@ -57,7 +73,7 @@ nix = "0.26.2"
|
|||||||
wasm-bindgen = "0.2.87"
|
wasm-bindgen = "0.2.87"
|
||||||
js-sys = "0.3.64"
|
js-sys = "0.3.64"
|
||||||
wasm-bindgen-futures = "0.4.37"
|
wasm-bindgen-futures = "0.4.37"
|
||||||
async_executors = { version = "0.7.0", default-features = false}
|
async_executors = { version = "0.7.0", default-features = false }
|
||||||
async-lock = "2.8.0"
|
async-lock = "2.8.0"
|
||||||
send_wrapper = { version = "0.6.0", features = ["futures"] }
|
send_wrapper = { version = "0.6.0", features = ["futures"] }
|
||||||
|
|
||||||
@ -85,7 +101,7 @@ tracing-oslog = { version = "0.1.2", optional = true }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serial_test = "^2.0.0"
|
serial_test = "^2.0.0"
|
||||||
simplelog = { version = "0.12.1", features = [ "test" ] }
|
simplelog = { version = "0.12.1", features = ["test"] }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
||||||
console_error_panic_hook = "0.1.7"
|
console_error_panic_hook = "0.1.7"
|
||||||
@ -100,6 +116,10 @@ tracing-wasm = { version = "0.2.1" }
|
|||||||
wasm-opt = ["-O", "--enable-mutable-globals"]
|
wasm-opt = ["-O", "--enable-mutable-globals"]
|
||||||
|
|
||||||
[package.metadata.ios]
|
[package.metadata.ios]
|
||||||
build_targets = ["aarch64-apple-ios", "aarch64-apple-ios-sim", "x86_64-apple-ios"]
|
build_targets = [
|
||||||
|
"aarch64-apple-ios",
|
||||||
|
"aarch64-apple-ios-sim",
|
||||||
|
"x86_64-apple-ios",
|
||||||
|
]
|
||||||
deployment_target = "12.0"
|
deployment_target = "12.0"
|
||||||
build_id_prefix = "com.veilid.veilidtools"
|
build_id_prefix = "com.veilid.veilidtools"
|
||||||
|
Loading…
Reference in New Issue
Block a user