func (rt RoundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
	if r.Header.Get("User-Agent") == "" {
		r.Header.Set("User-Agent", UserAgent)
	}
	for _, cookie := range rt.cookies.Cookies(r.URL) {
		r.AddCookie(cookie)
	}
	resp, err := rt.upstream.RoundTrip(r)
	if err != nil {
		return nil, err
	}
	if resp.StatusCode == 503 && strings.HasPrefix(resp.Header.Get("Server"), "cloudflare") {
		req, err := buildAnswerRequest(resp)
		if err != nil {
			return nil, err
		}
		time.Sleep(5 * time.Second)
		resp, err = rt.upstream.RoundTrip(req)
		if err != nil {
			return nil, err
		}
		if cookies := resp.Cookies(); len(cookies) > 0 {
			rt.cookies.SetCookies(resp.Request.URL, resp.Cookies())
		}
	}
	return resp, err
}
RoundTrip implements the RoundTripper interface for the Transport type.
package cfrt
import (
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/http/cookiejar"
	"net/url"
	"regexp"
	"strconv"
	"strings"
	"time"
	"github.com/robertkrimen/otto"
)
const (
	UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
)
var (
	jschlRE = regexp.MustCompile(`name="jschl_vc" value="(\w+)"`)
	passRE  = regexp.MustCompile(`name="pass" value="(.+?)"`)
	jsRE    = regexp.MustCompile(
		`setTimeout\(function\(\){\s+(var ` +
			`s,t,o,p,b,r,e,a,k,i,n,g,f.+?\r?\n[\s\S]+?a\.value =.+?)\r?\n`,
	)
	jsReplace1RE = regexp.MustCompile(`a\.value = (.+ \+ t\.length).+`)
	jsReplace2RE = regexp.MustCompile(`\s{3,}[a-z](?: = |\.).+`)
	jsReplace3RE = regexp.MustCompile(`[\n\\']`)
)
type RoundTripper struct {
	upstream http.RoundTripper
	cookies  http.CookieJar
}
func New(upstream http.RoundTripper) (*RoundTripper, error) {
	jar, err := cookiejar.New(nil)
	if err != nil {
		return nil, err
	}
	return &RoundTripper{upstream, jar}, nil
}