mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
support xtls-rprx-vision, support reality
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/juju/ratelimit"
|
||||
"github.com/xtls/xray-core/common/task"
|
||||
"log"
|
||||
"regexp"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@@ -29,7 +30,7 @@ func Init() {
|
||||
}
|
||||
|
||||
type Limiter struct {
|
||||
Rules []panel.DestinationRule
|
||||
Rules []*regexp.Regexp
|
||||
ProtocolRules []string
|
||||
SpeedLimit int
|
||||
UserLimitInfo *sync.Map // Key: Uid value: UserLimitInfo
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package limiter
|
||||
|
||||
import (
|
||||
"github.com/Yuzuki616/V2bX/api/panel"
|
||||
"reflect"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func (l *Limiter) CheckDomainRule(destination string) (reject bool) {
|
||||
// have rule
|
||||
for i := range l.Rules {
|
||||
if l.Rules[i].Pattern.MatchString(destination) {
|
||||
if l.Rules[i].MatchString(destination) {
|
||||
reject = true
|
||||
break
|
||||
}
|
||||
@@ -26,7 +26,7 @@ func (l *Limiter) CheckProtocolRule(protocol string) (reject bool) {
|
||||
return
|
||||
}
|
||||
|
||||
func (l *Limiter) UpdateRule(newRuleList []panel.DestinationRule) error {
|
||||
func (l *Limiter) UpdateRule(newRuleList []*regexp.Regexp) error {
|
||||
if !reflect.DeepEqual(l.Rules, newRuleList) {
|
||||
l.Rules = newRuleList
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user