Class BanManager

class BanManager ;

Constructors

NameDescription
this (config, clock, db, logger) Ctor.

Fields

NameTypeDescription
log LoggerLogger instance

Methods

NameDescription
ban (address) Manually ban an address using the configured ban time in the ban config.
banFor (address, duration) Manually ban an address, for the specified number of seconds from the current time.
banUntil (address, banned_until) Manually ban an address, until the specified time.
isBanned (address) Checks whether the address is considered banned
isWhitelisted (address) Checks whether the address is whitelisted
onFailedRequest (address, fail_count_inc) Updates the fail count for this address
unwhitelist (address) Unwhitelist an address to allow banning it
whitelist (address) Whitelist an address to avoid banning it
getCurTime () Get the current time. Overridable for unittests.

Inner structs

NameDescription
Config Ban configuration