mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 20:40:25 +08:00
DDoS防护增加单IP TCP新连接速率黑名单
This commit is contained in:
@@ -17,6 +17,10 @@ const (
|
||||
DefaultTCPMinConnectionsPerIP = 5 // 单IP最小连接数
|
||||
DefaultTCPNewConnectionsRate = 500 // 单IP连接速率限制(按分钟)
|
||||
DefaultTCPNewConnectionsMinRate = 5 // 单IP最小连接速率
|
||||
DefaultTCPDenyNewConnectionsRate = 1000 // 加入黑名单的连接速率
|
||||
DefaultTCPDenyNewConnectionsMinRate = 5 // 加入黑名单的最小连接速率
|
||||
DefaultTCPDenyNewConnectionsRateTimeout = 1800 // 超过黑名单连接速率禁止时间
|
||||
|
||||
DefaultTCPLinger = 3 // 单节点TCP Linger值
|
||||
DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间
|
||||
)
|
||||
@@ -27,4 +31,7 @@ var DefaultConfigs = maps.Map{
|
||||
"tcpMinConnectionsPerIP": DefaultTCPMinConnectionsPerIP,
|
||||
"tcpNewConnectionsRate": DefaultTCPNewConnectionsRate,
|
||||
"tcpNewConnectionsMinRate": DefaultTCPNewConnectionsMinRate,
|
||||
"tcpDenyNewConnectionsRate": DefaultTCPDenyNewConnectionsRate,
|
||||
"tcpDenyNewConnectionsMinRate": DefaultTCPDenyNewConnectionsMinRate,
|
||||
"tcpDenyNewConnectionsRateTimeout": DefaultTCPDenyNewConnectionsRateTimeout,
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@ const (
|
||||
DefaultTCPMinConnectionsPerIP = 5 // 单IP最小连接数
|
||||
DefaultTCPNewConnectionsRate = 500 // 单IP连接速率限制(按分钟)
|
||||
DefaultTCPNewConnectionsMinRate = 5 // 单IP最小连接速率
|
||||
DefaultTCPDenyNewConnectionsRate = 1000 // 加入黑名单的连接速率
|
||||
DefaultTCPDenyNewConnectionsMinRate = 5 // 加入黑名单的最小连接速率
|
||||
DefaultTCPDenyNewConnectionsRateTimeout = 1800 // 超过黑名单连接速率禁止时间
|
||||
|
||||
DefaultTCPLinger = 3 // 单节点TCP Linger值
|
||||
DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间
|
||||
)
|
||||
@@ -27,4 +31,7 @@ var DefaultConfigs = maps.Map{
|
||||
"tcpMinConnectionsPerIP": DefaultTCPMinConnectionsPerIP,
|
||||
"tcpNewConnectionsRate": DefaultTCPNewConnectionsRate,
|
||||
"tcpNewConnectionsMinRate": DefaultTCPNewConnectionsMinRate,
|
||||
"tcpDenyNewConnectionsRate": DefaultTCPDenyNewConnectionsRate,
|
||||
"tcpDenyNewConnectionsMinRate": DefaultTCPDenyNewConnectionsMinRate,
|
||||
"tcpDenyNewConnectionsRateTimeout": DefaultTCPDenyNewConnectionsRateTimeout,
|
||||
}
|
||||
|
||||
@@ -8,6 +8,11 @@ type TCPConfig struct {
|
||||
MaxConnections int32 `json:"maxConnections"`
|
||||
MaxConnectionsPerIP int32 `json:"maxConnectionsPerIP"`
|
||||
NewConnectionsRate int32 `json:"newConnectionsRate"`
|
||||
|
||||
// 自动加入黑名单连接速率
|
||||
DenyNewConnectionsRate int32 `json:"denyNewConnectionsRate"`
|
||||
DenyNewConnectionsRateTimeout int32 `json:"denyNewConnectionsRateTimeout"`
|
||||
|
||||
AllowIPList []*IPConfig `json:"allowIPList"`
|
||||
Ports []*PortConfig `json:"ports"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user