@@ -180,10 +180,6 @@ type Client struct {
180180 // Default client name is used if not set.
181181 Name string
182182
183- // NoDefaultUserAgentHeader when set to true, causes the default
184- // User-Agent header to be excluded from the Request.
185- NoDefaultUserAgentHeader bool
186-
187183 // Callback for establishing new connections to hosts.
188184 //
189185 // Default DialTimeout is used if not set.
@@ -197,15 +193,6 @@ type Client struct {
197193 // If not set, DialTimeout is used.
198194 Dial DialFunc
199195
200- // Attempt to connect to both ipv4 and ipv6 addresses if set to true.
201- //
202- // This option is used only if default TCP dialer is used,
203- // i.e. if Dial is blank.
204- //
205- // By default client connects only to ipv4 addresses,
206- // since unfortunately ipv6 remains broken in many networks worldwide :)
207- DialDualStack bool
208-
209196 // TLS config for https connections.
210197 //
211198 // Default TLS config is used if not set.
@@ -261,6 +248,19 @@ type Client struct {
261248 // By default response body size is unlimited.
262249 MaxResponseBodySize int
263250
251+ // NoDefaultUserAgentHeader when set to true, causes the default
252+ // User-Agent header to be excluded from the Request.
253+ NoDefaultUserAgentHeader bool
254+
255+ // Attempt to connect to both ipv4 and ipv6 addresses if set to true.
256+ //
257+ // This option is used only if default TCP dialer is used,
258+ // i.e. if Dial is blank.
259+ //
260+ // By default client connects only to ipv4 addresses,
261+ // since unfortunately ipv6 remains broken in many networks worldwide :)
262+ DialDualStack bool
263+
264264 // Header names are passed as-is without normalization
265265 // if this option is set.
266266 //
@@ -288,6 +288,9 @@ type Client struct {
288288 // extra slashes are removed, special characters are encoded.
289289 DisablePathNormalizing bool
290290
291+ // StreamResponseBody enables response body streaming.
292+ StreamResponseBody bool
293+
291294 // Maximum duration for waiting for a free connection.
292295 //
293296 // By default will not waiting, return ErrNoFreeConns immediately.
@@ -301,9 +304,6 @@ type Client struct {
301304 // Connection pool strategy. Can be either LIFO or FIFO (default).
302305 ConnPoolStrategy ConnPoolStrategyType
303306
304- // StreamResponseBody enables response body streaming.
305- StreamResponseBody bool
306-
307307 // ConfigureClient configures the fasthttp.HostClient.
308308 ConfigureClient func (hc * HostClient ) error
309309
@@ -698,10 +698,6 @@ type HostClient struct {
698698 // Client name. Used in User-Agent request header.
699699 Name string
700700
701- // NoDefaultUserAgentHeader when set to true, causes the default
702- // User-Agent header to be excluded from the Request.
703- NoDefaultUserAgentHeader bool
704-
705701 // Callback for establishing new connections to hosts.
706702 //
707703 // Default DialTimeout is used if not set.
@@ -715,19 +711,6 @@ type HostClient struct {
715711 // If not set, DialTimeout is used.
716712 Dial DialFunc
717713
718- // Attempt to connect to both ipv4 and ipv6 host addresses
719- // if set to true.
720- //
721- // This option is used only if default TCP dialer is used,
722- // i.e. if Dial and DialTimeout are blank.
723- //
724- // By default client connects only to ipv4 addresses,
725- // since unfortunately ipv6 remains broken in many networks worldwide :)
726- DialDualStack bool
727-
728- // Whether to use TLS (aka SSL or HTTPS) for host connections.
729- IsTLS bool
730-
731714 // Optional TLS config.
732715 TLSConfig * tls.Config
733716
@@ -785,6 +768,64 @@ type HostClient struct {
785768 // By default response body size is unlimited.
786769 MaxResponseBodySize int
787770
771+ // Maximum duration for waiting for a free connection.
772+ //
773+ // By default will not waiting, return ErrNoFreeConns immediately
774+ MaxConnWaitTimeout time.Duration
775+
776+ // RetryIf controls whether a retry should be attempted after an error.
777+ //
778+ // By default will use isIdempotent function
779+ RetryIf RetryIfFunc
780+
781+ // Transport defines a transport-like mechanism that wraps every request/response.
782+ Transport RoundTripper
783+
784+ // Connection pool strategy. Can be either LIFO or FIFO (default).
785+ ConnPoolStrategy ConnPoolStrategyType
786+
787+ connsLock sync.Mutex
788+ connsCount int
789+ conns []* clientConn
790+ connsWait * wantConnQueue
791+
792+ addrsLock sync.Mutex
793+ addrs []string
794+ addrIdx uint32
795+ lastUseTime uint32
796+
797+ tlsConfigMap map [string ]* tls.Config
798+ tlsConfigMapLock sync.Mutex
799+
800+ readerPool sync.Pool
801+ writerPool sync.Pool
802+
803+ clientReaderPool * sync.Pool
804+ clientWriterPool * sync.Pool
805+
806+ pendingRequests int32
807+
808+ // pendingClientRequests counts the number of requests that a Client is currently running using this HostClient.
809+ // It will be incremented earlier than pendingRequests and will be used by Client to see if the HostClient is still in use.
810+ pendingClientRequests int32
811+
812+ // NoDefaultUserAgentHeader when set to true, causes the default
813+ // User-Agent header to be excluded from the Request.
814+ NoDefaultUserAgentHeader bool
815+
816+ // Attempt to connect to both ipv4 and ipv6 host addresses
817+ // if set to true.
818+ //
819+ // This option is used only if default TCP dialer is used,
820+ // i.e. if Dial and DialTimeout are blank.
821+ //
822+ // By default client connects only to ipv4 addresses,
823+ // since unfortunately ipv6 remains broken in many networks worldwide :)
824+ DialDualStack bool
825+
826+ // Whether to use TLS (aka SSL or HTTPS) for host connections.
827+ IsTLS bool
828+
788829 // Header names are passed as-is without normalization
789830 // if this option is set.
790831 //
@@ -820,51 +861,9 @@ type HostClient struct {
820861 // Client logs full errors by default.
821862 SecureErrorLogMessage bool
822863
823- // Maximum duration for waiting for a free connection.
824- //
825- // By default will not waiting, return ErrNoFreeConns immediately
826- MaxConnWaitTimeout time.Duration
827-
828- // RetryIf controls whether a retry should be attempted after an error.
829- //
830- // By default will use isIdempotent function
831- RetryIf RetryIfFunc
832-
833- // Transport defines a transport-like mechanism that wraps every request/response.
834- Transport RoundTripper
835-
836- // Connection pool strategy. Can be either LIFO or FIFO (default).
837- ConnPoolStrategy ConnPoolStrategyType
838-
839864 // StreamResponseBody enables response body streaming.
840865 StreamResponseBody bool
841866
842- lastUseTime uint32
843-
844- connsLock sync.Mutex
845- connsCount int
846- conns []* clientConn
847- connsWait * wantConnQueue
848-
849- addrsLock sync.Mutex
850- addrs []string
851- addrIdx uint32
852-
853- tlsConfigMap map [string ]* tls.Config
854- tlsConfigMapLock sync.Mutex
855-
856- readerPool sync.Pool
857- writerPool sync.Pool
858-
859- clientReaderPool * sync.Pool
860- clientWriterPool * sync.Pool
861-
862- pendingRequests int32
863-
864- // pendingClientRequests counts the number of requests that a Client is currently running using this HostClient.
865- // It will be incremented earlier than pendingRequests and will be used by Client to see if the HostClient is still in use.
866- pendingClientRequests int32
867-
868867 connsCleanerRun bool
869868}
870869
@@ -2174,10 +2173,6 @@ type PipelineClient struct {
21742173 // PipelineClient name. Used in User-Agent request header.
21752174 Name string
21762175
2177- // NoDefaultUserAgentHeader when set to true, causes the default
2178- // User-Agent header to be excluded from the Request.
2179- NoDefaultUserAgentHeader bool
2180-
21812176 // The maximum number of concurrent connections to the Addr.
21822177 //
21832178 // A single connection is used by default.
@@ -2200,6 +2195,10 @@ type PipelineClient struct {
22002195 // Default Dial is used if not set.
22012196 Dial DialFunc
22022197
2198+ // NoDefaultUserAgentHeader when set to true, causes the default
2199+ // User-Agent header to be excluded from the Request.
2200+ NoDefaultUserAgentHeader bool
2201+
22032202 // Attempt to connect to both ipv4 and ipv6 host addresses
22042203 // if set to true.
22052204 //
@@ -2284,10 +2283,10 @@ type pipelineConnClient struct {
22842283
22852284 Addr string
22862285 Name string
2287- NoDefaultUserAgentHeader bool
22882286 MaxPendingRequests int
22892287 MaxBatchDelay time.Duration
22902288 Dial DialFunc
2289+ NoDefaultUserAgentHeader bool
22912290 DialDualStack bool
22922291 DisableHeaderNamesNormalizing bool
22932292 DisablePathNormalizing bool
0 commit comments