Add watch options

This commit is contained in:
Asim Aslam
2018-02-19 17:12:37 +00:00
parent eb7788ce25
commit 02260dcaa3
9 changed files with 78 additions and 27 deletions

View File

@@ -9,6 +9,7 @@ import (
)
type mdnsWatcher struct {
wo registry.WatchOptions
ch chan *mdns.ServiceEntry
exit chan struct{}
}
@@ -26,6 +27,12 @@ func (m *mdnsWatcher) Next() (*registry.Result, error) {
continue
}
// Filter watch options
// wo.Service: Only keep services we care about
if len(m.wo.Service) > 0 && txt.Service != m.wo.Service {
continue
}
var action string
if e.TTL == 0 {