Browse Source

sort Outbound selector output (#2914)

* clean code

* sort oubound selector output

* clean up

* fix duplicate outbound
pull/2930/head
Hossin Asaadi 11 months ago committed by GitHub
parent
commit
81f9f567ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/proxyman/outbound/outbound.go

9
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
}

Loading…
Cancel
Save