检查synflood时忽略IP白名单和局域网连接

This commit is contained in:
GoEdgeLab
2022-09-14 18:52:26 +08:00
parent cdc459546d
commit a38a69e388
3 changed files with 28 additions and 13 deletions

View File

@@ -17,6 +17,8 @@ type BaseClientConn struct {
hasLimit bool
isClosed bool
rawIP string
}
func (this *BaseClientConn) IsClosed() bool {
@@ -86,7 +88,12 @@ func (this *BaseClientConn) UserId() int64 {
// RawIP 原本IP
func (this *BaseClientConn) RawIP() string {
if len(this.rawIP) > 0 {
return this.rawIP
}
ip, _, _ := net.SplitHostPort(this.rawConn.RemoteAddr().String())
this.rawIP = ip
return ip
}