feat: passthrough proxies
This commit is contained in:
@ -2,6 +2,7 @@ package proxy
|
||||
|
||||
import (
|
||||
"os"
|
||||
"slices"
|
||||
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/client"
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/command/admin/apierr"
|
||||
@ -51,6 +52,8 @@ func QueryCommand() *cli.Command {
|
||||
return errors.WithStack(apierr.Wrap(err))
|
||||
}
|
||||
|
||||
slices.SortFunc(proxies, sortProxiesByWeight)
|
||||
|
||||
hints := proxyHeaderHints(baseFlags.OutputMode)
|
||||
|
||||
if err := format.Write(baseFlags.Format, os.Stdout, hints, clientFlag.AsAnySlice(proxies)...); err != nil {
|
||||
@ -61,3 +64,13 @@ func QueryCommand() *cli.Command {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func sortProxiesByWeight(a *store.ProxyHeader, b *store.ProxyHeader) int {
|
||||
if a.Weight < b.Weight {
|
||||
return 1
|
||||
}
|
||||
if a.Weight > b.Weight {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
Reference in New Issue
Block a user