fixed IPv6 geolocation
This commit is contained in:
+2
-1
@@ -862,7 +862,8 @@ pub async fn get_reachable_nodes(netstats: Arc<Mutex<NetStats>>) -> Result<(), a
|
|||||||
match TcpStream::connect_timeout(&socket_addr, Duration::from_millis(3000)) {
|
match TcpStream::connect_timeout(&socket_addr, Duration::from_millis(3000)) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
if let Some((ip, _port)) = node.address.split_once(':') {
|
if let Some((addr, _port)) = node.address.split_once(':') {
|
||||||
|
let ip = addr.trim_matches(|c| c == '[' || c == ']');
|
||||||
//let url = format!("https://api.country.is/{}", ip);
|
//let url = format!("https://api.country.is/{}", ip);
|
||||||
let url = format!("http://ip-api.com/json/{}", ip);
|
let url = format!("http://ip-api.com/json/{}", ip);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user