From 81f9f567ffa9dfc987dff2724369c3884d065bcb Mon Sep 17 00:00:00 2001 From: Hossin Asaadi Date: Wed, 10 Jan 2024 19:26:27 +0300 Subject: [PATCH] sort Outbound selector output (#2914) * clean code * sort oubound selector output * clean up * fix duplicate outbound --- app/proxyman/outbound/outbound.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/proxyman/outbound/outbound.go b/app/proxyman/outbound/outbound.go index 8ebcde17..1bc4c403 100644 --- a/app/proxyman/outbound/outbound.go +++ b/app/proxyman/outbound/outbound.go @@ -4,6 +4,7 @@ package outbound import ( "context" + "sort" "strings" "sync" @@ -148,18 +149,14 @@ func (m *Manager) Select(selectors []string) []string { tags := make([]string, 0, len(selectors)) for tag := range m.taggedHandler { - match := false for _, selector := range selectors { if strings.HasPrefix(tag, selector) { - match = true + tags = append(tags, tag) break } } - if match { - tags = append(tags, tag) - } } - + sort.Strings(tags) return tags }