mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
Add WebUI loxilb.cgi for ebpf load balancer
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
This commit is contained in:
@@ -91,6 +91,7 @@ srv/web/ipfire/cgi-bin/wirelessclient.cgi
|
||||
srv/web/ipfire/cgi-bin/wlanap.cgi
|
||||
srv/web/ipfire/cgi-bin/zoneconf.cgi
|
||||
srv/web/ipfire/cgi-bin/ddos.cgi
|
||||
srv/web/ipfire/cgi-bin/loxilb.cgi
|
||||
#srv/web/ipfire/html
|
||||
srv/web/ipfire/html/blob.gif
|
||||
#srv/web/ipfire/html/captive
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007-2020 IPFire Team <info@ipfire.org> #
|
||||
# Copyright (C) 2024 BPFire <vincent.mc.li@gmail.com> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
use strict;
|
||||
|
||||
# enable only the following on debugging purpose
|
||||
use warnings;
|
||||
use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
use IO::Socket;
|
||||
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require "${General::swroot}/location-functions.pl";
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
my %loxilbsettings=();
|
||||
my %checked=();
|
||||
my $errormessage='';
|
||||
my $loxilbsettingfile = "${General::swroot}/loxilb/settings";
|
||||
|
||||
|
||||
# Read configuration file.
|
||||
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color);
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
$loxilbsettings{'ENABLE_LOXILB'} = 'off';
|
||||
$loxilbsettings{'ACTION'} = '';
|
||||
|
||||
&Header::getcgihash(\%loxilbsettings);
|
||||
|
||||
if ($loxilbsettings{'ACTION'} eq $Lang::tr{'save'})
|
||||
{
|
||||
|
||||
&General::writehash("$loxilbsettingfile", \%loxilbsettings);
|
||||
|
||||
if ($loxilbsettings{'ENABLE_LOXILB'} eq 'on') {
|
||||
&General::system('/usr/bin/touch', "${General::swroot}/loxilb/enableloxilb");
|
||||
&General::system('/usr/local/bin/loxilbctrl', 'start');
|
||||
} else {
|
||||
&General::system('/usr/local/bin/loxilbctrl', 'stop');
|
||||
unlink "${General::swroot}/loxilb/enableloxilb";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&Header::openpage($Lang::tr{'loxilb'}, 1, '');
|
||||
|
||||
&Header::openbigbox('100%', 'left', '', $errormessage);
|
||||
|
||||
if ($errormessage) {
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
|
||||
print "<font class='base'>$errormessage </font>\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
# Read configuration file.
|
||||
&General::readhash("$loxilbsettingfile", \%loxilbsettings);
|
||||
|
||||
# Checkbox pre-selection.
|
||||
my $checked;
|
||||
if ($loxilbsettings{'ENABLE_LOXILB'} eq "on") {
|
||||
$checked = "checked='checked'";
|
||||
}
|
||||
|
||||
# Print box to enable/disable locationblock.
|
||||
print"<form method='POST' action='$ENV{'SCRIPT_NAME'}'>\n";
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{'loxilb status'});
|
||||
print <<END;
|
||||
<table width='95%'>
|
||||
<tr>
|
||||
<td width='50%' class='base'>$Lang::tr{'loxilb enable'}
|
||||
<td><input type='checkbox' name='ENABLE_LOXILB' $checked></td>
|
||||
<td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}'></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
END
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
print "</form>\n";
|
||||
#
|
||||
&Header::closebigbox();
|
||||
|
||||
&Header::closepage();
|
||||
|
||||
|
||||
@@ -2452,7 +2452,9 @@
|
||||
'state or province' => 'State or Province',
|
||||
'static ip' => 'Static IP',
|
||||
'static routes' => 'Static Routes',
|
||||
'loxilb' => 'eBPF Load Balancer',
|
||||
'loxilb' => 'eBPF LoxiLB Load Balancer',
|
||||
'loxilb status' => 'Status',
|
||||
'loxilb enable' => 'Enable Load Balancer',
|
||||
'status' => 'Status',
|
||||
'status information' => 'Status information',
|
||||
'status ovpn' => 'OpenVPN',
|
||||
|
||||
@@ -2420,7 +2420,9 @@
|
||||
'state or province' => '州或省',
|
||||
'static ip' => '静态IP',
|
||||
'static routes' => '静态路由',
|
||||
'loxilb' => 'eBPF 负载均衡',
|
||||
'loxilb' => 'eBPF LoxiLB 负载均衡',
|
||||
'loxilb status' => '负载均衡启用状态',
|
||||
'loxilb enable' => '启用负载均衡',
|
||||
'status' => '状态',
|
||||
'status information' => '状态信息',
|
||||
'status ovpn' => 'OpenVPN',
|
||||
|
||||
Reference in New Issue
Block a user