code: func (s *Server) Listen(addr string) error {
  	if s.listener != nil {
  		return nil
  	}
  
  	if addr == "" {
  		return fmt.Errorf("<host>:<port> needs to be provided to start listening")
  	}
  
  	var err error
  	s.listener, err = listen.Listen(addr)
  	if err != nil {
  		return fmt.Errorf("Failed to listen on %s: %v", addr, err)
  	}
  	base := s.ListenURL()
  	s.printf("Starting to listen on %s\n", base)
  
  	doEnableTLS := func() error {
  		config := &tls.Config{
  			Rand:       rand.Reader,
  			Time:       time.Now,
  			NextProtos: []string{http2.NextProtoTLS, "http/1.1"},
  			MinVersion: tls.VersionTLS12,
  		}
  		if s.tlsCertFile == "" && s.certManager != nil {
  			config.GetCertificate = s.certManager
  			// TODO(mpl): see if we can instead use
  			// https://godoc.org/golang.org/x/crypto/acme/autocert#Manager.TLSConfig
  			config.NextProtos = append(config.NextProtos, alpnProto)
  			s.listener = tls.NewListener(s.listener, config)
  			return nil
  		}
  
  		config.Certificates = make([]tls.Certificate, 1)
  		config.Certificates[0], err = loadX509KeyPair(s.tlsCertFile, s.tlsKeyFile)
  		if err != nil {
  			return fmt.Errorf("Failed to load TLS cert: %v", err)
  		}
  		s.listener = tls.NewListener(s.listener, config)
  		return nil
  	}
  	if s.enableTLS {
  		if err := doEnableTLS(); err != nil {
  			return err
  		}
  	}
  
  	if strings.HasSuffix(base, ":0") {
  		s.printf("Now listening on %s\n", s.ListenURL())
  	}
  
  	return nil
  }
docs: // Listen starts listening on the given host:port addr.