Registry router fixes (#1961)

* only cache routes if told to do so

* Use roundrobin selector and retry in proxy

* Update lookup to require service

* Fix compile

* Fix compile

* Update

* Update

* rename query to lookup

* Update router.go

* Update
This commit is contained in:
Asim Aslam 2020-08-21 09:23:01 +01:00 committed by Vasiliy Tolstov
parent 37d283e66f
commit 8f78a764c1

10
mdns.go
View File

@ -42,19 +42,19 @@ func (m *mdnsRouter) Table() router.Table {
return nil return nil
} }
func (m *mdnsRouter) Lookup(opts ...router.QueryOption) ([]router.Route, error) { func (m *mdnsRouter) Lookup(service string, opts ...router.LookupOption) ([]router.Route, error) {
options := router.NewQuery(opts...) options := router.NewLookup(opts...)
// check to see if we have the port provided in the service, e.g. go-micro-srv-foo:8000 // check to see if we have the port provided in the service, e.g. go-micro-srv-foo:8000
service, port, err := net.SplitHostPort(options.Service) srv, port, err := net.SplitHostPort(service)
if err != nil { if err != nil {
service = options.Service srv = service
} }
// query for the host // query for the host
entries := make(chan *mdns.ServiceEntry) entries := make(chan *mdns.ServiceEntry)
p := mdns.DefaultParams(service) p := mdns.DefaultParams(srv)
p.Timeout = time.Millisecond * 100 p.Timeout = time.Millisecond * 100
p.Entries = entries p.Entries = entries