mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
update
refactor limiter fix getLink bug add connection limit move limit config to ControllerConfig del dynamic speed limit (next version will be re add) del online ip sync (next version will be re add)
This commit is contained in:
34
limiter/rule.go
Normal file
34
limiter/rule.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package limiter
|
||||
|
||||
import (
|
||||
"github.com/Yuzuki616/V2bX/api/panel"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func (l *Limiter) CheckDomainRule(destination string) (reject bool) {
|
||||
// have rule
|
||||
for i := range l.Rules {
|
||||
if l.Rules[i].Pattern.MatchString(destination) {
|
||||
reject = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (l *Limiter) CheckProtocolRule(protocol string) (reject bool) {
|
||||
for i := range l.ProtocolRules {
|
||||
if l.ProtocolRules[i] == protocol {
|
||||
reject = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (l *Limiter) UpdateRule(newRuleList []panel.DestinationRule) error {
|
||||
if !reflect.DeepEqual(l.Rules, newRuleList) {
|
||||
l.Rules = newRuleList
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user