Golang simple function to support multi-threaded HTTP downloads

Golang simple function to support multi-threaded HTTP downloads

func HttpGetReq(url string) (*http.Response, error) {
	trans := &http.Transport{
		MaxIdleConns:        100,
		MaxConnsPerHost:     100,        
		MaxIdleConnsPerHost: 100,
		DisableKeepAlives:   true,
	}

	httpClient := &http.Client{
		Timeout:   time.Second * 60,    
		Transport: trans,               
	}

    return httpClient.Get(url)
}

Comments

Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example