package discovery import ( "context" "git.loafle.net/overflow/overflow_discovery/discovery/types" ) type Discoverer interface { Discover(endded chan<- error) error DiscoverZone(endded chan<- error) error DiscoverHost(endded chan<- error) error DiscoverPort(endded chan<- error) error DiscoverService(endded chan<- error) error DiscoverUDPService(endded chan<- error) error } type discovery struct { zd zoneDiscoverer hd hostDiscoverer pd portDiscoverer endded chan<- error zoneEndded chan error hostEndded chan error portEndded chan error zoneFound chan *types.DiscoveryZone } func New() Discoverer { d := &discovery{} d.zd = newZoneDiscoverer() d.hd = newHostDiscoverer() d.pd = newPortDiscoverer() return d } func (d *discovery) Discover(endded chan<- error) error { d.endded = endded return nil } func (d *discovery) DiscoverZone(endded chan<- error) error { d.endded = endded // 1. When discoverd zone // 2. When occurred error return nil } func (d *discovery) DiscoverHost(endded chan<- error) error { d.endded = endded return nil } func (d *discovery) DiscoverPort(endded chan<- error) error { d.endded = endded return nil } func (d *discovery) DiscoverService(endded chan<- error) error { d.endded = endded return nil } func (d *discovery) DiscoverUDPService(endded chan<- error) error { d.endded = endded return nil } func (d *discovery) Shutdown(ctx context.Context) error { return nil }