Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
Driver is a high-performance HTTP client driver that implements the httpclient.Driver interface. It uses the standard library's http.Client with optimizations for high throughput scenarios. This driver is optimized for maximum performance with minimal allocations and persistent connections.
func NewDriver ¶
func NewDriver() *Driver
NewDriver creates a new Driver with a high-performance HTTP client. The client is optimized for high throughput with: - Persistent connections and connection pooling - Aggressive keepalive settings - Optimized timeouts for low latency - Large connection pool limits
func NewDriverWithConfig ¶
func NewDriverWithConfig(config PerformanceConfig) *Driver
NewDriverWithConfig creates a new Driver with custom performance configuration.
func NewDriverWithHTTPClient ¶
NewDriverWithHTTPClient creates a new Driver with the specified HTTP client. This allows for custom HTTP client configurations, such as timeouts or transport settings. The driver is initialized with object pools for optimal performance.
func NewExtremePerformanceDriver ¶
func NewExtremePerformanceDriver() *Driver
NewExtremePerformanceDriver creates a driver optimized for extreme throughput.
func NewHighPerformanceDriver ¶
func NewHighPerformanceDriver() *Driver
NewHighPerformanceDriver creates a new Driver with maximum performance settings. This function provides the most aggressive optimization for high-throughput scenarios.
func (*Driver) Close ¶
func (d *Driver) Close()
Close releases resources held by the driver. It closes the HTTP client and clears the object pools. This should be called when the driver is no longer needed to prevent resource leaks. It is safe to call this multiple times.
func (*Driver) Do ¶
func (d *Driver) Do(req httpclient.Request) (httpclient.Response, error)
Do sends the HTTP request and returns the response. It uses object pooling to minimize allocations and improve performance.
type PerformanceConfig ¶
type PerformanceConfig struct { // Connection pool settings MaxIdleConns int MaxIdleConnsPerHost int MaxConnsPerHost int // Timeout settings IdleConnTimeout time.Duration TLSHandshakeTimeout time.Duration ResponseHeaderTimeout time.Duration ExpectContinueTimeout time.Duration RequestTimeout time.Duration // Performance settings DisableCompression bool ForceAttemptHTTP2 bool DisableKeepAlives bool }
PerformanceConfig holds configuration for high-performance HTTP client settings.
func DefaultPerformanceConfig ¶
func DefaultPerformanceConfig() PerformanceConfig
DefaultPerformanceConfig returns default high-performance configuration.
func ExtremePerformanceConfig ¶
func ExtremePerformanceConfig() PerformanceConfig
ExtremePerformanceConfig returns configuration optimized for maximum throughput. Use this configuration when you need to send thousands of requests per second.
type Request ¶
Request is a high-performance wrapper around http.Request that implements the httpclient.Request interface. It provides methods to set headers and access the underlying HTTP request. The request uses object pooling to minimize allocations.
type Response ¶
Response is a high-performance wrapper around http.Response that implements the httpclient.Response interface. It provides methods to access the response status code, body, and to close the response body. The response uses object pooling to minimize allocations.
func (*Response) Body ¶
Body returns the body of the HTTP response as an io.Reader. If the response is nil, it returns nil.
func (*Response) Close ¶
Close closes the response body and returns objects to the pool for reuse. This method should always be called when the response is no longer needed to prevent memory leaks and to return pooled objects for reuse.
func (*Response) StatusCode ¶
StatusCode returns the HTTP status code of the response. If the response is nil, it returns 0.