1
0
mirror of https://github.com/fumiama/RVC-Models-Downloader.git synced 2024-09-29 14:26:25 +09:00

feat: support proxy from env (#4)

ref https://stackoverflow.com/questions/69789948/go-ignores-http-proxy-environment-variable
This commit is contained in:
源文雨 2024-07-10 18:55:26 +09:00
parent 24ed668d84
commit 4c39b7de22
3 changed files with 5 additions and 5 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module rvcmd
go 1.22.1 go 1.22.1
require ( require (
github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8 github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979
github.com/gizak/termui/v3 v3.1.0 github.com/gizak/termui/v3 v3.1.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3 github.com/sirupsen/logrus v1.9.3

4
go.sum
View File

@ -5,8 +5,8 @@ github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9o
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8 h1:mVOgOhlrF0ra8/BkwVA71ev/1HkzAgDn8gWU2UNbDU8= github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979 h1:1xSO4SvPfiw5TVeaS5ASFcl82rXH3jG8Obab0+JOC/8=
github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI= github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI=
github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc= github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc=
github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY= github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY=
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=

4
net.go
View File

@ -11,7 +11,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/fumiama/terasu/http2" trshttp "github.com/fumiama/terasu/http"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -75,7 +75,7 @@ func (c *config) download(path, prefix, ua string, waits time.Duration, usecust,
} }
var resp *http.Response var resp *http.Response
if usetrs { if usetrs {
resp, err = http2.DefaultClient.Do(req) resp, err = trshttp.DefaultClient.Do(req)
} else { } else {
resp, err = http.DefaultClient.Do(req) resp, err = http.DefaultClient.Do(req)
} }