\PrivateBin\PersistenceTrafficLimiter

TrafficLimiter

Handles traffic limiting, so no user does more than one call per 10 seconds.

Summary

Methods
Properties
Constants
setPath()
getPath()
setLimit()
setConfiguration()
getHash()
canPass()
No public properties found
No constants found
_exists()
_initialize()
_store()
No protected properties found
N/A
No private methods found
$_path
$_limit
$_ipKey
N/A

Properties

$_path

$_path : string

path in which to persist something

Type

string

$_limit

$_limit : integer

time limit in seconds, defaults to 10s

Type

integer

$_ipKey

$_ipKey : string

key to fetch IP address

Type

string

Methods

setPath()

setPath(string  $path) 

set the path

Parameters

string $path

getPath()

getPath(string  $filename = null) : string

get the path

Parameters

string $filename

Returns

string

setLimit()

setLimit(integer  $limit) 

set the time limit in seconds

Parameters

integer $limit

setConfiguration()

setConfiguration(\PrivateBin\Configuration  $conf) 

set configuration options of the traffic limiter

Parameters

\PrivateBin\Configuration $conf

getHash()

getHash(string  $algo = 'sha512') : string

get a HMAC of the current visitors IP address

Parameters

string $algo

Returns

string

canPass()

canPass() : boolean

traffic limiter

Make sure the IP address makes at most 1 request every 10 seconds.

Throws

\PrivateBin\Persistence\Exception

Returns

boolean

_exists()

_exists(string  $filename) : boolean

checks if the file exists

Parameters

string $filename

Returns

boolean

_initialize()

_initialize() 

prepares path for storage

Throws

\Exception

_store()

_store(string  $filename, string  $data) : string

store the data

Parameters

string $filename
string $data

Throws

\Exception

Returns

string