From dfa2812725631eadfe27021da312fade4f8ef005 Mon Sep 17 00:00:00 2001 From: Sergey Dvoriancev Date: Wed, 9 May 2012 23:35:07 +0400 Subject: SQStat + --- config/lightsquid/lightsquid.inc | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/config/lightsquid/lightsquid.inc b/config/lightsquid/lightsquid.inc index 0519c196..0825f0c1 100644 --- a/config/lightsquid/lightsquid.inc +++ b/config/lightsquid/lightsquid.inc @@ -258,8 +258,22 @@ function lightsquid_resync() { // update squid conf if (isset($config['installedpackages']['squid']['config'][0])) { - $config['installedpackages']['squid']['config'][0]['log_enabled'] = 'on'; - $config['installedpackages']['squid']['config'][0]['log_dir'] = LS_SQUIDLOGPATH; + $squid_settings = $config['installedpackages']['squid']['config'][0]; + $squid_settings['log_enabled'] = 'on'; + $squid_settings['log_dir'] = LS_SQUIDLOGPATH; + + # sqstat + $ifmgr = "127.0.0.1;"; + $iface = ($squid_settings['active_interface'] ? $squid_settings['active_interface'] : 'lan'); + $iface = explode(",", $iface); + foreach ($iface as $i => $if) { + $realif = ls_get_real_interface_address($if); + if ($realif[0]) + $ifmgr = $ifmgr . $realif[0] . ";"; + } + + $config['installedpackages']['squidcache']['config'][0]['ext_cachemanager'] = $ifmgr; + write_config(); squid_resync(); } @@ -384,4 +398,15 @@ function refresh_full() { update_log("refresh_full: stop"); } +function ls_get_real_interface_address($iface) +{ + global $config; + + $iface = convert_friendly_interface_to_real_interface_name($iface); + $line = trim(shell_exec("ifconfig $iface | grep inet | grep -v inet6")); + list($dummy, $ip, $dummy2, $netmask) = explode(" ", $line); + + return array($ip, long2ip(hexdec($netmask))); +} + ?> \ No newline at end of file -- cgit v1.2.3 From 49d604126f311966c2e61e125064191142bd98e8 Mon Sep 17 00:00:00 2001 From: Sergey Dvoriancev Date: Wed, 9 May 2012 23:39:11 +0400 Subject: + SQStat --- config/lightsquid/lightsquid.xml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/config/lightsquid/lightsquid.xml b/config/lightsquid/lightsquid.xml index cb481943..b8ce2bc8 100644 --- a/config/lightsquid/lightsquid.xml +++ b/config/lightsquid/lightsquid.xml @@ -47,7 +47,7 @@ Currently there are no FAQ items provided. lightsquid 1.7.1 - Services: Proxy server Report(LightSquid) -> Settings + Services: Proxy Reports (LightSquid, SQStat) -> Settings Status /usr/local/pkg/lightsquid.inc @@ -66,6 +66,10 @@ Lightsquid Report /lightsquid/index.cgi + + Proxy State + /sqstat/sqstat.php + /usr/local/pkg/ @@ -77,6 +81,26 @@ 0755 http://files.pfsense.org/packages/All/lightsquid_tpl.tbz + + /usr/local/www/sqstat/ + 0644 + http://www.pfsense.org/packages/config/lightsquid/sqstat.class.php + + + /usr/local/www/sqstat/ + 0644 + http://www.pfsense.org/packages/config/lightsquid/sqstat.php + + + /usr/local/www/sqstat/ + 0644 + http://www.pfsense.org/packages/config/lightsquid/sqstat.css + + + /usr/local/www/sqstat/ + 0644 + http://www.pfsense.org/packages/config/lightsquid/zhabascript.js + Language -- cgit v1.2.3