fix: move tg_connect to general, rustfmt upstream, fix UpstreamManager::new tests

- Relocate tg_connect from [timeouts] to [general] with validation and docs updates.
- Apply rustfmt to per-attempt upstream connect timeout expression in upstream.rs.
- Pass tg_connect_timeout_secs in all UpstreamManager::new test call sites.
- Wire hot reload and runtime snapshot to general.tg_connect.
This commit is contained in:
sintanial
2026-03-28 14:23:43 +03:00
parent 3b9919fa4d
commit d06ac222d6
33 changed files with 81 additions and 15 deletions

View File

@@ -346,9 +346,9 @@ impl ProxyConfig {
));
}
if config.timeouts.tg_connect == 0 {
if config.general.tg_connect == 0 {
return Err(ProxyError::Config(
"timeouts.tg_connect must be > 0".to_string(),
"general.tg_connect must be > 0".to_string(),
));
}
@@ -1916,7 +1916,7 @@ mod tests {
#[test]
fn tg_connect_zero_is_rejected() {
let toml = r#"
[timeouts]
[general]
tg_connect = 0
[censorship]
@@ -1929,7 +1929,7 @@ mod tests {
let path = dir.join("telemt_tg_connect_zero_test.toml");
std::fs::write(&path, toml).unwrap();
let err = ProxyConfig::load(&path).unwrap_err().to_string();
assert!(err.contains("timeouts.tg_connect must be > 0"));
assert!(err.contains("general.tg_connect must be > 0"));
let _ = std::fs::remove_file(path);
}