\PrivateBin\PersistenceTrafficLimiter

TrafficLimiter

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

Summary

Methods
Properties
Constants
setStore()
setConfiguration()
setCreators()
setExempted()
setLimit()
getHash()
canPass()
No public properties found
No constants found
No protected methods found
$_store
N/A
matchIp()
$_creators
$_exempted
$_ipKey
$_limit
N/A

Properties

$_creators

$_creators :string|null

listed IPs are the only ones allowed to create, defaults to null

Type

string|null

$_exempted

$_exempted :string|null

listed IPs are exempted from limits, defaults to null

Type

string|null

$_ipKey

$_ipKey :string

key to fetch IP address

Type

string

$_limit

$_limit :integer

time limit in seconds, defaults to 10s

Type

integer

Methods

setConfiguration()

setConfiguration(\PrivateBin\Configuration  $conf)

set configuration options of the traffic limiter

Parameters

\PrivateBin\Configuration $conf

setCreators()

setCreators(string  $creators)

set a list of creator IP(-ranges) as string

Parameters

string $creators

setExempted()

setExempted(string  $exempted)

set a list of exempted IP(-ranges) as string

Parameters

string $exempted

setLimit()

setLimit(integer  $limit)

set the time limit in seconds

Parameters

integer $limit

getHash()

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

get a HMAC of the current visitors IP address

Parameters

string $algo

Returns

string

canPass()

canPass(): true

make sure the IP address is allowed to perfom a request

Throws

\Exception

Returns

true

matchIp()

matchIp(string  $ipRange = null): boolean

validate $_ipKey against configured ipranges. If matched we will ignore the ip

Parameters

string $ipRange

Returns

boolean