mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
* Added a Basic DOS protection container/base object for the most common HTTP Server handlers. XMLRPC Handler, GenericHttpHandler and <Various>StreamHandler
* Applied the XmlRpcBasicDOSProtector.cs to the login service as both an example, and good practice. * Applied the BaseStreamHandlerBasicDOSProtector.cs to the friends service as an example of the DOS Protector on StreamHandlers * Added CircularBuffer, used for CPU and Memory friendly rate monitoring. * DosProtector has 2 states, 1. Just Check for blocked users and check general velocity, 2. Track velocity per user, It only jumps to 2 if it's getting a lot of requests, and state 1 is about as resource friendly as if it wasn't even there.
This commit is contained in:
@@ -42,14 +42,22 @@ using log4net;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
{
|
||||
public class FriendsRequestHandler : BaseStreamHandler
|
||||
public class FriendsRequestHandler : BaseStreamHandlerBasicDOSProtector
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private FriendsModule m_FriendsModule;
|
||||
|
||||
public FriendsRequestHandler(FriendsModule fmodule)
|
||||
: base("POST", "/friends")
|
||||
: base("POST", "/friends", new BasicDosProtectorOptions()
|
||||
{
|
||||
AllowXForwardedFor = true,
|
||||
ForgetTimeSpan = TimeSpan.FromMinutes(2),
|
||||
MaxRequestsInTimeframe = 5,
|
||||
ReportingName = "FRIENDSDOSPROTECTOR",
|
||||
RequestTimeSpan = TimeSpan.FromSeconds(5),
|
||||
ThrottledAction = ThrottleAction.DoThrottledMethod
|
||||
})
|
||||
{
|
||||
m_FriendsModule = fmodule;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user