support protocol rule

This commit is contained in:
Yuzuki616
2023-07-20 21:14:18 +08:00
parent 7cc57fe2ba
commit adf98fbc81
6 changed files with 92 additions and 48 deletions

View File

@@ -3,15 +3,16 @@ package limiter
import (
"errors"
"fmt"
"regexp"
"sync"
"time"
"github.com/Yuzuki616/V2bX/api/panel"
"github.com/Yuzuki616/V2bX/common/format"
"github.com/Yuzuki616/V2bX/conf"
"github.com/juju/ratelimit"
log "github.com/sirupsen/logrus"
"github.com/xtls/xray-core/common/task"
"regexp"
"sync"
"time"
)
var limitLock sync.RWMutex
@@ -32,7 +33,7 @@ func Init() {
}
type Limiter struct {
Rules []*regexp.Regexp
DomainRules []*regexp.Regexp
ProtocolRules []string
SpeedLimit int
UserLimitInfo *sync.Map // Key: Uid value: UserLimitInfo