-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.go
More file actions
34 lines (29 loc) · 787 Bytes
/
Copy pathoptions.go
File metadata and controls
34 lines (29 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package client
import (
"net/http"
"time"
)
// Config holds the client configuration
type Config struct {
Timeout time.Duration
MaxRetries int
RetryInterval time.Duration
MaxConcurrency int
Debug bool
Transport *http.Transport
}
// Option is a function that configures the client
type Option func(*clientImpl)
// Middleware represents a function that wraps the client's transport layer
type Middleware func(http.RoundTripper) http.RoundTripper
// DefaultConfig returns a default configuration
func DefaultConfig() *Config {
return &Config{
Timeout: 30 * time.Second,
MaxRetries: 3,
RetryInterval: time.Second,
MaxConcurrency: 10,
Debug: false,
Transport: http.DefaultTransport.(*http.Transport).Clone(),
}
}