简体   繁体   中英

How do I set MaxConnsPerHost on http2 transport in GoLang

I'm trying to force GoLang to use HTTP2 and so have done the following:

transport := &http2.Transport{}
client := &http.Client{Transport: transport}

But I also need to set MaxConnsPerHost and MaxIdleConns, which I'm not able to. I know I can set them in HTTP1 as follows:

transport := &http.Transport{
    MaxIdleConns: 0,
    MaxIdleConnsPerHost: 1000,
}
httpClient := &http.Client{Transport: transport}

How can I achieve the same for HTTP2?

Answering my own question here: As Peter pointed out, this would not apply to HTTP2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM