diff --git a/doc/config/sample.config b/doc/config/sample.config index 1d52f579..3fd37b59 100644 --- a/doc/config/sample.config +++ b/doc/config/sample.config @@ -31,7 +31,7 @@ core: protected_store: allow_insecure_fallback: true always_use_insecure_storage: true - insecure_fallback_directory: '%INSECURE_FALLBACK_DIRECTORY%' + directory: '%DIRECTORY%' delete: false table_store: directory: '%TABLE_STORE_DIRECTORY%' diff --git a/doc/config/veilid-server-config.md b/doc/config/veilid-server-config.md index e4a2ecc5..388e3b0f 100644 --- a/doc/config/veilid-server-config.md +++ b/doc/config/veilid-server-config.md @@ -155,7 +155,7 @@ testing: protected_store: allow_insecure_fallback: true always_use_insecure_storage: true - insecure_fallback_directory: '%INSECURE_FALLBACK_DIRECTORY%' + directory: '%DIRECTORY%' delete: false ``` diff --git a/package/linux/veilid-server.conf b/package/linux/veilid-server.conf index cd94b5d7..c7126e01 100644 --- a/package/linux/veilid-server.conf +++ b/package/linux/veilid-server.conf @@ -14,7 +14,7 @@ logging: enabled: false core: protected_store: - insecure_fallback_directory: '/var/db/veilid-server/protected_store' + directory: '/var/db/veilid-server/protected_store' table_store: directory: '/var/db/veilid-server/table_store' block_store: diff --git a/scripts/ios_build.sh b/scripts/ios_build.sh index 51307e68..26d50ff4 100755 --- a/scripts/ios_build.sh +++ b/scripts/ios_build.sh @@ -57,7 +57,7 @@ do HOMEBREW_DIR=$(dirname `which brew`) fi - env -i PATH=/usr/bin:/bin:$HOMEBREW_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH + env -i PATH=/usr/bin:/bin:$HOMEBREW_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" IPHONEOS_DEPLOYMENT_TARGET="$IPHONEOS_DEPLOYMENT_TARGET" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH LIPOS="$LIPOS $TARGET_PATH/$CARGO_TARGET/$BUILD_MODE/lib$PACKAGE_NAME.a" diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh index 88fc470c..61703127 100755 --- a/scripts/macos_build.sh +++ b/scripts/macos_build.sh @@ -47,7 +47,7 @@ do HOMEBREW_DIR=$(dirname `which brew`) fi - env -i PATH=/usr/bin:/bin:$HOMEBREW_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH + env -i PATH=/usr/bin:/bin:$HOMEBREW_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" MACOSX_DEPLOYMENT_TARGET="$MACOSX_DEPLOYMENT_TARGET" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH LIPOS="$LIPOS $TARGET_PATH/$CARGO_TARGET/$BUILD_MODE/lib$PACKAGE_NAME.dylib" diff --git a/veilid-core/src/intf/native/protected_store.rs b/veilid-core/src/intf/native/protected_store.rs index 5d1b9a28..40d566a4 100644 --- a/veilid-core/src/intf/native/protected_store.rs +++ b/veilid-core/src/intf/native/protected_store.rs @@ -64,9 +64,8 @@ impl ProtectedStore { || c.protected_store.allow_insecure_fallback) && inner.keyring_manager.is_none() { - let insecure_fallback_directory = - Path::new(&c.protected_store.insecure_fallback_directory); - let insecure_keyring_file = insecure_fallback_directory.to_owned().join(format!( + let directory = Path::new(&c.protected_store.directory); + let insecure_keyring_file = directory.to_owned().join(format!( "insecure_keyring{}", if c.namespace.is_empty() { "".to_owned() diff --git a/veilid-core/src/routing_table/debug.rs b/veilid-core/src/routing_table/debug.rs index 7e1cf476..36bd83d0 100644 --- a/veilid-core/src/routing_table/debug.rs +++ b/veilid-core/src/routing_table/debug.rs @@ -130,13 +130,22 @@ impl RoutingTable { for e in filtered_entries { let state = e.1.with(inner, |_rti, e| e.state(cur_ts)); out += &format!( - " {} [{}]\n", + " {} [{}] {}\n", e.0.encode(), match state { BucketEntryState::Reliable => "R", BucketEntryState::Unreliable => "U", BucketEntryState::Dead => "D", - } + }, + e.1.with(inner, |_rti, e| { + e.peer_stats() + .latency + .as_ref() + .map(|l| { + format!("{:.2}ms", timestamp_to_secs(l.average.as_u64())) + }) + .unwrap_or_else(|| "???.??ms".to_string()) + }) ); } } diff --git a/veilid-core/src/tests/common/test_veilid_config.rs b/veilid-core/src/tests/common/test_veilid_config.rs index 8fa4a634..e2670f94 100644 --- a/veilid-core/src/tests/common/test_veilid_config.rs +++ b/veilid-core/src/tests/common/test_veilid_config.rs @@ -181,7 +181,7 @@ fn config_callback(key: String) -> ConfigCallbackReturn { "block_store.delete" => Ok(Box::new(false)), "protected_store.allow_insecure_fallback" => Ok(Box::new(true)), "protected_store.always_use_insecure_storage" => Ok(Box::new(false)), - "protected_store.insecure_fallback_directory" => Ok(Box::new(get_protected_store_path())), + "protected_store.directory" => Ok(Box::new(get_protected_store_path())), "protected_store.delete" => Ok(Box::new(false)), "network.connection_initial_timeout_ms" => Ok(Box::new(2_000u32)), "network.connection_inactivity_timeout_ms" => Ok(Box::new(60_000u32)), @@ -307,10 +307,7 @@ pub async fn test_config() { assert_eq!(inner.block_store.delete, false); assert_eq!(inner.protected_store.allow_insecure_fallback, true); assert_eq!(inner.protected_store.always_use_insecure_storage, false); - assert_eq!( - inner.protected_store.insecure_fallback_directory, - get_protected_store_path() - ); + assert_eq!(inner.protected_store.directory, get_protected_store_path()); assert_eq!(inner.protected_store.delete, false); assert_eq!(inner.network.connection_initial_timeout_ms, 2_000u32); assert_eq!(inner.network.connection_inactivity_timeout_ms, 60_000u32); diff --git a/veilid-core/src/veilid_config.rs b/veilid-core/src/veilid_config.rs index 46b14245..d79377af 100644 --- a/veilid-core/src/veilid_config.rs +++ b/veilid-core/src/veilid_config.rs @@ -429,7 +429,7 @@ pub struct VeilidConfigBlockStore { pub struct VeilidConfigProtectedStore { pub allow_insecure_fallback: bool, pub always_use_insecure_storage: bool, - pub insecure_fallback_directory: String, + pub directory: String, pub delete: bool, } @@ -634,7 +634,7 @@ impl VeilidConfig { get_config!(inner.block_store.delete); get_config!(inner.protected_store.allow_insecure_fallback); get_config!(inner.protected_store.always_use_insecure_storage); - get_config!(inner.protected_store.insecure_fallback_directory); + get_config!(inner.protected_store.directory); get_config!(inner.protected_store.delete); get_config!(inner.network.connection_initial_timeout_ms); get_config!(inner.network.connection_inactivity_timeout_ms); diff --git a/veilid-flutter/lib/default_config.dart b/veilid-flutter/lib/default_config.dart index 7d92a7e8..f246bb07 100644 --- a/veilid-flutter/lib/default_config.dart +++ b/veilid-flutter/lib/default_config.dart @@ -64,7 +64,7 @@ Future getDefaultVeilidConfig(String programName) async { protectedStore: VeilidConfigProtectedStore( allowInsecureFallback: false, alwaysUseInsecureStorage: false, - insecureFallbackDirectory: "", + directory: "", delete: false, ), tableStore: VeilidConfigTableStore( diff --git a/veilid-flutter/lib/veilid_config.dart b/veilid-flutter/lib/veilid_config.dart index 060e6c3e..a062b8d3 100644 --- a/veilid-flutter/lib/veilid_config.dart +++ b/veilid-flutter/lib/veilid_config.dart @@ -826,13 +826,13 @@ class VeilidConfigBlockStore { class VeilidConfigProtectedStore { bool allowInsecureFallback; bool alwaysUseInsecureStorage; - String insecureFallbackDirectory; + String directory; bool delete; VeilidConfigProtectedStore({ required this.allowInsecureFallback, required this.alwaysUseInsecureStorage, - required this.insecureFallbackDirectory, + required this.directory, required this.delete, }); @@ -840,7 +840,7 @@ class VeilidConfigProtectedStore { return { 'allow_insecure_fallback': allowInsecureFallback, 'always_use_insecure_storage': alwaysUseInsecureStorage, - 'insecure_fallback_directory': insecureFallbackDirectory, + 'directory': directory, 'delete': delete, }; } @@ -848,7 +848,7 @@ class VeilidConfigProtectedStore { VeilidConfigProtectedStore.fromJson(dynamic json) : allowInsecureFallback = json['allow_insecure_fallback'], alwaysUseInsecureStorage = json['always_use_insecure_storage'], - insecureFallbackDirectory = json['insecure_fallback_directory'], + directory = json['directory'], delete = json['delete']; } diff --git a/veilid-server/src/settings.rs b/veilid-server/src/settings.rs index a53c1a31..4be95521 100644 --- a/veilid-server/src/settings.rs +++ b/veilid-server/src/settings.rs @@ -47,7 +47,7 @@ core: protected_store: allow_insecure_fallback: true always_use_insecure_storage: true - insecure_fallback_directory: '%INSECURE_FALLBACK_DIRECTORY%' + directory: '%DIRECTORY%' delete: false table_store: directory: '%TABLE_STORE_DIRECTORY%' @@ -157,8 +157,8 @@ core: &Settings::get_default_block_store_path().to_string_lossy(), ) .replace( - "%INSECURE_FALLBACK_DIRECTORY%", - &Settings::get_default_protected_store_insecure_fallback_directory().to_string_lossy(), + "%DIRECTORY%", + &Settings::get_default_protected_store_directory().to_string_lossy(), ) .replace( "%CERTIFICATE_PATH%", @@ -586,7 +586,7 @@ pub struct BlockStore { pub struct ProtectedStore { pub allow_insecure_fallback: bool, pub always_use_insecure_storage: bool, - pub insecure_fallback_directory: PathBuf, + pub directory: PathBuf, pub delete: bool, } @@ -795,7 +795,7 @@ impl Settings { bs_path } - pub fn get_default_protected_store_insecure_fallback_directory() -> PathBuf { + pub fn get_default_protected_store_directory() -> PathBuf { #[cfg(unix)] { let globalpath = PathBuf::from("/var/db/veilid-server/protected_store"); @@ -935,10 +935,7 @@ impl Settings { inner.core.protected_store.always_use_insecure_storage, value ); - set_config_value!( - inner.core.protected_store.insecure_fallback_directory, - value - ); + set_config_value!(inner.core.protected_store.directory, value); set_config_value!(inner.core.protected_store.delete, value); set_config_value!(inner.core.table_store.directory, value); set_config_value!(inner.core.table_store.delete, value); @@ -1065,11 +1062,11 @@ impl Settings { "protected_store.always_use_insecure_storage" => Ok(Box::new( inner.core.protected_store.always_use_insecure_storage, )), - "protected_store.insecure_fallback_directory" => Ok(Box::new( + "protected_store.directory" => Ok(Box::new( inner .core .protected_store - .insecure_fallback_directory + .directory .to_string_lossy() .to_string(), )), @@ -1504,8 +1501,8 @@ mod tests { assert_eq!(s.core.protected_store.allow_insecure_fallback, true); assert_eq!(s.core.protected_store.always_use_insecure_storage, true); assert_eq!( - s.core.protected_store.insecure_fallback_directory, - Settings::get_default_protected_store_insecure_fallback_directory() + s.core.protected_store.directory, + Settings::get_default_protected_store_directory() ); assert_eq!(s.core.protected_store.delete, false);