Merge pull request #93 from aledbf/fix-sort

Fix sort for catch all server
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-01-02 16:23:05 -03:00 committed by GitHub
commit 567fa3b456

View file

@ -54,6 +54,10 @@ type ServerByName []*Server
func (c ServerByName) Len() int { return len(c) } func (c ServerByName) Len() int { return len(c) }
func (c ServerByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] } func (c ServerByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
func (c ServerByName) Less(i, j int) bool { func (c ServerByName) Less(i, j int) bool {
// special case for catch all server
if c[j].Hostname == "_" {
return false
}
return c[i].Hostname < c[j].Hostname return c[i].Hostname < c[j].Hostname
} }