mirror of https://github.com/telemt/telemt.git
Fix ME proxy config parser to support IPv6 addresses
The getProxyConfigV6 endpoint returns addresses in [ipv6]:port format, but the regex only matched IPv4 host:port, causing IPv6 ME map to be empty. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0b36e14d6e
commit
0f40771223
|
|
@ -48,7 +48,8 @@ pub async fn fetch_proxy_config(url: &str) -> Result<ProxyConfigData> {
|
||||||
.await
|
.await
|
||||||
.map_err(|e| crate::error::ProxyError::Proxy(format!("fetch_proxy_config read failed: {e}")))?;
|
.map_err(|e| crate::error::ProxyError::Proxy(format!("fetch_proxy_config read failed: {e}")))?;
|
||||||
|
|
||||||
let re_proxy = Regex::new(r"proxy_for\s+(-?\d+)\s+([^\s:]+):(\d+)\s*;").unwrap();
|
// Matches both IPv4 `host:port` and IPv6 `[host]:port` formats
|
||||||
|
let re_proxy = Regex::new(r"proxy_for\s+(-?\d+)\s+\[?([^\]\s]+)\]?:(\d+)\s*;").unwrap();
|
||||||
let re_default = Regex::new(r"default\s+(-?\d+)\s*;").unwrap();
|
let re_default = Regex::new(r"default\s+(-?\d+)\s*;").unwrap();
|
||||||
|
|
||||||
let mut map: HashMap<i32, Vec<(IpAddr, u16)>> = HashMap::new();
|
let mut map: HashMap<i32, Vec<(IpAddr, u16)>> = HashMap::new();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue