Exemplo n.º 1
0
// DiscoveryServer returns a new Discovery server that is advertizing the Room
// in zc.
func DiscoveryServer(zc *ZoneConfig) (Discovery, error) {
	config, err := zc.mdnsConfig(nil)
	if err != nil {
		return nil, fmt.Errorf("invalid discovery configuration: %v", err)
	}
	log.Printf("[INFO] Discovery configuration: %v", config.Zone)
	srv, err := mdns.NewServer(config)
	if err != nil {
		return nil, err
	}
	log.Printf("[INFO] Discovery server started")
	d := &mdnsDiscovery{srv: srv}
	return d, nil
}
Exemplo n.º 2
0
// NewDiscoverable returns a new Discoverable server that is advertizing the
// Room in zc.
func NewDiscoverable(zc *ZoneConfig) (Discoverable, error) {
	config, err := zc.mdnsConfig(nil)
	if err != nil {
		return nil, fmt.Errorf("invalid discovery configuration: %v", err)
	}
	srv, err := mdns.NewServer(config)
	if err != nil {
		return nil, err
	}
	d := &mdnsDiscoverable{
		zc:  zc,
		srv: srv,
	}
	return d, nil
}