use noop resolver in network by default

This commit is contained in:
Asim Aslam 2020-08-09 22:11:57 +01:00
parent a7c70c66b1
commit 65e6ee8566
4 changed files with 17 additions and 4 deletions

View File

@ -431,7 +431,7 @@ func (n *mucpNetwork) resolveNodes() ([]string, error) {
} }
// sort by lowest priority // sort by lowest priority
if err == nil { if err == nil && len(records) > 0 {
sort.Slice(records, func(i, j int) bool { return records[i].Priority < records[j].Priority }) sort.Slice(records, func(i, j int) bool { return records[i].Priority < records[j].Priority })
} }

View File

@ -3,7 +3,7 @@ package network
import ( import (
"github.com/google/uuid" "github.com/google/uuid"
"github.com/micro/go-micro/v3/network/resolver" "github.com/micro/go-micro/v3/network/resolver"
"github.com/micro/go-micro/v3/network/resolver/registry" "github.com/micro/go-micro/v3/network/resolver/noop"
"github.com/micro/go-micro/v3/proxy" "github.com/micro/go-micro/v3/proxy"
"github.com/micro/go-micro/v3/proxy/mucp" "github.com/micro/go-micro/v3/proxy/mucp"
"github.com/micro/go-micro/v3/router" "github.com/micro/go-micro/v3/router"
@ -107,6 +107,6 @@ func DefaultOptions() Options {
Tunnel: tunnel.NewTunnel(), Tunnel: tunnel.NewTunnel(),
Router: regRouter.NewRouter(), Router: regRouter.NewRouter(),
Proxy: mucp.NewProxy(), Proxy: mucp.NewProxy(),
Resolver: &registry.Resolver{}, Resolver: new(noop.Resolver),
} }
} }

View File

@ -0,0 +1,13 @@
// Package noop is a noop resolver
package noop
import (
"github.com/micro/go-micro/v3/network/resolver"
)
type Resolver struct{}
// Resolve returns the list of nodes
func (r *Resolver) Resolve(name string) ([]*resolver.Record, error) {
return []*resolver.Record{}, nil
}

View File

@ -1,5 +1,5 @@
// Package static is a static resolver // Package static is a static resolver
package registry package static
import ( import (
"github.com/micro/go-micro/v3/network/resolver" "github.com/micro/go-micro/v3/network/resolver"