smeserver-qos/root/etc/e-smith/templates/etc/squid/squid.conf/90DelayPools

58 lines
1.4 KiB
Plaintext

{
my $status = $qos{'status'} || 'disabled';
return "" unless ($status eq 'enabled');
my $down = $qos{'DownLink'} || '4000';
my $weblimit = $qos{'WebGlobalLimit'} || '100';
my $limit = $qos{'WebThrottleLimit'} || '99';
# Convert weblimit and per user limit in absolute values (in bytes)
$weblimit = $down * $weblimit * 1024 / (100 * 8);
$limit = $down * $limit * 1024 / (100 * 8);
my $extensions = $qos{'WebThrottleExtensions'} || '.rar .zip .tar .tar.gz .tar.bz2 .tgz .tbz2 .avi .mpg .mpeg .mkv .mov .flv .iso';
$extensions =~ s/[,;]/\ /g;
$extensions =~ s/\./\\\./g;
my @sexcludes = split(/[;,]/, ($qos{'WebThrottleSourceException'} || ''));
my @dexcludes = split(/[;,]/, ($qos{'WebThrottleDestException'} || ''));
$OUT .=<<"EOF";
acl throttle url_regex -i $extensions
delay_pools 2
delay_class 1 1
delay_parameters 1 $weblimit/$weblimit
delay_class 2 2
delay_parameters 2 $weblimit/$weblimit $limit/$limit
delay_access 1 allow localdst
acl exclude_throttle_src src 127.0.0.1
acl exclude_throttle_dst dstdomain $DomainName
EOF
foreach (@sexcludes){
$OUT .= "acl exclude_throttle_src src $_\n";
}
foreach (@dexcludes){
$_ =~ s/^/\./ unless $_ =~ m/^\./;
$OUT .= "acl exclude_throttle_dst dstdomain $_\n";
}
$OUT .=<<"EOF"
delay_access 1 allow localdst
delay_access 1 allow exclude_throttle_src
delay_access 1 allow exclude_throttle_dst
delay_access 2 allow throttle
delay_access 1 allow !throttle
EOF
}