mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Add a config option for exempting classes from connflood.
This commit is contained in:
parent
b45b7f018d
commit
6f4aee365b
@ -308,6 +308,10 @@
|
||||
# This setting only has effect when the connectban module is loaded.
|
||||
#useconnectban="yes"
|
||||
|
||||
# useconnflood: Defines if users in this class should be exempt from connflood limits.
|
||||
# This setting only has effect when the connflood module is loaded.
|
||||
#useconnflood="yes"
|
||||
|
||||
# usednsbl: Defines whether or not users in this class are subject to DNSBL. Default is yes.
|
||||
# This setting only has effect when the dnsbl module is loaded.
|
||||
#usednsbl="yes"
|
||||
|
@ -8,6 +8,7 @@
|
||||
globalmax="100"
|
||||
localmax="100"
|
||||
useconnectban="no"
|
||||
useconnflood="no"
|
||||
usednsbl="no">
|
||||
|
||||
<connect name="IRCCloud (Brockwell)" parent="IRCCloud" allow="192.184.10.118">
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
class ModuleConnFlood : public Module
|
||||
{
|
||||
private:
|
||||
unsigned int seconds;
|
||||
unsigned int timeout;
|
||||
unsigned int boot_wait;
|
||||
@ -36,6 +37,16 @@ class ModuleConnFlood : public Module
|
||||
time_t first;
|
||||
std::string quitmsg;
|
||||
|
||||
static bool IsExempt(LocalUser* user)
|
||||
{
|
||||
// E-lined and already banned users shouldn't be hit.
|
||||
if (user->exempt || user->quitting)
|
||||
return true;
|
||||
|
||||
// Users in an exempt class shouldn't be hit.
|
||||
return user->GetClass() && !user->GetClass()->config->getBool("useconnflood", true);
|
||||
}
|
||||
|
||||
public:
|
||||
ModuleConnFlood()
|
||||
: conns(0), throttled(false)
|
||||
@ -65,7 +76,7 @@ public:
|
||||
|
||||
ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE
|
||||
{
|
||||
if (user->exempt)
|
||||
if (IsExempt(user))
|
||||
return MOD_RES_PASSTHRU;
|
||||
|
||||
time_t next = ServerInstance->Time();
|
||||
|
Loading…
x
Reference in New Issue
Block a user