(host: T, offset: i32)
| 26 | |
| 27 | #[inline] |
| 28 | pub fn increase_port<T: std::string::ToString>(host: T, offset: i32) -> String { |
| 29 | let host = host.to_string(); |
| 30 | if crate::is_ipv6_str(&host) { |
| 31 | if host.starts_with('[') { |
| 32 | let tmp: Vec<&str> = host.split("]:").collect(); |
| 33 | if tmp.len() == 2 { |
| 34 | let port: i32 = tmp[1].parse().unwrap_or(0); |
| 35 | if port > 0 { |
| 36 | return format!("{}]:{}", tmp[0], port + offset); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | } else if host.contains(':') { |
| 41 | let tmp: Vec<&str> = host.split(':').collect(); |
| 42 | if tmp.len() == 2 { |
| 43 | let port: i32 = tmp[1].parse().unwrap_or(0); |
| 44 | if port > 0 { |
| 45 | return format!("{}:{}", tmp[0], port + offset); |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | host |
| 50 | } |
| 51 | |
| 52 | pub fn test_if_valid_server(host: &str, test_with_proxy: bool) -> String { |
| 53 | let host = check_port(host, 0); |
nothing calls this directly
no test coverage detected