Begin: |
Declare flag called AntiDDoSEnabled |
Declare flag called AntiDDoSForced |
Declare an integer called AntiDDoSPeriod |
Declare an integer called AntiDDoSHDDoS |
Declare an integer called AntiDDoSFlashCrowd |
Declare an integer called AntiDDoSLDDoS |
Declare an integer called AntiDDoSNormal |
Declare string called AntiDDoSCommand |
Declare string called WhiteList |
WHILE uri <> NULL |
IF main_request <> NULL OR prev_request <> NULL |
return DECLINED |
ENDIF |
IF AntiDDoSEnabled = ANTIDDOS_DISABLED |
return DECLINED |
ENDIF |
IF AntiDDoSForced = ANTIDDOS_DISABLED |
return DECLINED |
ENDIF |
IF handler = modantiddos-handler |
return antiddos_viewer |
ENDIF |
IF is_WhiteListed(remote_ip) |
return OK |
ENDIF |
IF is_BlackListed(remote_ip) |
return HTTP_FORBIDDEN |
EdgeRouter_Ban(remote_ip) |
ENDIF |
set entropy_result = OK |
IF AntiDDoSForced = ANTIDDOS_DISABLED |
t = time_now − AntiDDoSPeriod |
IF (uri_time < t) |
Calculate entropyUri (uri) |
ENDIF |
IF entropyUri = AntiDDoSHDDoS |
return HTTP_FORBIDDEN |
Blacklist_Table(remote_ip) |
EdgeRouter_Ban(remote_ip) |
ENDIF |
IF entropyUri = AntiDDoSFlashCrowd |
decrease timeout |
decrease MaxKeepAliveRequests |
IF (timeout == 0 && KeepAlive == Off) |
return HTTP_FORBIDDEN |
Blacklist_Table(remote_ip) |
EdgeRouter_Ban(remote_ip) |
ENDIF |
ENDIF |
ENDIF |
ENDIF |
return entropy_result |
ENDWHILE |
End. |