-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.go
44 lines (39 loc) · 1.59 KB
/
config.go
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
35
36
37
38
39
40
41
42
43
44
package client
import (
"time"
"github.com/americanas-go/config"
)
const (
root = "ignite.http.client"
maxIdleConnPerHost = ".maxIdleConnPerHost"
maxIdleConn = ".maxIdleConn"
maxConnsPerHost = ".maxConnsPerHost"
idleConnTimeout = ".idleConnTimeout"
disableKeepAlives = ".disableKeepAlives"
disableCompression = ".disableCompression"
forceHTTP2 = ".forceHTTP2"
tlsHandshakeTimeout = ".TLSHandshakeTimeout"
timeout = ".timeout"
dialTimeout = ".dialTimeout"
keepAlive = ".keepAlive"
expectContinueTimeout = ".expectContinueTimeout"
dualStack = ".dualStack"
)
func init() {
ConfigAdd(root)
}
func ConfigAdd(path string) {
config.Add(path+maxIdleConnPerHost, 1, "http max idle connections per host")
config.Add(path+maxIdleConn, 100, "http max idle connections")
config.Add(path+maxConnsPerHost, 20, "http max connections per host")
config.Add(path+idleConnTimeout, 90*time.Second, "http idle connections timeout")
config.Add(path+disableKeepAlives, true, "http disable keep alives")
config.Add(path+disableCompression, false, "http disable keep alives")
config.Add(path+forceHTTP2, true, "http force http2")
config.Add(path+tlsHandshakeTimeout, 10*time.Second, "TLS handshake timeout")
config.Add(path+timeout, 30*time.Second, "timeout")
config.Add(path+dialTimeout, 5*time.Second, "dial timeout")
config.Add(path+keepAlive, 15*time.Second, "keep alive")
config.Add(path+expectContinueTimeout, 1*time.Second, "expect continue timeout")
config.Add(path+dualStack, true, "dual stack")
}