Few tiny improvements

This commit is contained in:
neequ57 2024-10-23 21:58:29 +00:00 committed by Christien Rioux
parent 59630dbe8c
commit 736179fa04
7 changed files with 31 additions and 62 deletions

View File

@ -2,11 +2,11 @@
## Instance Recommended Setup ## Instance Recommended Setup
CPU: Single CPU: Single<br>
RAM: 1GB RAM: 1GB<br>
Storage: 25GB Storage: 25GB<br>
IP: Static v4 & v6 IP: Static v4 & v6<br>
Firewall: 5150/TCP/UDP inbound allow all Firewall: 5150/TCP/UDP inbound allow all<br>
## Install Veilid ## Install Veilid

40
Cargo.lock generated
View File

@ -1193,25 +1193,6 @@ dependencies = [
"crossbeam-utils", "crossbeam-utils",
] ]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.20" version = "0.8.20"
@ -4115,26 +4096,6 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9"
[[package]]
name = "rayon"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.2.16" version = "0.2.16"
@ -4995,7 +4956,6 @@ dependencies = [
"libc", "libc",
"ntapi", "ntapi",
"once_cell", "once_cell",
"rayon",
"windows 0.52.0", "windows 0.52.0",
] ]

View File

@ -156,7 +156,7 @@ nix = "0.27.1"
# System # System
async-std = { version = "1.12.0", features = ["unstable"], optional = true } async-std = { version = "1.12.0", features = ["unstable"], optional = true }
sysinfo = { version = "^0.30.13" } sysinfo = { version = "^0.30.13", default-features = false }
tokio = { version = "1.38.1", features = ["full"], optional = true } tokio = { version = "1.38.1", features = ["full"], optional = true }
tokio-util = { version = "0.7.11", features = ["compat"], optional = true } tokio-util = { version = "0.7.11", features = ["compat"], optional = true }
tokio-stream = { version = "0.1.15", features = ["net"], optional = true } tokio-stream = { version = "0.1.15", features = ["net"], optional = true }

View File

@ -256,7 +256,7 @@ impl TableStore {
let kind = FourCC::try_from(&dek_bytes[0..4]).unwrap(); let kind = FourCC::try_from(&dek_bytes[0..4]).unwrap();
let crypto = self.inner.lock().crypto.as_ref().unwrap().clone(); let crypto = self.inner.lock().crypto.as_ref().unwrap().clone();
let Some(vcrypto) = crypto.get(kind) else { let Some(vcrypto) = crypto.get(kind) else {
bail!("unsupported cryptosystem"); bail!("unsupported cryptosystem '{kind}'");
}; };
if !device_encryption_key_password.is_empty() { if !device_encryption_key_password.is_empty() {
@ -312,7 +312,7 @@ impl TableStore {
// Get cryptosystem // Get cryptosystem
let crypto = self.inner.lock().crypto.as_ref().unwrap().clone(); let crypto = self.inner.lock().crypto.as_ref().unwrap().clone();
let Some(vcrypto) = crypto.get(dek.kind) else { let Some(vcrypto) = crypto.get(dek.kind) else {
bail!("unsupported cryptosystem"); bail!("unsupported cryptosystem '{}'", dek.kind);
}; };
let nonce = vcrypto.random_nonce(); let nonce = vcrypto.random_nonce();

View File

@ -36,14 +36,14 @@ impl AttachmentState {
impl fmt::Display for AttachmentState { impl fmt::Display for AttachmentState {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
let out = match self { let out = match self {
AttachmentState::Attaching => "attaching".to_owned(), AttachmentState::Attaching => "attaching",
AttachmentState::AttachedWeak => "attached_weak".to_owned(), AttachmentState::AttachedWeak => "attached_weak",
AttachmentState::AttachedGood => "attached_good".to_owned(), AttachmentState::AttachedGood => "attached_good",
AttachmentState::AttachedStrong => "attached_strong".to_owned(), AttachmentState::AttachedStrong => "attached_strong",
AttachmentState::FullyAttached => "fully_attached".to_owned(), AttachmentState::FullyAttached => "fully_attached",
AttachmentState::OverAttached => "over_attached".to_owned(), AttachmentState::OverAttached => "over_attached",
AttachmentState::Detaching => "detaching".to_owned(), AttachmentState::Detaching => "detaching",
AttachmentState::Detached => "detached".to_owned(), AttachmentState::Detached => "detached",
}; };
write!(f, "{}", out) write!(f, "{}", out)
} }
@ -53,7 +53,15 @@ impl TryFrom<String> for AttachmentState {
type Error = (); type Error = ();
fn try_from(s: String) -> Result<Self, Self::Error> { fn try_from(s: String) -> Result<Self, Self::Error> {
Ok(match s.as_str() { AttachmentState::try_from(s.as_ref())
}
}
impl TryFrom<&str> for AttachmentState {
type Error = ();
fn try_from(s: &str) -> Result<Self, Self::Error> {
Ok(match s {
"attaching" => AttachmentState::Attaching, "attaching" => AttachmentState::Attaching,
"attached_weak" => AttachmentState::AttachedWeak, "attached_weak" => AttachmentState::AttachedWeak,
"attached_good" => AttachmentState::AttachedGood, "attached_good" => AttachmentState::AttachedGood,

View File

@ -81,7 +81,7 @@ flume = { version = "^0", features = ["async"] }
rpassword = "^7" rpassword = "^7"
hostname = "^0" hostname = "^0"
stop-token = { version = "^0", default-features = false } stop-token = { version = "^0", default-features = false }
sysinfo = { version = "^0.30.13" } sysinfo = { version = "^0.30.13", default-features = false }
wg = { version = "^0.9.1", features = ["future"] } wg = { version = "^0.9.1", features = ["future"] }
tracing-flame = "0.2.0" tracing-flame = "0.2.0"
time = { version = "0.3.36", features = ["local-offset"] } time = { version = "0.3.36", features = ["local-offset"] }

View File

@ -328,10 +328,11 @@ pub struct ParsedUrl {
impl ParsedUrl { impl ParsedUrl {
pub fn offset_port(&mut self, offset: u16) -> EyreResult<()> { pub fn offset_port(&mut self, offset: u16) -> EyreResult<()> {
let new_port = self.url.port().unwrap() + offset;
// Bump port on url // Bump port on url
self.url self.url
.set_port(Some(self.url.port().unwrap() + offset)) .set_port(Some(new_port))
.map_err(|_| eyre!("failed to set port on url"))?; .map_err(|_| eyre!("failed to set port {new_port} on url {}", self.url.as_str()))?;
self.urlstring = self.url.to_string(); self.urlstring = self.url.to_string();
Ok(()) Ok(())
} }
@ -766,7 +767,7 @@ impl Settings {
if inner.client_api.ipc_enabled if inner.client_api.ipc_enabled
&& !Self::get_or_create_private_directory(&inner.client_api.ipc_directory, true) && !Self::get_or_create_private_directory(&inner.client_api.ipc_directory, true)
{ {
bail!("unable to create default IPC directory"); bail!("unable to create default IPC directory {:?}", inner.client_api.ipc_directory);
} }
} }
} }
@ -1163,7 +1164,7 @@ impl Settings {
set_config_value!(inner.core.network.protocol.wss.listen_address, value); set_config_value!(inner.core.network.protocol.wss.listen_address, value);
set_config_value!(inner.core.network.protocol.wss.path, value); set_config_value!(inner.core.network.protocol.wss.path, value);
set_config_value!(inner.core.network.protocol.wss.url, value); set_config_value!(inner.core.network.protocol.wss.url, value);
Err(eyre!("settings key not found")) Err(eyre!("settings key '{key}' not found"))
} }
pub fn get_core_config_callback(&self) -> veilid_core::ConfigCallback { pub fn get_core_config_callback(&self) -> veilid_core::ConfigCallback {