Support using proxy dial-up connection to GitHub.

This commit is contained in:
三千 2025-02-09 21:41:55 +08:00
parent f5c32915b9
commit c7aea91c43
8 changed files with 80 additions and 9 deletions

View file

@ -22,9 +22,9 @@ var (
BufferPool *sync.Pool
)
func InitReq() {
initChunkedHTTPClient()
initGitHTTPClient()
func InitReq(cfg *config.Config) {
initChunkedHTTPClient(cfg)
initGitHTTPClient(cfg)
// 初始化固定大小的缓存池
BufferPool = &sync.Pool{
@ -34,7 +34,7 @@ func InitReq() {
}
}
func initChunkedHTTPClient() {
func initChunkedHTTPClient(cfg *config.Config) {
ctr = &http.Transport{
MaxIdleConns: 100,
MaxConnsPerHost: 60,
@ -47,6 +47,7 @@ func initChunkedHTTPClient() {
KeepAlive: 30 * time.Second,
}).DialContext,
}
initTransport(cfg, ctr)
cclient = &http.Client{
Transport: ctr,
}