mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 08:11:11 +08:00
Support using proxy dial-up connection to GitHub. (#46)
This commit is contained in:
parent
09163ed4df
commit
4c5d288f03
8 changed files with 86 additions and 9 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue