func (me *Server) ssdpInterface(if_ net.Interface) {
	s := ssdp.Server{
		Interface: if_,
		Devices:   devices(),
		Services:  serviceTypes(),
		Location: func(ip net.IP) string {
			return me.location(ip)
		},
		Server:         serverField,
		UUID:           me.rootDeviceUUID,
		NotifyInterval: me.NotifyInterval,
	}
	if err := s.Init(); err != nil {
		if if_.Flags&ssdpInterfaceFlags != ssdpInterfaceFlags {
			// Didn't expect it to work anyway.
			return
		}
		if strings.Contains(err.Error(), "listen") {
			// OSX has a lot of dud interfaces. Failure to create a socket on
			// the interface are what we're expecting if the interface is no
			// good.
			return
		}
		logger.Errorf("error creating ssdp server on %s: %s", if_.Name, err)
		return
	}
	defer s.Close()
	logger.Debugf("started SSDP on %s", if_.Name)
	stopped := make(chan struct{})
	go func() {
		defer close(stopped)
		if err := s.Serve(); err != nil {
			logger.Errorf("%q: %q\n", if_.Name, err)
		}
	}()
	select {
	case <-me.closed:
		// Returning will close the server.
	case <-stopped:
	}
}
// Run SSDP server on an interface.
Run SSDP server on an interface.
// Run SSDP server on an interface .
func (me *Server) ssdpInterface(if_ net.Interface) {
	s := ssdp.Server{
		Interface: if_,
		Devices:   devices(),
		Services:  serviceTypes(),
		Location: func(ip net.IP) string {
			return me.location(ip)
		},
		Server:         serverField,
		UUID:           me.rootDeviceUUID,
		NotifyInterval: me.NotifyInterval,
	}
	if err := s.Init(); err != nil {
		if if_.Flags&ssdpInterfaceFlags != ssdpInterfaceFlags {
			return
		}
		if strings.Contains(err.Error(), "listen") {
			return
		}
		logger.Errorf("error creating ssdp server on %s: %s", if_.Name, err)
		return
	}
	defer s.Close()
	logger.Debugf("started SSDP on %s", if_.Name)
	stopped := make(chan struct{})
	go func() {
		defer close(stopped)
		if err := s.Serve(); err != nil {
			logger.Errorf("%q: %q\n", if_.Name, err)
		}
	}()
	select {
	case <-me.closed:
	case <-stopped:
	}
}
func ( me * Server ) ssdpInterface ( if_ net . Interface ) { s := ssdp . Server { Interface : if_ , Devices : devices ( ) , Services : serviceTypes ( ) , Location : func ( ip net . IP ) string { return me . location ( ip ) } , Server : serverField , UUID : me . rootDeviceUUID , NotifyInterval : me . NotifyInterval , } if err := s . Init ( ) ; err != nil { if if_ . Flags & ssdpInterfaceFlags != ssdpInterfaceFlags { return } if strings . Contains ( err . Error ( ) , " " ) { return } logger . Errorf ( " " , if_ . Name , err ) return } defer s . Close ( ) logger . Debugf ( " " , if_ . Name ) stopped := make ( chan struct { } ) go func ( ) { defer close ( stopped ) if err := s . Serve ( ) ; err != nil { logger . Errorf ( " \n " , if_ . Name , err ) } } ( ) select { case <- me . closed : case <- stopped : } }
Run SSDP server on an interface.
Run SSDP server on an interface .
// Didn't expect it to work anyway. // OSX has a lot of dud interfaces. Failure to create a socket on // the interface are what we're expecting if the interface is no // good. // Returning will close the server.