From 07e3201e064ad88e7677575a3d7365dc76e1d45b Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 26 Nov 2022 22:18:55 -0500 Subject: [PATCH] checkpoint --- Cargo.lock | 137 +++++++++++++++++- veilid-cli/src/command_processor.rs | 1 - veilid-core/Cargo.toml | 2 +- .../src/network_manager/native/igd_manager.rs | 1 + veilid-tools/Cargo.toml | 25 ++-- veilid-tools/src/{mod.rs => lib.rs} | 2 +- veilid-tools/src/log_thru.rs | 2 +- veilid-tools/src/tools.rs | 3 +- 8 files changed, 147 insertions(+), 26 deletions(-) rename veilid-tools/src/{mod.rs => lib.rs} (98%) diff --git a/Cargo.lock b/Cargo.lock index 76dbdfe4..8690c6fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -334,6 +334,18 @@ version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +[[package]] +name = "async-tls" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7e7fbc0843fc5ad3d5ca889c5b2bea9130984d34cd0e62db57ab70c2529a8e3" +dependencies = [ + "futures", + "rustls 0.18.1", + "webpki 0.21.4", + "webpki-roots 0.20.0", +] + [[package]] name = "async-tls" version = "0.11.0" @@ -342,7 +354,7 @@ checksum = "2f23d769dbf1838d5df5156e7b1ad404f4c463d1ac2c6aeb6cd943630f8a8400" dependencies = [ "futures-core", "futures-io", - "rustls", + "rustls 0.19.1", "webpki 0.21.4", "webpki-roots 0.21.1", ] @@ -364,6 +376,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5c45a0dd44b7e6533ac4e7acc38ead1a3b39885f5bbb738140d30ea528abc7c" dependencies = [ + "async-tls 0.9.0", "futures-io", "futures-util", "log", @@ -377,7 +390,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b750efd83b7e716a015eed5ebb583cda83c52d9b24a8f0125e5c48c3313c9f8" dependencies = [ - "async-tls", + "async-tls 0.11.0", "futures-io", "futures-util", "log", @@ -4296,6 +4309,19 @@ dependencies = [ "semver", ] +[[package]] +name = "rustls" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d1126dcf58e93cee7d098dbda643b5f92ed724f1f6a63007c1116eed6700c81" +dependencies = [ + "base64 0.12.3", + "log", + "ring", + "sct", + "webpki 0.21.4", +] + [[package]] name = "rustls" version = "0.19.1" @@ -5562,7 +5588,7 @@ dependencies = [ "async-lock", "async-std", "async-std-resolver", - "async-tls", + "async-tls 0.11.0", "async-tungstenite 0.18.0", "async_executors", "backtrace", @@ -5615,7 +5641,7 @@ dependencies = [ "rtnetlink", "rusqlite", "rust-fsm", - "rustls", + "rustls 0.19.1", "rustls-pemfile", "secrecy", "send_wrapper 0.6.0", @@ -5637,6 +5663,7 @@ dependencies = [ "tracing-subscriber", "tracing-wasm", "trust-dns-resolver", + "veilid-tools", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-test", @@ -5732,6 +5759,99 @@ dependencies = [ "windows-service", ] +[[package]] +name = "veilid-tools" +version = "0.1.0" +dependencies = [ + "async-io", + "async-lock", + "async-std", + "async-std-resolver", + "async-tls 0.11.0", + "async-tungstenite 0.8.0", + "async_executors", + "backtrace", + "blake3", + "bugsalot", + "bytecheck", + "cfg-if 1.0.0", + "chacha20 0.8.2", + "chacha20poly1305", + "chrono", + "config", + "console_error_panic_hook", + "curve25519-dalek-ng", + "data-encoding", + "digest 0.9.0", + "directories", + "ed25519-dalek", + "enumset", + "eyre", + "flume", + "futures-util", + "generic-array", + "getrandom 0.2.8", + "hashlink 0.8.1", + "hex", + "ifstructs", + "igd", + "jni", + "jni-sys", + "js-sys", + "json", + "keyring-manager", + "keyvaluedb", + "keyvaluedb-sqlite", + "keyvaluedb-web", + "lazy_static", + "libc", + "log", + "maplit", + "ndk 0.6.0", + "ndk-glue", + "nix 0.22.3", + "once_cell", + "owning_ref", + "owo-colors", + "parking_lot 0.11.2", + "rand 0.7.3", + "rkyv", + "rtnetlink", + "rusqlite", + "rustls 0.19.1", + "rustls-pemfile", + "secrecy", + "send_wrapper 0.6.0", + "serde", + "serde-big-array", + "serde_json", + "serial_test", + "simplelog 0.9.0", + "socket2", + "static_assertions", + "stop-token", + "thiserror", + "tokio 1.22.0", + "tokio-stream", + "tokio-util", + "tracing", + "tracing-android", + "trust-dns-resolver", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test", + "wasm-logger", + "web-sys", + "webpki 0.21.4", + "webpki-roots 0.21.1", + "wee_alloc", + "winapi 0.3.9", + "windows", + "windows-permissions", + "ws_stream_wasm", + "x25519-dalek-ng", +] + [[package]] name = "veilid-wasm" version = "0.1.0" @@ -5940,6 +6060,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki-roots" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" +dependencies = [ + "webpki 0.21.4", +] + [[package]] name = "webpki-roots" version = "0.21.1" diff --git a/veilid-cli/src/command_processor.rs b/veilid-cli/src/command_processor.rs index dcf4d719..88674eeb 100644 --- a/veilid-cli/src/command_processor.rs +++ b/veilid-cli/src/command_processor.rs @@ -1,6 +1,5 @@ use crate::client_api_connection::*; use crate::settings::Settings; -use crate::tools::*; use crate::ui::*; use log::*; use std::cell::*; diff --git a/veilid-core/Cargo.toml b/veilid-core/Cargo.toml index ef4ea26b..626ec92f 100644 --- a/veilid-core/Cargo.toml +++ b/veilid-core/Cargo.toml @@ -19,7 +19,7 @@ ios_tests = [ "simplelog" ] tracking = [] [dependencies] -veilid_tools = { path = "../veilid-tools", features = "tracing" } +veilid-tools = { path = "../veilid-tools", features = [ "tracing" ] } tracing = { version = "^0", features = ["log", "attributes"] } tracing-subscriber = "^0" tracing-error = "^0" diff --git a/veilid-core/src/network_manager/native/igd_manager.rs b/veilid-core/src/network_manager/native/igd_manager.rs index f7580a89..3765a4ae 100644 --- a/veilid-core/src/network_manager/native/igd_manager.rs +++ b/veilid-core/src/network_manager/native/igd_manager.rs @@ -2,6 +2,7 @@ use super::*; use igd::*; use std::net::UdpSocket; + const UPNP_GATEWAY_DETECT_TIMEOUT_MS: u32 = 5_000; const UPNP_MAPPING_LIFETIME_MS: u32 = 120_000; const UPNP_MAPPING_ATTEMPTS: u32 = 3; diff --git a/veilid-tools/Cargo.toml b/veilid-tools/Cargo.toml index 3e0ebf31..2e9aefc2 100644 --- a/veilid-tools/Cargo.toml +++ b/veilid-tools/Cargo.toml @@ -1,30 +1,27 @@ [package] -name = "veilid-core" +name = "veilid-tools" version = "0.1.0" authors = ["John Smith "] edition = "2021" -build = "build.rs" license = "LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)" [lib] -crate-type = ["cdylib", "staticlib", "rlib"] +crate-type = ["rlib"] [features] -default = [] +default = [ "rt-tokio" ] rt-async-std = [ "async-std", "async-std-resolver", "async_executors/async_std", "rtnetlink?/smol_socket" ] rt-tokio = [ "tokio", "tokio-util", "tokio-stream", "trust-dns-resolver/tokio-runtime", "async_executors/tokio_tp", "async_executors/tokio_io", "async_executors/tokio_timer", "rtnetlink?/tokio_socket" ] android_tests = [] ios_tests = [ "simplelog" ] tracking = [] +tracing = [ "dep:tracing" ] [dependencies] -tracing = { version = "^0", features = ["log", "attributes"] } -tracing-subscriber = "^0" -tracing-error = "^0" +tracing = { version = "^0", features = ["log", "attributes"], optional = true } +log = { version = "^0", optional = true } eyre = "^0" -capnp = { version = "^0", default_features = false } -rust-fsm = "^0" static_assertions = "^1" cfg-if = "^1" thiserror = "^1" @@ -100,13 +97,12 @@ js-sys = "^0" wasm-bindgen-futures = "^0" keyvaluedb-web = { path = "../external/keyvaluedb/keyvaluedb-web" } data-encoding = { version = "^2", default_features = false, features = ["alloc"] } -getrandom = { version = "^0", features = ["js"] } +getrandom = { version = "^0.2", features = ["js"] } ws_stream_wasm = "^0" async_executors = { version = "^0", default-features = false, features = [ "bindgen", "timer" ]} async-lock = "^2" -send_wrapper = { version = "^0", features = ["futures"] } +send_wrapper = { version = "^0.6", features = ["futures"] } wasm-logger = "^0" -tracing-wasm = "^0" # Configuration for WASM32 'web-sys' crate [target.'cfg(target_arch = "wasm32")'.dependencies.web-sys] @@ -142,7 +138,7 @@ rtnetlink = { version = "^0", default-features = false } # Dependencies for Windows [target.'cfg(target_os = "windows")'.dependencies] -winapi = { version = "^0", features = [ "iptypes", "iphlpapi" ] } +winapi = { version = "^0.3.9", features = [ "iptypes", "iphlpapi" ] } windows = { version = "^0", features = [ "Win32_NetworkManagement_Dns", "Win32_Foundation", "alloc" ]} windows-permissions = "^0" @@ -172,8 +168,5 @@ wasm-logger = "^0" ### BUILD OPTIONS -[build-dependencies] -capnpc = "^0" - [package.metadata.wasm-pack.profile.release] wasm-opt = ["-O", "--enable-mutable-globals"] diff --git a/veilid-tools/src/mod.rs b/veilid-tools/src/lib.rs similarity index 98% rename from veilid-tools/src/mod.rs rename to veilid-tools/src/lib.rs index 15529449..d5f6ac70 100644 --- a/veilid-tools/src/mod.rs +++ b/veilid-tools/src/lib.rs @@ -74,7 +74,7 @@ pub use std::net::{ pub use std::ops::{Fn, FnMut, FnOnce}; pub use std::pin::Pin; pub use std::rc::Rc; -pub use std::string::String; +pub use std::string::{String, ToString}; pub use std::sync::atomic::{AtomicBool, Ordering}; pub use std::sync::{Arc, Weak}; pub use std::task; diff --git a/veilid-tools/src/log_thru.rs b/veilid-tools/src/log_thru.rs index b6fecc01..587a8393 100644 --- a/veilid-tools/src/log_thru.rs +++ b/veilid-tools/src/log_thru.rs @@ -2,7 +2,7 @@ // Pass errors through and log them simultaneously via map_err() // Also contains common log facilities (net, rpc, rtab, pstore, crypto, etc ) -use alloc::string::{String, ToString}; +use super::*; pub fn map_to_string(arg: X) -> String { arg.to_string() diff --git a/veilid-tools/src/tools.rs b/veilid-tools/src/tools.rs index 1758fdf2..1d388121 100644 --- a/veilid-tools/src/tools.rs +++ b/veilid-tools/src/tools.rs @@ -1,6 +1,5 @@ use super::*; -use alloc::string::ToString; use std::io; use std::path::Path; @@ -276,7 +275,7 @@ cfg_if::cfg_if! { Ok(()) } } else { - pub fn ensure_file_private_owner>(_path: P) -> Result<(),String> + pub fn ensure_file_private_owner>(_path: P) -> Result<(), String> { Ok(()) }