mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-03-21 03:35:36 +08:00
实现自动SYN Flood防护
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
)
|
||||
|
||||
// AllowIP 检查IP是否被允许访问
|
||||
// 如果一个IP不在任何名单中,则允许访问
|
||||
func AllowIP(ip string, serverId int64) bool {
|
||||
var ipLong = utils.IP2Long(ip)
|
||||
if ipLong == 0 {
|
||||
@@ -40,6 +41,17 @@ func AllowIP(ip string, serverId int64) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsInWhiteList 检查IP是否在白名单中
|
||||
func IsInWhiteList(ip string) bool {
|
||||
var ipLong = utils.IP2Long(ip)
|
||||
if ipLong == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
// check white lists
|
||||
return GlobalWhiteIPList.Contains(ipLong)
|
||||
}
|
||||
|
||||
// AllowIPStrings 检查一组IP是否被允许访问
|
||||
func AllowIPStrings(ipStrings []string, serverId int64) bool {
|
||||
if len(ipStrings) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user