update to v1.1.0

change to uniproxy api
refactor build inbound
refactor limiter and rule
add ss2022 support
add speedlimit support
and more...
This commit is contained in:
Yuzuki999
2022-12-18 23:31:06 +08:00
parent 0ac7ea691d
commit 695da4f4c5
23 changed files with 539 additions and 652 deletions

View File

@@ -16,7 +16,7 @@ func NewRule() *Rule {
}
}
func (r *Rule) UpdateRule(tag string, newRuleList *panel.DetectRule) error {
func (r *Rule) UpdateRule(tag string, newRuleList []panel.DestinationRule) error {
if value, ok := r.Rule.LoadOrStore(tag, newRuleList); ok {
oldRuleList := value.([]panel.DestinationRule)
if !reflect.DeepEqual(oldRuleList, newRuleList) {
@@ -30,20 +30,13 @@ func (r *Rule) Detect(tag string, destination string, protocol string) (reject b
reject = false
// If we have some rule for this inbound
if value, ok := r.Rule.Load(tag); ok {
ruleList := value.(*panel.DetectRule)
for i, _ := range ruleList.DestinationRule {
if ruleList.DestinationRule[i].Pattern.Match([]byte(destination)) {
ruleList := value.([]panel.DestinationRule)
for i := range ruleList {
if ruleList[i].Pattern.Match([]byte(destination)) {
reject = true
break
}
}
if !reject {
for _, v := range ruleList.ProtocolRule {
if v == protocol {
return true
}
}
}
}
return reject
}