mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-25 07:19:26 -05:00
test fixes
This commit is contained in:
parent
69d68e900e
commit
86567ea78d
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -4623,6 +4623,7 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
"tracing-error",
|
"tracing-error",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
"tracing-wasm",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
"wasm-bindgen-test",
|
"wasm-bindgen-test",
|
||||||
|
@ -98,6 +98,8 @@ ws_stream_wasm = "^0"
|
|||||||
async_executors = { version = "^0", default-features = false, features = [ "bindgen" ]}
|
async_executors = { version = "^0", default-features = false, features = [ "bindgen" ]}
|
||||||
async-lock = "^2"
|
async-lock = "^2"
|
||||||
send_wrapper = "^0"
|
send_wrapper = "^0"
|
||||||
|
wasm-logger = "^0"
|
||||||
|
tracing-wasm = "^0"
|
||||||
|
|
||||||
# Configuration for WASM32 'web-sys' crate
|
# Configuration for WASM32 'web-sys' crate
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
|
[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys]
|
||||||
|
@ -78,7 +78,7 @@ impl ApiTracingLayer {
|
|||||||
pub fn change_api_log_level(max_level: Option<VeilidLogLevel>) {
|
pub fn change_api_log_level(max_level: Option<VeilidLogLevel>) {
|
||||||
if let Some(api_logger) = API_LOGGER.get() {
|
if let Some(api_logger) = API_LOGGER.get() {
|
||||||
if let Some(inner) = &mut *api_logger.inner.lock() {
|
if let Some(inner) = &mut *api_logger.inner.lock() {
|
||||||
*inner = Self::new_inner(max_level, inner.update_callback.clone());
|
inner.max_level = max_level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,12 @@ pub async fn sleep(millis: u32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn system_boxed<'a, Out>(
|
||||||
|
future: impl Future<Output = Out> + Send + 'a,
|
||||||
|
) -> SystemPinBoxFutureLifetime<'a, Out> {
|
||||||
|
Box::pin(future)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn spawn<Out>(future: impl Future<Output = Out> + Send + 'static) -> JoinHandle<Out>
|
pub fn spawn<Out>(future: impl Future<Output = Out> + Send + 'static) -> JoinHandle<Out>
|
||||||
where
|
where
|
||||||
Out: Send + 'static,
|
Out: Send + 'static,
|
||||||
|
@ -99,6 +99,12 @@ pub async fn sleep(millis: u32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn system_boxed<'a, Out>(
|
||||||
|
future: impl Future<Output = Out> + 'a,
|
||||||
|
) -> SystemPinBoxFutureLifetime<'a, Out> {
|
||||||
|
Box::pin(future)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn spawn<Out>(future: impl Future<Output = Out> + 'static) -> JoinHandle<Out>
|
pub fn spawn<Out>(future: impl Future<Output = Out> + 'static) -> JoinHandle<Out>
|
||||||
where
|
where
|
||||||
Out: Send + 'static,
|
Out: Send + 'static,
|
||||||
@ -203,10 +209,10 @@ pub async fn get_outbound_relay_peer() -> Option<crate::veilid_api::PeerInfo> {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
pub async fn txt_lookup<S: AsRef<str>>(host: S) -> Result<Vec<String>, String> {
|
pub async fn txt_lookup<S: AsRef<str>>(_host: S) -> Result<Vec<String>, String> {
|
||||||
Err("wasm does not support txt lookup".to_owned())
|
Err("wasm does not support txt lookup".to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn ptr_lookup(ip_addr: IpAddr) -> Result<String, String> {
|
pub async fn ptr_lookup(_ip_addr: IpAddr) -> Result<String, String> {
|
||||||
Err("wasm does not support ptr lookup".to_owned())
|
Err("wasm does not support ptr lookup".to_owned())
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ mod network_udp;
|
|||||||
mod protocol;
|
mod protocol;
|
||||||
mod start_protocols;
|
mod start_protocols;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
use crate::intf::*;
|
use crate::intf::*;
|
||||||
use crate::network_manager::*;
|
|
||||||
use crate::routing_table::*;
|
use crate::routing_table::*;
|
||||||
use connection_manager::*;
|
use connection_manager::*;
|
||||||
use network_tcp::*;
|
use network_tcp::*;
|
||||||
|
@ -224,72 +224,68 @@ impl NetworkConnection {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
let timer = MutableFuture::new(new_timer());
|
let timer = MutableFuture::new(new_timer());
|
||||||
unord.push(timer.clone().boxed());
|
|
||||||
|
unord.push(system_boxed(timer.clone()));
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
// Add another message sender future if necessary
|
// Add another message sender future if necessary
|
||||||
if need_sender {
|
if need_sender {
|
||||||
need_sender = false;
|
need_sender = false;
|
||||||
unord.push(
|
let sender_fut = receiver.recv_async().then(|res| async {
|
||||||
receiver
|
match res {
|
||||||
.recv_async()
|
Ok(message) => {
|
||||||
.then(|res| async {
|
// send the packet
|
||||||
match res {
|
if let Err(e) = Self::send_internal(
|
||||||
Ok(message) => {
|
&protocol_connection,
|
||||||
// send the packet
|
stats.clone(),
|
||||||
if let Err(e) = Self::send_internal(
|
message,
|
||||||
&protocol_connection,
|
)
|
||||||
stats.clone(),
|
.await
|
||||||
message,
|
{
|
||||||
)
|
// Sending the packet along can fail, if so, this connection is dead
|
||||||
.await
|
log_net!(debug e);
|
||||||
{
|
RecvLoopAction::Finish
|
||||||
// Sending the packet along can fail, if so, this connection is dead
|
} else {
|
||||||
log_net!(debug e);
|
RecvLoopAction::Send
|
||||||
RecvLoopAction::Finish
|
|
||||||
} else {
|
|
||||||
RecvLoopAction::Send
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
// All senders gone, shouldn't happen since we store one alongside the join handle
|
|
||||||
log_net!(warn e);
|
|
||||||
RecvLoopAction::Finish
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
.boxed(),
|
Err(e) => {
|
||||||
);
|
// All senders gone, shouldn't happen since we store one alongside the join handle
|
||||||
|
log_net!(warn e);
|
||||||
|
RecvLoopAction::Finish
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
unord.push(system_boxed(sender_fut));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add another message receiver future if necessary
|
// Add another message receiver future if necessary
|
||||||
if need_receiver {
|
if need_receiver {
|
||||||
need_sender = false;
|
need_receiver = false;
|
||||||
unord.push(
|
let receiver_fut = Self::recv_internal(&protocol_connection, stats.clone())
|
||||||
Self::recv_internal(&protocol_connection, stats.clone())
|
.then(|res| async {
|
||||||
.then(|res| async {
|
match res {
|
||||||
match res {
|
Ok(message) => {
|
||||||
Ok(message) => {
|
// Pass received messages up to the network manager for processing
|
||||||
// Pass received messages up to the network manager for processing
|
if let Err(e) = network_manager
|
||||||
if let Err(e) = network_manager
|
.on_recv_envelope(message.as_slice(), descriptor)
|
||||||
.on_recv_envelope(message.as_slice(), descriptor)
|
.await
|
||||||
.await
|
{
|
||||||
{
|
log_net!(error e);
|
||||||
log_net!(error e);
|
|
||||||
RecvLoopAction::Finish
|
|
||||||
} else {
|
|
||||||
RecvLoopAction::Recv
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
// Connection unable to receive, closed
|
|
||||||
log_net!(warn e);
|
|
||||||
RecvLoopAction::Finish
|
RecvLoopAction::Finish
|
||||||
|
} else {
|
||||||
|
RecvLoopAction::Recv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
Err(e) => {
|
||||||
.boxed(),
|
// Connection unable to receive, closed
|
||||||
);
|
log_net!(warn e);
|
||||||
|
RecvLoopAction::Finish
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
unord.push(system_boxed(receiver_fut));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process futures
|
// Process futures
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
mod protocol;
|
mod protocol;
|
||||||
|
|
||||||
use crate::connection_manager::*;
|
use super::*;
|
||||||
use crate::network_manager::*;
|
|
||||||
use crate::routing_table::*;
|
use crate::routing_table::*;
|
||||||
use crate::intf::*;
|
use connection_manager::*;
|
||||||
use crate::*;
|
|
||||||
use protocol::ws::WebsocketProtocolHandler;
|
use protocol::ws::WebsocketProtocolHandler;
|
||||||
pub use protocol::*;
|
pub use protocol::*;
|
||||||
|
|
||||||
@ -102,11 +100,11 @@ impl Network {
|
|||||||
// Try to send to the exact existing connection if one exists
|
// Try to send to the exact existing connection if one exists
|
||||||
if let Some(conn) = self.connection_manager().get_connection(descriptor).await {
|
if let Some(conn) = self.connection_manager().get_connection(descriptor).await {
|
||||||
// connection exists, send over it
|
// connection exists, send over it
|
||||||
conn.send(data).await.map_err(logthru_net!())?;
|
conn.send_async(data).await.map_err(logthru_net!())?;
|
||||||
|
|
||||||
// Network accounting
|
// Network accounting
|
||||||
self.network_manager()
|
self.network_manager()
|
||||||
.stats_packet_sent(descriptor.remote.to_socket_addr().ip(), data_len as u64);
|
.stats_packet_sent(descriptor.remote().to_socket_addr().ip(), data_len as u64);
|
||||||
|
|
||||||
// Data was consumed
|
// Data was consumed
|
||||||
Ok(None)
|
Ok(None)
|
||||||
@ -136,7 +134,7 @@ impl Network {
|
|||||||
.get_or_create_connection(None, dial_info.clone())
|
.get_or_create_connection(None, dial_info.clone())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let res = conn.send(data).await.map_err(logthru_net!(error));
|
let res = conn.send_async(data).await.map_err(logthru_net!(error));
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
// Network accounting
|
// Network accounting
|
||||||
self.network_manager()
|
self.network_manager()
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
pub mod wrtc;
|
pub mod wrtc;
|
||||||
pub mod ws;
|
pub mod ws;
|
||||||
|
|
||||||
use crate::network_connection::*;
|
use super::*;
|
||||||
use crate::xx::*;
|
use crate::xx::*;
|
||||||
use crate::*;
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ProtocolNetworkConnection {
|
pub enum ProtocolNetworkConnection {
|
||||||
@ -16,7 +15,7 @@ impl ProtocolNetworkConnection {
|
|||||||
pub async fn connect(
|
pub async fn connect(
|
||||||
local_address: Option<SocketAddr>,
|
local_address: Option<SocketAddr>,
|
||||||
dial_info: DialInfo,
|
dial_info: DialInfo,
|
||||||
) -> Result<NetworkConnection, String> {
|
) -> Result<ProtocolNetworkConnection, String> {
|
||||||
match dial_info.protocol_type() {
|
match dial_info.protocol_type() {
|
||||||
ProtocolType::UDP => {
|
ProtocolType::UDP => {
|
||||||
panic!("UDP dial info is not support on WASM targets");
|
panic!("UDP dial info is not support on WASM targets");
|
||||||
@ -46,6 +45,14 @@ impl ProtocolNetworkConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn descriptor(&self) -> ConnectionDescriptor {
|
||||||
|
match self {
|
||||||
|
Self::Dummy(d) => d.descriptor(),
|
||||||
|
Self::Ws(w) => w.descriptor(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn close(&self) -> Result<(), String> {
|
pub async fn close(&self) -> Result<(), String> {
|
||||||
match self {
|
match self {
|
||||||
Self::Dummy(d) => d.close(),
|
Self::Dummy(d) => d.close(),
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
use crate::intf::*;
|
use super::*;
|
||||||
use crate::network_connection::*;
|
|
||||||
use crate::network_manager::MAX_MESSAGE_SIZE;
|
|
||||||
use crate::*;
|
|
||||||
use alloc::fmt;
|
|
||||||
use ws_stream_wasm::*;
|
use ws_stream_wasm::*;
|
||||||
use futures_util::{StreamExt, SinkExt};
|
use futures_util::{StreamExt, SinkExt};
|
||||||
|
|
||||||
@ -104,10 +100,9 @@ impl WebsocketProtocolHandler {
|
|||||||
|
|
||||||
// Make our connection descriptor
|
// Make our connection descriptor
|
||||||
|
|
||||||
Ok(ProtocolNetworkConnection::Ws(WebsocketNetworkConnection::new(ConnectionDescriptor {
|
Ok(ProtocolNetworkConnection::Ws(WebsocketNetworkConnection::new(ConnectionDescriptor::new_no_local(
|
||||||
local: None,
|
dial_info.to_peer_address(),
|
||||||
remote: dial_info.to_peer_address(),
|
), wsmeta, wsio)))
|
||||||
}, wsmeta, wsio)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn send_unbound_message(dial_info: DialInfo, data: Vec<u8>) -> Result<(), String> {
|
pub async fn send_unbound_message(dial_info: DialInfo, data: Vec<u8>) -> Result<(), String> {
|
||||||
|
@ -3,3 +3,8 @@ pub mod test_protected_store;
|
|||||||
pub mod test_table_store;
|
pub mod test_table_store;
|
||||||
pub mod test_veilid_config;
|
pub mod test_veilid_config;
|
||||||
pub mod test_veilid_core;
|
pub mod test_veilid_core;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
pub use dht::tests::*;
|
||||||
|
pub use network_manager::tests::*;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
pub mod common;
|
pub mod common;
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
mod native;
|
mod native;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
@ -1133,13 +1133,24 @@ impl DialInfo {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let socket_addrs = match split_url.host {
|
let socket_addrs = {
|
||||||
SplitUrlHost::Hostname(_) => split_url
|
// Resolve if possible, WASM doesn't support resolution and doesn't need it to connect to the dialinfo
|
||||||
.host_port(port)
|
// This will not be used on signed dialinfo, only for bootstrapping, so we don't need to worry about
|
||||||
.to_socket_addrs()
|
// the '0.0.0.0' address being propagated across the routing table
|
||||||
.map_err(|_| parse_error!("couldn't resolve hostname in url", url))?
|
cfg_if::cfg_if! {
|
||||||
.collect(),
|
if #[cfg(target_arch = "wasm32")] {
|
||||||
SplitUrlHost::IpAddr(a) => vec![SocketAddr::new(a, port)],
|
vec![SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0,0,0,0)), port)]
|
||||||
|
} else {
|
||||||
|
match split_url.host {
|
||||||
|
SplitUrlHost::Hostname(_) => split_url
|
||||||
|
.host_port(port)
|
||||||
|
.to_socket_addrs()
|
||||||
|
.map_err(|_| parse_error!("couldn't resolve hostname in url", url))?
|
||||||
|
.collect(),
|
||||||
|
SplitUrlHost::IpAddr(a) => vec![SocketAddr::new(a, port)],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut out = Vec::new();
|
let mut out = Vec::new();
|
||||||
|
@ -229,7 +229,7 @@ cfg_if::cfg_if! {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pub fn ensure_file_private_owner<P:AsRef<Path>>(path: P) -> Result<(),String>
|
pub fn ensure_file_private_owner<P:AsRef<Path>>(_path: P) -> Result<(),String>
|
||||||
{
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
use veilid_core::tests::common::*;
|
use veilid_core::tests::common::*;
|
||||||
use veilid_core::xx::*;
|
use veilid_core::xx::*;
|
||||||
use veilid_core::*;
|
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
|
|
||||||
wasm_bindgen_test_configure!();
|
wasm_bindgen_test_configure!();
|
||||||
@ -16,7 +15,7 @@ static SETUP_ONCE: Once = Once::new();
|
|||||||
pub fn setup() -> () {
|
pub fn setup() -> () {
|
||||||
SETUP_ONCE.call_once(|| {
|
SETUP_ONCE.call_once(|| {
|
||||||
console_error_panic_hook::set_once();
|
console_error_panic_hook::set_once();
|
||||||
wasm_logger::init(wasm_logger::Config::new(Level::Trace));
|
wasm_logger::init(wasm_logger::Config::new(log::Level::Trace));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
use veilid_core::tests::common::*;
|
use veilid_core::tests::common::*;
|
||||||
use veilid_core::xx::*;
|
use veilid_core::xx::*;
|
||||||
use veilid_core::*;
|
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
|
|
||||||
wasm_bindgen_test_configure!(run_in_browser);
|
wasm_bindgen_test_configure!(run_in_browser);
|
||||||
@ -16,7 +15,11 @@ static SETUP_ONCE: Once = Once::new();
|
|||||||
pub fn setup() -> () {
|
pub fn setup() -> () {
|
||||||
SETUP_ONCE.call_once(|| {
|
SETUP_ONCE.call_once(|| {
|
||||||
console_error_panic_hook::set_once();
|
console_error_panic_hook::set_once();
|
||||||
wasm_logger::init(wasm_logger::Config::new(Level::Trace));
|
let mut builder = tracing_wasm::WASMLayerConfigBuilder::new();
|
||||||
|
builder.set_report_logs_in_timings(false);
|
||||||
|
builder.set_max_level(Level::TRACE);
|
||||||
|
builder.set_console_config(tracing_wasm::ConsoleConfig::ReportWithConsoleColor);
|
||||||
|
tracing_wasm::set_as_global_default_with_config(builder.build());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
116
veilid-core/veilid-core-node/.gitignore
vendored
116
veilid-core/veilid-core-node/.gitignore
vendored
@ -1,116 +0,0 @@
|
|||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
lerna-debug.log*
|
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.pid.lock
|
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
coverage
|
|
||||||
*.lcov
|
|
||||||
|
|
||||||
# nyc test coverage
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# Bower dependency directory (https://bower.io/)
|
|
||||||
bower_components
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directories
|
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
|
||||||
|
|
||||||
# Snowpack dependency directory (https://snowpack.dev/)
|
|
||||||
web_modules/
|
|
||||||
|
|
||||||
# TypeScript cache
|
|
||||||
*.tsbuildinfo
|
|
||||||
|
|
||||||
# Optional npm cache directory
|
|
||||||
.npm
|
|
||||||
|
|
||||||
# Optional eslint cache
|
|
||||||
.eslintcache
|
|
||||||
|
|
||||||
# Microbundle cache
|
|
||||||
.rpt2_cache/
|
|
||||||
.rts2_cache_cjs/
|
|
||||||
.rts2_cache_es/
|
|
||||||
.rts2_cache_umd/
|
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
.node_repl_history
|
|
||||||
|
|
||||||
# Output of 'npm pack'
|
|
||||||
*.tgz
|
|
||||||
|
|
||||||
# Yarn Integrity file
|
|
||||||
.yarn-integrity
|
|
||||||
|
|
||||||
# dotenv environment variables file
|
|
||||||
.env
|
|
||||||
.env.test
|
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
|
||||||
.cache
|
|
||||||
.parcel-cache
|
|
||||||
|
|
||||||
# Next.js build output
|
|
||||||
.next
|
|
||||||
out
|
|
||||||
|
|
||||||
# Nuxt.js build / generate output
|
|
||||||
.nuxt
|
|
||||||
dist
|
|
||||||
|
|
||||||
# Gatsby files
|
|
||||||
.cache/
|
|
||||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
||||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
||||||
# public
|
|
||||||
|
|
||||||
# vuepress build output
|
|
||||||
.vuepress/dist
|
|
||||||
|
|
||||||
# Serverless directories
|
|
||||||
.serverless/
|
|
||||||
|
|
||||||
# FuseBox cache
|
|
||||||
.fusebox/
|
|
||||||
|
|
||||||
# DynamoDB Local files
|
|
||||||
.dynamodb/
|
|
||||||
|
|
||||||
# TernJS port file
|
|
||||||
.tern-port
|
|
||||||
|
|
||||||
# Stores VSCode versions used for testing VSCode extensions
|
|
||||||
.vscode-test
|
|
||||||
|
|
||||||
# yarn v2
|
|
||||||
.yarn/cache
|
|
||||||
.yarn/unplugged
|
|
||||||
.yarn/build-state.yml
|
|
||||||
.yarn/install-state.gz
|
|
||||||
.pnp.*
|
|
@ -1 +0,0 @@
|
|||||||
exports.keytar = require("keytar");
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "veilid-core-node",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"keytar": "^6.0.1"
|
|
||||||
}
|
|
||||||
}
|
|
@ -96,8 +96,8 @@ core:
|
|||||||
enable_local_peer_scope: false
|
enable_local_peer_scope: false
|
||||||
restricted_nat_retries: 0
|
restricted_nat_retries: 0
|
||||||
tls:
|
tls:
|
||||||
certificate_path: '%CERTIFICATE_DIRECTORY%/server.crt'
|
certificate_path: '%CERTIFICATE_PATH%'
|
||||||
private_key_path: '%PRIVATE_KEY_DIRECTORY%/server.key'
|
private_key_path: '%PRIVATE_KEY_PATH%'
|
||||||
connection_initial_timeout_ms: 2000
|
connection_initial_timeout_ms: 2000
|
||||||
application:
|
application:
|
||||||
https:
|
https:
|
||||||
@ -151,12 +151,16 @@ core:
|
|||||||
&Settings::get_default_protected_store_insecure_fallback_directory().to_string_lossy(),
|
&Settings::get_default_protected_store_insecure_fallback_directory().to_string_lossy(),
|
||||||
)
|
)
|
||||||
.replace(
|
.replace(
|
||||||
"%CERTIFICATE_DIRECTORY%",
|
"%CERTIFICATE_PATH%",
|
||||||
&Settings::get_default_certificate_directory().to_string_lossy(),
|
&Settings::get_default_certificate_directory()
|
||||||
|
.join("server.crt")
|
||||||
|
.to_string_lossy(),
|
||||||
)
|
)
|
||||||
.replace(
|
.replace(
|
||||||
"%PRIVATE_KEY_DIRECTORY%",
|
"%PRIVATE_KEY_PATH%",
|
||||||
&Settings::get_default_private_key_directory().to_string_lossy(),
|
&Settings::get_default_private_key_directory()
|
||||||
|
.join("server.key")
|
||||||
|
.to_string_lossy(),
|
||||||
);
|
);
|
||||||
config::Config::builder()
|
config::Config::builder()
|
||||||
.add_source(config::File::from_str(
|
.add_source(config::File::from_str(
|
||||||
@ -1439,7 +1443,7 @@ mod tests {
|
|||||||
//
|
//
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
s.core.network.bootstrap,
|
s.core.network.bootstrap,
|
||||||
vec!["bootstrap.veilid.net".to_owned()]
|
vec!["bootstrap-dev.veilid.net".to_owned()]
|
||||||
);
|
);
|
||||||
assert_eq!(s.core.network.bootstrap_nodes, vec![]);
|
assert_eq!(s.core.network.bootstrap_nodes, vec![]);
|
||||||
//
|
//
|
||||||
@ -1460,25 +1464,25 @@ mod tests {
|
|||||||
assert_eq!(s.core.network.dht.set_value_timeout_ms, None);
|
assert_eq!(s.core.network.dht.set_value_timeout_ms, None);
|
||||||
assert_eq!(s.core.network.dht.set_value_count, 20u32);
|
assert_eq!(s.core.network.dht.set_value_count, 20u32);
|
||||||
assert_eq!(s.core.network.dht.set_value_fanout, 5u32);
|
assert_eq!(s.core.network.dht.set_value_fanout, 5u32);
|
||||||
assert_eq!(s.core.network.dht.min_peer_count, 20u32);
|
assert_eq!(s.core.network.dht.min_peer_count, 1u32);
|
||||||
assert_eq!(s.core.network.dht.min_peer_refresh_time_ms, 2_000u32);
|
assert_eq!(s.core.network.dht.min_peer_refresh_time_ms, 2_000u32);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
s.core.network.dht.validate_dial_info_receipt_time_ms,
|
s.core.network.dht.validate_dial_info_receipt_time_ms,
|
||||||
5_000u32
|
2_000u32
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
assert_eq!(s.core.network.upnp, false);
|
assert_eq!(s.core.network.upnp, false);
|
||||||
assert_eq!(s.core.network.natpmp, false);
|
assert_eq!(s.core.network.natpmp, false);
|
||||||
assert_eq!(s.core.network.enable_local_peer_scope, false);
|
assert_eq!(s.core.network.enable_local_peer_scope, false);
|
||||||
assert_eq!(s.core.network.restricted_nat_retries, 3u32);
|
assert_eq!(s.core.network.restricted_nat_retries, 0u32);
|
||||||
//
|
//
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
s.core.network.tls.certificate_path,
|
s.core.network.tls.certificate_path,
|
||||||
std::path::PathBuf::from("/etc/veilid-server/server.crt")
|
Settings::get_default_certificate_directory().join("server.crt")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
s.core.network.tls.private_key_path,
|
s.core.network.tls.private_key_path,
|
||||||
std::path::PathBuf::from("/etc/veilid-server/private/server.key")
|
Settings::get_default_private_key_directory().join("server.key")
|
||||||
);
|
);
|
||||||
assert_eq!(s.core.network.tls.connection_initial_timeout_ms, 2_000u32);
|
assert_eq!(s.core.network.tls.connection_initial_timeout_ms, 2_000u32);
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user