code: func (s *persistentRemotes) WaitSelect(ctx context.Context) <-chan api.Peer {
  	c := make(chan api.Peer, 1)
  	s.RLock()
  	done := make(chan struct{})
  	go func() {
  		select {
  		case <-ctx.Done():
  			s.c.Broadcast()
  		case <-done:
  		}
  	}()
  	go func() {
  		defer s.RUnlock()
  		defer close(c)
  		defer close(done)
  		for {
  			if ctx.Err() != nil {
  				return
  			}
  			p, err := s.Select()
  			if err == nil {
  				c <- p
  				return
  			}
  			s.c.Wait()
  		}
  	}()
  	return c
  }
docs: // WaitSelect waits until at least one remote becomes available and then selects one.