func (f TransportOption) Apply(c *http.Client) error {
	var transport *http.Transport
	rt := c.Transport
	switch t := rt.(type) {
	case nil:
		transport = newDefaultTransport()
		c.Transport = transport
	case *http.Transport:
		transport = t
	default:
		return merry.Errorf("client.Transport is not a *http.Transport.  It's a %T", c.Transport)
	}
	return f(transport)
}
Apply implements Option.
package httpclient
import (
	"crypto/tls"
	"github.com/ansel1/merry"
	"net"
	"net/http"
	"time"
)
func New(opts ...Option) (*http.Client, error) {
	c := &http.Client{}
	return c, Apply(c, opts...)
}
func Apply(c *http.Client, opts ...Option) error {
	for _, opt := range opts {
		err := opt.Apply(c)
		if err != nil {
			return err
		}
	}
	return nil
}
func newDefaultTransport() *http.Transport {
	return &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
			DualStack: true,
		}).DialContext,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}
}
type Option interface {
	Apply(*http.Client) error
}
type OptionFunc func(*http.Client) error
func (f OptionFunc) Apply(c *http.Client) error {
	return f(c)
}
type TransportOption func(transport *http.Transport) error