Documentation
¶
Index ¶
- Variables
- func DumpRequestRaw(method, url, uripath string, version client.Version, ...) ([]byte, error)
- func TlsHandshake(conn net.Conn, addr string, timeout time.Duration) (net.Conn, error)
- type BaseConn
- type Client
- func (c *Client) Close()
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) DoRaw(method, url, uripath string, version client.Version, ...) (*http.Response, error)
- func (c *Client) DoRawWithOptions(method, url, uripath string, version client.Version, ...) (*http.Response, error)
- func (c *Client) Dor(req *retryablehttp.Request) (*http.Response, error)
- func (c *Client) Get(url string) (*http.Response, error)
- func (c *Client) Head(url string) (*http.Response, error)
- func (c *Client) Post(url string, mimetype string, body io.Reader) (*http.Response, error)
- type Conn
- type Dialer
- type LocalAddrManager
- func (lam *LocalAddrManager) AllocatePort() (port int, err error)
- func (lam *LocalAddrManager) Close()
- func (lam *LocalAddrManager) FreePort(port int)
- func (lam *LocalAddrManager) GetIPFromNetInterface(inter net.Interface) (net.IP, bool)
- func (lam *LocalAddrManager) GetLocalAddr(interName string) (*net.TCPAddr, error)
- func (lam *LocalAddrManager) GetLocalIP(interName string) (net.IP, error)
- type Middleware
- type Options
- type PipelineClient
- func (c *PipelineClient) Do(req *http.Request) (*http.Response, error)
- func (c *PipelineClient) DoRaw(method, url, uripath string, headers map[string][]string, body io.Reader) (*http.Response, error)
- func (c *PipelineClient) DoRawWithOptions(method, url, uripath string, headers map[string][]string, body io.Reader, ...) (*http.Response, error)
- func (c *PipelineClient) Dor(req *retryablehttp.Request) (*http.Response, error)
- func (c *PipelineClient) Get(url string) (*http.Response, error)
- func (c *PipelineClient) Head(url string) (*http.Response, error)
- func (c *PipelineClient) Post(url string, mimetype string, body io.Reader) (*http.Response, error)
- type PipelineOptions
- type RedirectStatus
- type StatusError
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{ Timeout: 30 * time.Second, FollowRedirects: true, MaxRedirects: 10, AutomaticHostHeader: true, AutomaticContentLength: true, }
DefaultOptions is the default configuration options for the client
var DefaultPipelineOptions = PipelineOptions{ Timeout: 30 * time.Second, MaxConnections: 5, MaxPendingRequests: 100, AutomaticHostHeader: true, }
DefaultPipelineOptions is the default options for pipelined http client
Functions ¶
Types ¶
type BaseConn ¶ added in v0.1.31
func NewBaseConn ¶ added in v0.1.31
type Client ¶
type Client struct { DefaultOptions Options // contains filtered or unexported fields }
Client is a client for making raw http requests with go
func (*Client) DoRaw ¶
func (c *Client) DoRaw(method, url, uripath string, version client.Version, headers map[string][]string, body io.Reader) (*http.Response, error)
DoRaw does a raw request with some configuration
func (*Client) DoRawWithOptions ¶
func (c *Client) DoRawWithOptions(method, url, uripath string, version client.Version, headers map[string][]string, body io.Reader, options Options) (*http.Response, error)
DoRawWithOptions performs a raw request with additional options
type Conn ¶
type Conn interface { client.Client io.Closer SetDeadline(time.Time) error SetReadDeadline(time.Time) error SetWriteDeadline(time.Time) error Release() }
Conn is an interface implemented by a connection
type Dialer ¶
type Dialer interface { // Dial dials a remote http server returning a Conn. Dial(protocol, addr string, options Options, fd *fastdialer.Dialer) (Conn, error) DialWithProxy(protocol, addr, proxyURL string, timeout time.Duration, options Options, fd *fastdialer.Dialer) (Conn, error) // Dial dials a remote http server with timeout returning a Conn. DialTimeout(protocol, addr string, timeout time.Duration, options Options, fd *fastdialer.Dialer) (Conn, error) }
Dialer can dial a remote HTTP server.
type LocalAddrManager ¶ added in v0.1.31
type LocalAddrManager struct {
// contains filtered or unexported fields
}
func NewLocalAddrManager ¶ added in v0.1.31
func NewLocalAddrManager() *LocalAddrManager
func (*LocalAddrManager) AllocatePort ¶ added in v0.1.31
func (lam *LocalAddrManager) AllocatePort() (port int, err error)
func (*LocalAddrManager) Close ¶ added in v0.1.31
func (lam *LocalAddrManager) Close()
func (*LocalAddrManager) FreePort ¶ added in v0.1.31
func (lam *LocalAddrManager) FreePort(port int)
func (*LocalAddrManager) GetIPFromNetInterface ¶ added in v0.1.31
func (*LocalAddrManager) GetLocalAddr ¶ added in v0.1.31
func (lam *LocalAddrManager) GetLocalAddr(interName string) (*net.TCPAddr, error)
func (*LocalAddrManager) GetLocalIP ¶ added in v0.1.31
func (lam *LocalAddrManager) GetLocalIP(interName string) (net.IP, error)
type Middleware ¶ added in v0.1.27
type Middleware interface {
Handle(Options, fastdialer.Options, *client.Request)
}
type Options ¶
type Options struct { Timeout time.Duration FollowRedirects bool MaxRedirects int AutomaticHostHeader bool AutomaticContentLength bool CustomHeaders client.Headers ForceReadAllBody bool // ignores content length and reads all body CustomRawBytes []byte Proxy string ProxyDialTimeout time.Duration SNI string //* NetInterface string Middlewares []Middleware LocalAddr *net.TCPAddr BaseResolvers []string Control func(network string, address string, c syscall.RawConn) error }
Options contains configuration options for rawhttp client
type PipelineClient ¶
type PipelineClient struct {
// contains filtered or unexported fields
}
PipelineClient is a client for making pipelined http requests
func NewPipelineClient ¶
func NewPipelineClient(options PipelineOptions) *PipelineClient
NewPipelineClient creates a new pipelined http request client
func (*PipelineClient) DoRaw ¶
func (c *PipelineClient) DoRaw(method, url, uripath string, headers map[string][]string, body io.Reader) (*http.Response, error)
DoRaw does a raw request with some configuration
func (*PipelineClient) DoRawWithOptions ¶
func (c *PipelineClient) DoRawWithOptions(method, url, uripath string, headers map[string][]string, body io.Reader, options PipelineOptions) (*http.Response, error)
DoRawWithOptions performs a raw request with additional options
func (*PipelineClient) Dor ¶
func (c *PipelineClient) Dor(req *retryablehttp.Request) (*http.Response, error)
Dor sends a retryablehttp request and returns a response
func (*PipelineClient) Get ¶
func (c *PipelineClient) Get(url string) (*http.Response, error)
Get makes a GET request to a given URL
type PipelineOptions ¶
type PipelineOptions struct { Dialer clientpipeline.DialFunc Host string Timeout time.Duration MaxConnections int MaxPendingRequests int AutomaticHostHeader bool }
PipelineOptions contains options for pipelined http client
type RedirectStatus ¶
RedirectStatus is the current redirect status for the request
type StatusError ¶
StatusError is a HTTP status error object
func (*StatusError) Error ¶
func (s *StatusError) Error() string