Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnsupportedVersion = errors.New("mimic: unsupported version")
)
Functions ¶
This section is empty.
Types ¶
type ClientSpec ¶
type ClientSpec struct {
HTTP2Options *HTTP2Options
GetTlsSpec func() *utls.ClientHelloSpec
// contains filtered or unexported fields
}
func (*ClientSpec) ClientHintUA ¶
func (c *ClientSpec) ClientHintUA() string
ClientHintUA returns the "sec-ch-ua" header value for the mimicked client.
func (*ClientSpec) ConfigureTransport ¶
func (c *ClientSpec) ConfigureTransport(t1 *http.Transport) *http.Transport
ConfigureTransport configures a http.Transport to follow the client's spec Returns the given Transport for convenience
func (*ClientSpec) PseudoHeaderOrder ¶
func (c *ClientSpec) PseudoHeaderOrder() []string
PseudoHeaderOrder returns the pseudo header order for the mimicked client.
func (*ClientSpec) Version ¶
func (c *ClientSpec) Version() string
Version returns the version for the mimicked client..
type HTTP2Options ¶
type Transport ¶
type Transport struct {
Transport http.RoundTripper
PseudoHeaderOrder []string
DefaultHeaders http.Header
}
Transport is a Transport that takes care of: - Randomizing the header order (if not set) - Pseudo Header Order - Default Headers. See NewTransport for its default headers.
func NewTransport ¶
func NewTransport(opts TransportOptions) (*Transport, error)
NewTransport creates a new Transport for the given options Given a Chromium browser's brand, version and platform, it will create a new Transport that mimics the following: - Pseudo Header Order - Sec-Ch-Ua - Sec-Ch-Ua-Mobile - Sec-Ch-Ua-Platform - User-Agent
See Transport for more details.
func (*Transport) CloseIdleConnections ¶ added in v1.0.2
func (t *Transport) CloseIdleConnections()
type TransportOptions ¶
type TransportOptions struct {
// Version is the Chromium version of the browser to mimic
Version string
// Brand is the brand of the browser to mimic
Brand Brand
// Platform is the platform of the browser to mimic
Platform Platform
// Transport is the transport to use for the browser
// If nil, a new http.Transport will be created
Transport *http.Transport
}