diff --git a/client/grpc/grpc.go b/client/grpc/grpc.go index 4ee17387..e2a0f9d3 100644 --- a/client/grpc/grpc.go +++ b/client/grpc/grpc.go @@ -412,7 +412,7 @@ func (g *grpcClient) Call(ctx context.Context, req client.Request, rsp interface } // inject proxy address - if len(callOpts.Address) == 0 && len(g.opts.Proxy) > 0 { + if len(g.opts.Proxy) > 0 { callOpts.Address = []string{g.opts.Proxy} } @@ -520,7 +520,7 @@ func (g *grpcClient) Stream(ctx context.Context, req client.Request, opts ...cli } // inject proxy address - if len(callOpts.Address) == 0 && len(g.opts.Proxy) > 0 { + if len(g.opts.Proxy) > 0 { callOpts.Address = []string{g.opts.Proxy} } diff --git a/client/mucp/mucp.go b/client/mucp/mucp.go index d40c650e..54214e55 100644 --- a/client/mucp/mucp.go +++ b/client/mucp/mucp.go @@ -379,7 +379,7 @@ func (r *rpcClient) Call(ctx context.Context, request client.Request, response i } // inject proxy address - if len(callOpts.Address) == 0 && len(r.opts.Proxy) > 0 { + if len(r.opts.Proxy) > 0 { callOpts.Address = []string{r.opts.Proxy} } @@ -480,7 +480,7 @@ func (r *rpcClient) Stream(ctx context.Context, request client.Request, opts ... } // inject proxy address - if len(callOpts.Address) == 0 && len(r.opts.Proxy) > 0 { + if len(r.opts.Proxy) > 0 { callOpts.Address = []string{r.opts.Proxy} } diff --git a/router/registry/registry.go b/router/registry/registry.go index 5a6db4dd..33317490 100644 --- a/router/registry/registry.go +++ b/router/registry/registry.go @@ -188,8 +188,14 @@ func (r *rtr) fetchRoutes(service string) error { for _, srv := range services { var domain string + + // since a wildcard query was performed, the service could belong + // to one of many namespaces, to get this information we check + // the node metadata. TODO: Add Domain to registry.Service if srv.Metadata != nil && len(srv.Metadata["domain"]) > 0 { domain = srv.Metadata["domain"] + } else if len(srv.Nodes) > 0 && srv.Nodes[0].Metadata != nil { + domain = srv.Nodes[0].Metadata["domain"] } else { domain = registry.WildcardDomain }