mirror of
https://github.com/telemt/telemt.git
synced 2026-11-01 13:21:58 +03:00
Fix autonomous ME recovery from Direct fallback
Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
This commit is contained in:
@@ -59,7 +59,7 @@ const DEFAULT_ME_POOL_DRAIN_SOFT_EVICT_BUDGET_PER_CORE: u16 = 16;
|
||||
const DEFAULT_ME_POOL_DRAIN_SOFT_EVICT_COOLDOWN_MS: u64 = 1000;
|
||||
const DEFAULT_USER_MAX_UNIQUE_IPS_WINDOW_SECS: u64 = 30;
|
||||
const DEFAULT_ACCEPT_PERMIT_TIMEOUT_MS: u64 = 250;
|
||||
const DEFAULT_CONNTRACK_CONTROL_ENABLED: bool = true;
|
||||
const DEFAULT_CONNTRACK_CONTROL_ENABLED: bool = false;
|
||||
const DEFAULT_CONNTRACK_PRESSURE_HIGH_WATERMARK_PCT: u8 = 85;
|
||||
const DEFAULT_CONNTRACK_PRESSURE_LOW_WATERMARK_PCT: u8 = 70;
|
||||
const DEFAULT_CONNTRACK_DELETE_BUDGET_PER_SEC: u64 = 4096;
|
||||
@@ -244,6 +244,7 @@ pub(crate) fn default_accept_permit_timeout_ms() -> u64 {
|
||||
DEFAULT_ACCEPT_PERMIT_TIMEOUT_MS
|
||||
}
|
||||
|
||||
/// Keeps privileged conntrack control disabled unless explicitly requested.
|
||||
pub(crate) fn default_conntrack_control_enabled() -> bool {
|
||||
DEFAULT_CONNTRACK_CONTROL_ENABLED
|
||||
}
|
||||
|
||||
@@ -1,5 +1,71 @@
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn conntrack_control_is_opt_in_by_default() {
|
||||
assert!(!default_conntrack_control_enabled());
|
||||
assert!(
|
||||
!ProxyConfig::default()
|
||||
.server
|
||||
.conntrack_control
|
||||
.inline_conntrack_control
|
||||
);
|
||||
let cfg = load_config_from_temp_toml(
|
||||
r#"
|
||||
[censorship]
|
||||
tls_domain = "example.com"
|
||||
|
||||
[access.users]
|
||||
user = "00000000000000000000000000000000"
|
||||
"#,
|
||||
);
|
||||
assert!(!cfg.server.conntrack_control.inline_conntrack_control);
|
||||
assert!(
|
||||
!cfg.server
|
||||
.conntrack_control
|
||||
.inline_conntrack_control_explicit
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::to_value(&cfg.server.conntrack_control).unwrap()["inline_conntrack_control"],
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn conntrack_control_preserves_explicit_enablement() {
|
||||
for enabled in [false, true] {
|
||||
let cfg = load_config_from_temp_toml(&format!(
|
||||
r#"
|
||||
[server.conntrack_control]
|
||||
inline_conntrack_control = {enabled}
|
||||
backend = "nftables"
|
||||
|
||||
[censorship]
|
||||
tls_domain = "example.com"
|
||||
|
||||
[access.users]
|
||||
user = "00000000000000000000000000000000"
|
||||
"#,
|
||||
));
|
||||
assert_eq!(
|
||||
cfg.server.conntrack_control.inline_conntrack_control,
|
||||
enabled
|
||||
);
|
||||
assert!(
|
||||
cfg.server
|
||||
.conntrack_control
|
||||
.inline_conntrack_control_explicit
|
||||
);
|
||||
assert_eq!(
|
||||
cfg.server.conntrack_control.backend,
|
||||
ConntrackBackend::Nftables
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::to_value(&cfg.server.conntrack_control).unwrap()["inline_conntrack_control"],
|
||||
enabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn conntrack_pressure_high_watermark_out_of_range_is_rejected() {
|
||||
let toml = r#"
|
||||
|
||||
Reference in New Issue
Block a user