From f4e65a51ae3313bb60633f43ba90657724ce0546 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Sun, 25 Jun 2006 18:54:07 +0000 Subject: convert rule type testing to switch/case - easier to read than if/else/if... --- packages/squid.inc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'packages/squid.inc') diff --git a/packages/squid.inc b/packages/squid.inc index af0d7bda..670c8985 100644 --- a/packages/squid.inc +++ b/packages/squid.inc @@ -755,14 +755,17 @@ function squid_generate_rules($type) { $ifaces = explode(',', $squid_conf['active_interface']); $ifaces = array_map('convert_friendly_interface_to_real_interface_name', $ifaces); - if ($type == 'nat') { + switch($type) { + case 'nat': foreach ($ifaces as $iface) $rules .= "rdr on $iface inet proto tcp to !($iface) port 80 -> ($iface) port $port\n"; - } - - else { + break; + case 'filter': foreach ($ifaces as $iface) $rules .= "pass quick on $iface inet proto tcp to !($iface) port 80 flags S/SA keep state\n"; + break; + default: + break; } return $rules; -- cgit v1.2.3