Use gateway if available
This commit is contained in:
parent
5b565f9f10
commit
b23d955536
@ -162,7 +162,10 @@ func (r *routerSelector) Select(service string, opts ...selector.SelectOption) (
|
|||||||
route := routes[idx%len(routes)]
|
route := routes[idx%len(routes)]
|
||||||
|
|
||||||
// defaults to gateway and no port
|
// defaults to gateway and no port
|
||||||
address := route.Gateway
|
address := route.Address
|
||||||
|
if len(route.Gateway) > 0 {
|
||||||
|
address = route.Gateway
|
||||||
|
}
|
||||||
|
|
||||||
// return as a node
|
// return as a node
|
||||||
return ®istry.Node{
|
return ®istry.Node{
|
||||||
|
@ -84,7 +84,11 @@ func (p *Proxy) getRoute(service string) ([]string, error) {
|
|||||||
toNodes := func(routes []table.Route) []string {
|
toNodes := func(routes []table.Route) []string {
|
||||||
var nodes []string
|
var nodes []string
|
||||||
for _, node := range routes {
|
for _, node := range routes {
|
||||||
nodes = append(nodes, node.Gateway)
|
address := node.Address
|
||||||
|
if len(node.Gateway) > 0 {
|
||||||
|
address = node.Gateway
|
||||||
|
}
|
||||||
|
nodes = append(nodes, address)
|
||||||
}
|
}
|
||||||
return nodes
|
return nodes
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user