parent
87dcc05fcc
commit
8e190304aa
11 changed files with 6 additions and 247 deletions
@ -1 +0,0 @@ |
||||
100 |
@ -1 +0,0 @@ |
||||
.rar,.zip,.tar,.tar.gz,.tar.bz2,.tgz,.tbz2,.avi,.mpg,.mpeg,.mkv,.mov,.flv,.iso |
@ -1 +0,0 @@ |
||||
100 |
@ -1,3 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
/usr/sbin/squid -k reconfigure |
@ -1,57 +0,0 @@ |
||||
{ |
||||
|
||||
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 |
||||
} |
Loading…
Reference in new issue