Restrict the classes that can be connected to the same IP address.
More...
#include <sttnet_English.h>
|
| | ConnectionLimiter (const int &connectionLimit=20, const int &connectionRateLimit=6) |
| | ConnectionLimiter constructor. More...
|
| |
| bool | allow (const std::string &ip) |
| | Determines whether to allow connections to a particular IP address based on the number of connections and speed. More...
|
| |
| void | clearIP (const std::string &ip) |
| | Clear the number of connections that record an IP address. More...
|
| |
Restrict the classes that can be connected to the same IP address.
- Note
- No locks, no synchronization and thread safety, their own on the upper layer to ensure it.
-
Limit the number and speed of connections to the same IP
| stt::security::ConnectionLimiter::ConnectionLimiter |
( |
const int & |
connectionLimit = 20, |
|
|
const int & |
connectionRateLimit = 6 |
|
) |
| |
|
inline |
ConnectionLimiter constructor.
- Parameters
-
| connectionLimit | The maximum number of connections to the same IP address is 20 by default |
| connectionRateLimit | The maximum number of connections per second for the same IP address is 6 by default |
| bool stt::security::ConnectionLimiter::allow |
( |
const std::string & |
ip | ) |
|
Determines whether to allow connections to a particular IP address based on the number of connections and speed.
- Parameters
-
- Returns
- true:Connections from a certain IP address should be allowed false: Connections from a certain IP address should be denied
| void stt::security::ConnectionLimiter::clearIP |
( |
const std::string & |
ip | ) |
|
Clear the number of connections that record an IP address.
- Parameters
-
The documentation for this class was generated from the following file: