PHP Class PrivateBin\Persistence\TrafficLimiter

Handles traffic limiting, so no user does more than one call per 10 seconds.
Inheritance: extends AbstractPersistence
ファイルを表示 Open project: privatebin/privatebin Class Usage Examples

Public Methods

Method Description
canPass ( ) : boolean traffic limiter
getHash ( string $algo = 'sha512' ) : string get a HMAC of the current visitors IP address
setConfiguration ( Configuration $conf ) : void set configuration options of the traffic limiter
setLimit ( integer $limit ) : void set the time limit in seconds

Method Details

canPass() public static method

Make sure the IP address makes at most 1 request every 10 seconds.
public static canPass ( ) : boolean
return boolean

getHash() public static method

get a HMAC of the current visitors IP address
public static getHash ( string $algo = 'sha512' ) : string
$algo string
return string

setConfiguration() public static method

set configuration options of the traffic limiter
public static setConfiguration ( Configuration $conf ) : void
$conf PrivateBin\Configuration
return void

setLimit() public static method

set the time limit in seconds
public static setLimit ( integer $limit ) : void
$limit integer
return void