高并发下,每隔断时间就会提示这样的错误:http2: client connection force closed via ClientConn.Close
下面是核心代码:
```
defaultTransport := http.DefaultTransport
tr := *defaultTransport.(*http.Transport)
tr.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
tr.MaxConnsPerHost = 30000
tr.MaxIdleConnsPerHost = 10000
client = &http.Client{
Transport: &tr,
Timeout: time.Duration(5) * time.Second,
}
```
有疑问加站长微信联系(非本文作者)