]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
general-functions.pl: Drop FetchPublicIp function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 18 Apr 2025 09:44:55 +0000 (11:44 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Fri, 18 Apr 2025 09:44:55 +0000 (11:44 +0200)
This function has been reworked and moved into the
http-client-functions library.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/general-functions.pl

index 8ba6e3f79f0a9660ba8f8630ad0c7f1a3f6c988d..861f95decce2cc97d661696cbd3012dcbb514e8a 100644 (file)
@@ -17,7 +17,6 @@ package General;
 use strict;
 use Socket;
 use IO::Socket;
-use Net::SSLeay;
 use Net::IPv4Addr qw(:all);
 
 $General::version = 'VERSION';
@@ -961,26 +960,6 @@ sub findhasharraykey {
     }
 }
 
-sub FetchPublicIp {
-    my %proxysettings;
-    &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
-    if ($_=$proxysettings{'UPSTREAM_PROXY'}) {
-        my ($peer, $peerport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/);
-        Net::SSLeay::set_proxy($peer,$peerport,$proxysettings{'UPSTREAM_USER'},$proxysettings{'UPSTREAM_PASSWORD'} );
-    }
-    my $user_agent = &MakeUserAgent();
-    my ($out, $response) = Net::SSLeay::get_http(  'checkip4.dns.lightningwirelabs.com',
-                                                   80,
-                                                   "/",
-                                                   Net::SSLeay::make_headers('User-Agent' => $user_agent )
-                                               );
-    if ($response =~ m%HTTP/1\.. 200 OK%) {
-       $out =~ /Your IP address is: (\d+.\d+.\d+.\d+)/;
-       return $1;
-    }
-    return '';
-}
-
 #
 # Check if hostname.domain provided have IP provided
 # use gethostbyname to verify that