Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zan8in committed Sep 6, 2023
1 parent b137d56 commit 1adcadb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ require (
github.com/spaolacci/murmur3 v1.1.0
github.com/zan8in/goflags v0.0.0-20230204144650-0745934af58a
github.com/zan8in/gologger v0.0.0-20220917062627-c34a83c0a373
github.com/zan8in/libra v0.0.0-20230316023833-e1253ee1db7a
github.com/zan8in/libra v0.0.0-20230906060448-63210cf333fb
github.com/zan8in/pins v0.0.0-20230415064757-40257618b466
github.com/zan8in/retryablehttp v0.0.0-20230417060358-283ce50692bb
github.com/zan8in/retryablehttp v0.0.0-20230424151727-99fdd3c661d7
github.com/zan8in/stringsutil v0.0.0-20220917064022-03a0bd835142
)

Expand All @@ -29,7 +29,7 @@ require (
github.com/google/cel-go v0.13.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/microcosm-cc/bluemonday v1.0.22 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -43,7 +43,6 @@ require (
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/protobuf v1.29.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
11 changes: 4 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 h1:ox2F0PSMlrAAiAdknSRMDrAr8mfxPCfSZolH+/qQnyQ=
github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08/go.mod h1:pCxVEbcm3AMg7ejXyorUXi6HQCzOIBf7zEDVPtw0/U4=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -39,7 +38,6 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/microcosm-cc/bluemonday v1.0.22 h1:p2tT7RNzRdCi0qmwxG+HbqD6ILkmwter1ZwVZn1oTxA=
Expand Down Expand Up @@ -77,12 +75,12 @@ github.com/zan8in/goflags v0.0.0-20230204144650-0745934af58a h1:kgpEfiv4FDkAthNB
github.com/zan8in/goflags v0.0.0-20230204144650-0745934af58a/go.mod h1:SU2BjeuADHecx3khPTkSgkYMvd89YFJnu8YhFDGRIdM=
github.com/zan8in/gologger v0.0.0-20220917062627-c34a83c0a373 h1:T2YD/hp647jDauupyJqrwMdFSKkLbVeOylYA1ViNrg0=
github.com/zan8in/gologger v0.0.0-20220917062627-c34a83c0a373/go.mod h1:z3Zn3+DLpcfFKNqhAdYECiFeFK+o1EW3Gh0DEhFZ+v4=
github.com/zan8in/libra v0.0.0-20230316023833-e1253ee1db7a h1:5OvrLfaLQ7LLb3ShHJj7avWaD+pqcMQ/L0F5yqelgbU=
github.com/zan8in/libra v0.0.0-20230316023833-e1253ee1db7a/go.mod h1:QkWQlxgv6e8OS8kmLsdOfLp80nthABrCiclOo6G3SPA=
github.com/zan8in/libra v0.0.0-20230906060448-63210cf333fb h1:TKBVdK5ZBXCL/SzBQRfEacjQbWzOOKKKTVaB7qgZ5Po=
github.com/zan8in/libra v0.0.0-20230906060448-63210cf333fb/go.mod h1:3UAKs4kqIuLhRlSU6Ad3V1Bhjf/4Frs7DPV+r02vtj0=
github.com/zan8in/pins v0.0.0-20230415064757-40257618b466 h1:3FGXsUq3s+y8D4XJY8xwWHsBSxuDs9bOqaSUokZ2wW0=
github.com/zan8in/pins v0.0.0-20230415064757-40257618b466/go.mod h1:hwq0CUJ14mXaWUCNaD2WXj7aKwUJfuOP0fIt9mpy6i0=
github.com/zan8in/retryablehttp v0.0.0-20230417060358-283ce50692bb h1:4gB+aadPpGZaU8oVkE1hQVbz+NLw+G3JnFpVmDm3Vfc=
github.com/zan8in/retryablehttp v0.0.0-20230417060358-283ce50692bb/go.mod h1:KPJ+327tfi0jnoLfzQL8nbBcO/BGP+sUU1inh4GrmDA=
github.com/zan8in/retryablehttp v0.0.0-20230424151727-99fdd3c661d7 h1:hso8sYwVmhfP+c1WWxwGV53vveVHlJyNNDpWrdprAHs=
github.com/zan8in/retryablehttp v0.0.0-20230424151727-99fdd3c661d7/go.mod h1:KPJ+327tfi0jnoLfzQL8nbBcO/BGP+sUU1inh4GrmDA=
github.com/zan8in/stringsutil v0.0.0-20220917064022-03a0bd835142 h1:VuFo0cT3pSP9TNFq868KdZy3+53so9JOl4mgx+Km5G4=
github.com/zan8in/stringsutil v0.0.0-20220917064022-03a0bd835142/go.mod h1:EOSzFnNEZ09g1cG0Rlbi3F5JPsbRx2C2cbog+cLnWoc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down Expand Up @@ -129,7 +127,6 @@ google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX
google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
Expand Down
7 changes: 6 additions & 1 deletion pkg/http/retryhttpclient/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package retryhttpclient

import (
"context"
"io"
"net/http"
"net/http/httptrace"
Expand All @@ -16,6 +17,7 @@ import (

var (
RedirectClient *retryablehttp.Client
defaultTimeout = 12 * time.Second
)

const maxDefaultBody = 2 * 1024 * 1024
Expand Down Expand Up @@ -48,7 +50,10 @@ func Get(target string) (result.HostResult, error) {
result result.HostResult
)

req, err := retryablehttp.NewRequest(http.MethodGet, target, nil)
ctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)
defer cancel()

req, err := retryablehttp.NewRequestWithContext(ctx, http.MethodGet, target, nil)
if err != nil {
return result, err
}
Expand Down

0 comments on commit 1adcadb

Please sign in to comment.