File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -490,12 +490,12 @@ fn hex_to_cidr(hex: &str) -> Option<u8> {
490490/// Get the public IP address by querying an external HTTP service
491491pub fn get_public_ip ( ) -> Result < String > {
492492 for url in [ "https://trackip.net/ip" , "https://checkip.amazonaws.com" ] {
493- if let Ok ( output) = Command :: new ( "curl" ) . args ( [ "-s" , "-m" , "5" , url] ) . output ( ) {
494- if output. status . success ( ) {
495- let ip = String :: from_utf8_lossy ( & output . stdout ) . trim ( ) . to_string ( ) ;
496- if ip . parse :: < IpAddr > ( ) . is_ok ( ) {
497- return Ok ( ip ) ;
498- }
493+ if let Ok ( output) = Command :: new ( "curl" ) . args ( [ "-s" , "-m" , "5" , url] ) . output ( )
494+ && output. status . success ( )
495+ {
496+ let ip = String :: from_utf8_lossy ( & output . stdout ) . trim ( ) . to_string ( ) ;
497+ if ip . parse :: < IpAddr > ( ) . is_ok ( ) {
498+ return Ok ( ip ) ;
499499 }
500500 }
501501 }
You can’t perform that action at this time.
0 commit comments