proxy/httpproxy/proxy.go
func NewHandler(t *http.Transport, urlsFunc GetProxyURLs, failureWait time.Duration, refreshInterval time.Duration) http.Handler {
	if t.TLSClientConfig != nil {
		// Enable http2, see Issue 5033.
		err := http2.ConfigureTransport(t)
		if err != nil {
			plog.Infof("Error enabling Transport HTTP/2 support: %v", err)
		}
	}

	p := &reverseProxy{
		director:  newDirector(urlsFunc, failureWait, refreshInterval),
		transport: t,
	}

	mux := http.NewServeMux()
	mux.Handle("/", p)
	mux.HandleFunc("/v2/config/local/proxy", p.configHandler)

	return mux
}
func NewHandler(t *http.Transport, urlsFunc GetProxyURLs, failureWait time.Duration, refreshInterval time.Duration) http.Handler {
	if t.TLSClientConfig != nil {
		// Enable http2, see Issue 5033.
		err := http2.ConfigureTransport(t)
		if err != nil {
			plog.Infof("Error enabling Transport HTTP/2 support: %v", err)
		}
	}

	p := &reverseProxy{
		director:  newDirector(urlsFunc, failureWait, refreshInterval),
		transport: t,
	}

	mux := http.NewServeMux()
	mux.Handle("/", p)
	mux.HandleFunc("/v2/config/local/proxy", p.configHandler)

	return mux
}
func NewHandler ( t * http . Transport , urlsFunc GetProxyURLs , failureWait time . Duration , refreshInterval time . Duration ) http . Handler { if t . TLSClientConfig != nil { // Enable http2, see Issue 5033. err := http2 . ConfigureTransport ( t ) if err != nil { plog . Infof ( " " , err ) } } p := & reverseProxy { director : newDirector ( urlsFunc , failureWait , refreshInterval ) , transport : t , } mux := http . NewServeMux ( ) mux . Handle ( " " , p ) mux . HandleFunc ( " " , p . configHandler ) return mux }
// NewHandler creates a new HTTP handler, listening on the given transport,
// which will proxy requests to an etcd cluster.
// The handler will periodically update its view of the cluster.
NewHandler creates a new HTTP handler listening on the given transport which will proxy requests to an etcd cluster . The handler will periodically update its view of the cluster .