From: Stefan Schantl Date: Fri, 18 Apr 2025 09:44:55 +0000 (+0200) Subject: general-functions.pl: Drop FetchPublicIp function. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fca7b6f458d405b0da06e1f31715289590e83b2a;p=people%2Fstevee%2Fipfire-2.x.git general-functions.pl: Drop FetchPublicIp function. This function has been reworked and moved into the http-client-functions library. Signed-off-by: Stefan Schantl --- diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 8ba6e3f79..861f95dec 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -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