func Dialer(transport http.RoundTripper) (DialFunc, error) { if transport == nil { return nil, nil } switch transport := transport.(type) { case *http.Transport: return transport.Dial, nil case RoundTripperWrapper: return Dialer(transport.WrappedRoundTripper()) default: return nil, fmt.Errorf("unknown transport type: %v", transport) } }
func TLSClientConfig(transport http.RoundTripper) (*tls.Config, error) { if transport == nil { return nil, nil } switch transport := transport.(type) { case *http.Transport: return transport.TLSClientConfig, nil case RoundTripperWrapper: return TLSClientConfig(transport.WrappedRoundTripper()) default: return nil, fmt.Errorf("unknown transport type: %v", transport) } }