mirror of
https://github.com/telemt/telemt.git
synced 2026-06-19 02:00:08 +07:00
Dual-stack fixes for Upstreams by #798
Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
This commit is contained in:
@@ -2065,6 +2065,20 @@ pub struct UpstreamConfig {
|
||||
/// `None` means auto-detect from runtime connectivity state.
|
||||
#[serde(default)]
|
||||
pub ipv6: Option<bool>,
|
||||
/// Per-upstream IP family preference for Telegram DC targets.
|
||||
/// `None` inherits the effective global `[network].prefer` decision.
|
||||
#[serde(default)]
|
||||
pub prefer: Option<u8>,
|
||||
}
|
||||
|
||||
impl UpstreamConfig {
|
||||
pub fn prefer_ipv6(&self, default_prefer_ipv6: bool) -> bool {
|
||||
match self.prefer {
|
||||
Some(6) => true,
|
||||
Some(4) => false,
|
||||
_ => default_prefer_ipv6,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user