func HTTPWrappersForConfig(config *Config, rt http.RoundTripper) (http.RoundTripper, error) {
	if config.WrapTransport != nil {
		rt = config.WrapTransport(rt)
	}
	rt = DebugWrappers(rt)
	switch {
	case config.HasBasicAuth() && config.HasTokenAuth():
		return nil, fmt.Errorf("username/password or bearer token may be set, but not both")
	case config.HasTokenAuth():
		var err error
		rt, err = NewBearerAuthWithRefreshRoundTripper(config.BearerToken, config.BearerTokenFile, rt)
		if err != nil {
			return nil, err
		}
	case config.HasBasicAuth():
		rt = NewBasicAuthRoundTripper(config.Username, config.Password, rt)
	}
	if len(config.UserAgent) > 0 {
		rt = NewUserAgentRoundTripper(config.UserAgent, rt)
	}
	if len(config.Impersonate.UserName) > 0 ||
		len(config.Impersonate.Groups) > 0 ||
		len(config.Impersonate.Extra) > 0 {
		rt = NewImpersonatingRoundTripper(config.Impersonate, rt)
	}
	return rt, nil
}
HTTPWrappersForConfig wraps a round tripper with any relevant layered
behavior from the config. Exposed to allow more clients that need HTTP-like
behavior but then must hijack the underlying connection (like WebSocket or
HTTP2 clients). Pure HTTP clients should use the RoundTripper returned from
New.
package transport
import (
	"fmt"
	"net/http"
	"strings"
	"time"
	"golang.org/x/oauth2"
	"k8s.io/klog"
	utilnet "k8s.io/apimachinery/pkg/util/net"
)