overflow_discovery/discovery/discovery.go

83 lines
1.4 KiB
Go
Raw Normal View History

2017-10-20 05:28:07 +00:00
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
}