mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-13 21:54:13 +08:00
fix
This commit is contained in:
parent
7cc541967e
commit
9a2639f40a
@ -279,22 +279,25 @@ func (r *RuleActionReject) Error(ctx context.Context) error {
|
|||||||
default:
|
default:
|
||||||
panic(F.ToString("unknown reject method: ", r.Method))
|
panic(F.ToString("unknown reject method: ", r.Method))
|
||||||
}
|
}
|
||||||
r.dropAccess.Lock()
|
if !r.NoDrop {
|
||||||
defer r.dropAccess.Unlock()
|
r.dropAccess.Lock()
|
||||||
timeNow := time.Now()
|
defer r.dropAccess.Unlock()
|
||||||
r.dropCounter = common.Filter(r.dropCounter, func(t time.Time) bool {
|
timeNow := time.Now()
|
||||||
return timeNow.Sub(t) <= 30*time.Second
|
r.dropCounter = common.Filter(r.dropCounter, func(t time.Time) bool {
|
||||||
})
|
return timeNow.Sub(t) <= 30*time.Second
|
||||||
r.dropCounter = append(r.dropCounter, timeNow)
|
})
|
||||||
if len(r.dropCounter) > 50 {
|
r.dropCounter = append(r.dropCounter, timeNow)
|
||||||
if ctx != nil {
|
if len(r.dropCounter) > 50 {
|
||||||
r.logger.DebugContext(ctx, "dropped due to flooding")
|
if ctx != nil {
|
||||||
|
r.logger.DebugContext(ctx, "dropped due to flooding")
|
||||||
|
}
|
||||||
|
return tun.ErrDrop
|
||||||
}
|
}
|
||||||
return tun.ErrDrop
|
|
||||||
}
|
}
|
||||||
return returnErr
|
return returnErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type RuleActionHijackDNS struct{}
|
type RuleActionHijackDNS struct{}
|
||||||
|
|
||||||
func (r *RuleActionHijackDNS) Type() string {
|
func (r *RuleActionHijackDNS) Type() string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user