瀏覽代碼

sort Outbound selector output (#2914)

* clean code

* sort oubound selector output

* clean up

* fix duplicate outbound
Hossin Asaadi 1 年之前
父節點
當前提交
81f9f567ff
共有 1 個文件被更改,包括 3 次插入6 次删除
  1. 3 6
      app/proxyman/outbound/outbound.go

+ 3 - 6
app/proxyman/outbound/outbound.go

@@ -4,6 +4,7 @@ package outbound
 
 
 import (
 import (
 	"context"
 	"context"
+	"sort"
 	"strings"
 	"strings"
 	"sync"
 	"sync"
 
 
@@ -148,18 +149,14 @@ func (m *Manager) Select(selectors []string) []string {
 	tags := make([]string, 0, len(selectors))
 	tags := make([]string, 0, len(selectors))
 
 
 	for tag := range m.taggedHandler {
 	for tag := range m.taggedHandler {
-		match := false
 		for _, selector := range selectors {
 		for _, selector := range selectors {
 			if strings.HasPrefix(tag, selector) {
 			if strings.HasPrefix(tag, selector) {
-				match = true
+				tags = append(tags, tag)
 				break
 				break
 			}
 			}
 		}
 		}
-		if match {
-			tags = append(tags, tag)
-		}
 	}
 	}
-
+	sort.Strings(tags)
 	return tags
 	return tags
 }
 }