update
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package httpc
|
||||
|
||||
import (
|
||||
"golang.org/x/time/rate"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
@@ -12,6 +13,8 @@ type (
|
||||
transport *http.Transport
|
||||
redirectFn func(req *http.Request, via []*http.Request) error
|
||||
noCheckStatus bool
|
||||
qps int
|
||||
qpsLimiter *rate.Limiter
|
||||
}
|
||||
|
||||
ConfigOpt func(c *Config)
|
||||
@@ -54,3 +57,15 @@ func WithNoCheckStatus(v bool) ConfigOpt {
|
||||
c.noCheckStatus = v
|
||||
}
|
||||
}
|
||||
|
||||
func WithQps(v int) ConfigOpt {
|
||||
return func(c *Config) {
|
||||
c.qps = v
|
||||
}
|
||||
}
|
||||
|
||||
func WithQpsLimiter(v *rate.Limiter) ConfigOpt {
|
||||
return func(c *Config) {
|
||||
c.qpsLimiter = v
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user