dhcpkit.ipv6.server.extensions.rate_limit.manager module

A custom manager that manages the shared rate limit counters

class dhcpkit.ipv6.server.extensions.rate_limit.manager.RateLimitCounters(rate: int, per: int, burst: int = None)[source]

Bases: object

Counters for rate limiting of DHCPv6 requests

check_request(key: str) → bool[source]

Check whether this request is within limits. This method uses the algorithm described on http://stackoverflow.com/questions/667508/whats-a-good-rate-limiting-algorithm#668327

Parameters:key – The key for this client
Returns:Whether we should allow this
class dhcpkit.ipv6.server.extensions.rate_limit.manager.RateLimitManager(address=None, authkey=None, serializer='pickle', ctx=None)[source]

Bases: multiprocessing.managers.BaseManager

A custom manager that manages the shared rate limit counters

RateLimitCounters(*args, **kwds)
start(initializer=None, initargs=())[source]

Start the rate limit counter manager

dhcpkit.ipv6.server.extensions.rate_limit.manager.init_manager_process(parent_logger, initializer=None, initargs=())[source]

Migrate the logger of the parent to the child. It will be a queue logger anyway.

  • parent_logger – The logger from the parent
  • initializer – Optional extra initializer
  • initargs – Optional initializer arguments