FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Throttle Class Reference
Inheritance diagram for Throttle:
Check Component Thing

Public Member Functions

 check ($expected=false)
 
 unBan ($addr)
 
- Public Member Functions inherited from Check
 check ($expected=false)
 Perform the check. More...
 
 clientConfig ()
 
 unBan ($addr)
 Unban a client's IP address. More...
 
- Public Member Functions inherited from Component
 __construct ($fred, $config=null)
 
 __destruct ()
 
 clientConfig ()
 Public configuration. More...
 
 config ($key, $default=null)
 Retrieve a config value. More...
 
 ping ()
 Ping function. More...
 
 filemtime ($filename)
 Filemtime with session cache. More...
 
 component ($name)
 Get a component (local or default). More...
 
 components (... $names)
 Get multiple components in an array. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

 $mask = '/(\\.\\d+|(:\\d+){4})$/'
 IP address subnet mask (part to remove). More...
 
 $ext = '.tht'
 Extension for throttle registration file. More...
 
 $checkTtl = 300
 Re-use throttle info for this amount of time (seconds). More...
 
 $logPrio = \Rsi\Fred\Log::WARNING
 Log prio for the warning message. More...
 
 $limitLog = 3600
 Number of requests after which the subnet is added to the log. More...
 
 $limitBan = 7200
 Number of requests after which the subnet is banned. More...
 
 $interval = 3600
 Number of seconds after which the counter gets reset. More...
 
 $sleep = []
 Extra sleep time (value, milliseconds) if the counter gets above a certain value (key, ascending). More...
 
- Data Fields inherited from Check
 $delay = null
 Time (seconds) a ban stays in the registry (empty = use default). More...
 
- Data Fields inherited from Component
 $filemtimeTtl = 0
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Member Functions

 subnet ($addr=null)
 
 filename ($addr=null)
 
 timeLine ($filename)
 
 purge ()
 
 checkLimits ($time, $count, $prev)
 
 getPurgeLimit ()
 
 getPath ()
 
- Protected Member Functions inherited from Component
 init ()
 
 done ()
 
 getSession ()
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_path = null
 
 $_purgeLimit = null
 
- Protected Attributes inherited from Component
 $_fred = null
 
 $_config = null
 
 $_name = null
 
 $_components = []
 Local components (key = component name, value = component). More...
 
 $_session = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Detailed Description

Definition at line 5 of file Throttle.php.

Member Function Documentation

◆ check()

check (   $expected = false)

Definition at line 56 of file Throttle.php.

◆ checkLimits()

checkLimits (   $time,
  $count,
  $prev 
)
protected

Definition at line 39 of file Throttle.php.

◆ filename()

filename (   $addr = null)
protected

Definition at line 23 of file Throttle.php.

◆ getPath()

getPath ( )
protected

Definition at line 89 of file Throttle.php.

◆ getPurgeLimit()

getPurgeLimit ( )
protected

Definition at line 84 of file Throttle.php.

◆ purge()

purge ( )
protected

Definition at line 34 of file Throttle.php.

◆ subnet()

subnet (   $addr = null)
protected

Definition at line 19 of file Throttle.php.

◆ timeLine()

timeLine (   $filename)
protected

Definition at line 27 of file Throttle.php.

◆ unBan()

unBan (   $addr)

Definition at line 80 of file Throttle.php.

Field Documentation

◆ $_path

$_path = null
protected

Definition at line 16 of file Throttle.php.

◆ $_purgeLimit

$_purgeLimit = null
protected

Definition at line 17 of file Throttle.php.

◆ $checkTtl

$checkTtl = 300

Re-use throttle info for this amount of time (seconds).

Definition at line 9 of file Throttle.php.

◆ $ext

$ext = '.tht'

Extension for throttle registration file.

Definition at line 8 of file Throttle.php.

◆ $interval

$interval = 3600

Number of seconds after which the counter gets reset.

Definition at line 13 of file Throttle.php.

◆ $limitBan

$limitBan = 7200

Number of requests after which the subnet is banned.

Definition at line 12 of file Throttle.php.

◆ $limitLog

$limitLog = 3600

Number of requests after which the subnet is added to the log.

Definition at line 11 of file Throttle.php.

◆ $logPrio

$logPrio = \Rsi\Fred\Log::WARNING

Log prio for the warning message.

Definition at line 10 of file Throttle.php.

◆ $mask

$mask = '/(\\.\\d+|(:\\d+){4})$/'

IP address subnet mask (part to remove).

Definition at line 7 of file Throttle.php.

◆ $sleep

$sleep = []

Extra sleep time (value, milliseconds) if the counter gets above a certain value (key, ascending).

Definition at line 14 of file Throttle.php.


The documentation for this class was generated from the following file: