test: h2client custom dialer for testing
All checks were successful
CI / build (push) Successful in 59s
All checks were successful
CI / build (push) Successful in 59s
This commit is contained in:
parent
273067973f
commit
b9f02ddbea
1 changed files with 11 additions and 12 deletions
23
main.go
23
main.go
|
@ -40,8 +40,7 @@ var h3client = &http.Client{
|
|||
}
|
||||
|
||||
var dialer = &net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
Timeout: 30 * time.Second,
|
||||
}
|
||||
|
||||
var proxy string
|
||||
|
@ -49,19 +48,19 @@ var proxy string
|
|||
// http/2 client
|
||||
var h2client = &http.Client{
|
||||
Transport: &http.Transport{
|
||||
Dial: func(network, addr string) (net.Conn, error) {
|
||||
var net string
|
||||
if ipv6_only {
|
||||
net = "tcp6"
|
||||
} else {
|
||||
net = "tcp4"
|
||||
}
|
||||
return dialer.Dial(net, addr)
|
||||
},
|
||||
// Dial: func(network, addr string) (net.Conn, error) {
|
||||
// var net string
|
||||
// if ipv6_only {
|
||||
// net = "tcp6"
|
||||
// } else {
|
||||
// net = "tcp4"
|
||||
// }
|
||||
// return dialer.Dial(net, addr)
|
||||
// },
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ResponseHeaderTimeout: 20 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
IdleConnTimeout: 30 * time.Second,
|
||||
IdleConnTimeout: 20 * time.Second,
|
||||
ReadBufferSize: 16 * 1024,
|
||||
ForceAttemptHTTP2: true,
|
||||
MaxConnsPerHost: 0,
|
||||
|
|
Loading…
Add table
Reference in a new issue