// ListenAndServe listens on proxy.Address and then calls Serve to handle
// requests on incoming connections.
ListenAndServe listens on proxy.Address and then calls Serve to handle
requests on incoming connections.
// ListenAndServe listens on proxy . Address and then calls Serve to handle // requests on incoming connections .
func (s *APIServer) ListenAndServe() {
	server := http.NewServeMux()
	server.Handle("/", http.RedirectHandler("/dashboard", 307))
	server.HandleFunc("/dashboard", s.dashboard)
	server.HandleFunc("/stats", s.stats)
	if s.TLS.Cert != "" && s.TLS.Key != "" {
		log.Debugf("Handling https connection on %s", s.Address)
		err := http.ListenAndServeTLS(s.Address, s.TLS.Cert, s.TLS.Key, server)
		if err != nil {
			log.Debugf("Error while listening https connection: %v", err)
		}
	} else {
		log.Debugf("Handling http connection on %s", s.Address)
		err := http.ListenAndServe(s.Address, server)
		if err != nil {
			log.Fatalf("Error while listening http connection: %v", err)
		}
	}
}
func ( s * APIServer ) ListenAndServe ( ) { server := http . NewServeMux ( ) server . Handle ( " " , http . RedirectHandler ( " " , 307 ) ) server . HandleFunc ( " " , s . dashboard ) server . HandleFunc ( " " , s . stats ) if s . TLS . Cert != " " && s . TLS . Key != " " { log . Debugf ( " " , s . Address ) err := http . ListenAndServeTLS ( s . Address , s . TLS . Cert , s . TLS . Key , server ) if err != nil { log . Debugf ( " " , err ) } } else { log . Debugf ( " " , s . Address ) err := http . ListenAndServe ( s . Address , server ) if err != nil { log . Fatalf ( " " , err ) } } }
ListenAndServe listens on proxy.Address and then calls Serve to handle
requests on incoming connections.
ListenAndServe listens on proxy . Address and then calls Serve to handle requests on incoming connections .