Documentation ¶
Index ¶
- func IsValidMethod(method string) bool
- type Job
- type JobResult
- type RateLimit
- type Requester
- func (r *Requester) DecrementRequests(auth bool)
- func (r *Requester) DoRequest(req *http.Request, path string, body io.Reader, result interface{}, ...) error
- func (r *Requester) GetNonce(isNano bool) nonce.Value
- func (r *Requester) GetNonceMilli() nonce.Value
- func (r *Requester) GetRateLimit(auth bool) *RateLimit
- func (r *Requester) IncrementRequests(auth bool)
- func (r *Requester) IsRateLimited(auth bool) bool
- func (r *Requester) IsValidCycle(auth bool) bool
- func (r *Requester) RequiresRateLimiter() bool
- func (r *Requester) SendPayload(method, path string, headers map[string]string, body io.Reader, ...) error
- func (r *Requester) SetProxy(p *url.URL) error
- func (r *Requester) SetRateLimit(auth bool, duration time.Duration, rate int)
- func (r *Requester) SetTimeoutRetryAttempts(n int) error
- func (r *Requester) StartCycle()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidMethod ¶
IsValidMethod returns whether the supplied method is supported
Types ¶
type Job ¶
type Job struct { Request *http.Request Method string Path string Headers map[string]string Body io.Reader Result interface{} JobResult chan *JobResult AuthRequest bool Verbose bool HTTPDebugging bool Record bool }
Job holds a request job
type JobResult ¶
type JobResult struct { Error error Result interface{} }
JobResult holds a request job result
type RateLimit ¶
RateLimit struct
func NewRateLimit ¶
NewRateLimit creates a new RateLimit
func (*RateLimit) GetDuration ¶
GetDuration gets the duration for the ratelimit
func (*RateLimit) GetRequests ¶
GetRequests returns the number of requests for the ratelimit
func (*RateLimit) SetDuration ¶
SetDuration sets the duration for the ratelimit
func (*RateLimit) SetRequests ¶
SetRequests sets requests counter for the rateliit
type Requester ¶
type Requester struct { HTTPClient *http.Client UnauthLimit *RateLimit AuthLimit *RateLimit Name string UserAgent string Cycle time.Time Jobs chan Job WorkerStarted bool Nonce nonce.Nonce // contains filtered or unexported fields }
Requester struct for the request client
func (*Requester) DecrementRequests ¶
DecrementRequests decrements the ratelimiter request counter for either auth or unauth requests
func (*Requester) DoRequest ¶
func (r *Requester) DoRequest(req *http.Request, path string, body io.Reader, result interface{}, authRequest, verbose, httpDebug, httpRecord bool) error
DoRequest performs a HTTP/HTTPS request with the supplied params
func (*Requester) GetNonce ¶
GetNonce returns a nonce for requests. This locks and enforces concurrent nonce FIFO on the buffered job channel
func (*Requester) GetNonceMilli ¶
GetNonceMilli returns a nonce for requests. This locks and enforces concurrent nonce FIFO on the buffered job channel this is for millisecond
func (*Requester) GetRateLimit ¶
GetRateLimit gets the request Requester ratelimiter
func (*Requester) IncrementRequests ¶
IncrementRequests increments the ratelimiter request counter for either auth or unauth requests
func (*Requester) IsRateLimited ¶
IsRateLimited returns whether or not the request Requester is rate limited
func (*Requester) IsValidCycle ¶
IsValidCycle checks to see whether the current request cycle is valid or not
func (*Requester) RequiresRateLimiter ¶
RequiresRateLimiter returns whether or not the request Requester requires a rate limiter
func (*Requester) SendPayload ¶
func (r *Requester) SendPayload(method, path string, headers map[string]string, body io.Reader, result interface{}, authRequest, nonceEnabled, verbose, httpDebugging, record bool) error
SendPayload handles sending HTTP/HTTPS requests
func (*Requester) SetRateLimit ¶
SetRateLimit sets the request Requester ratelimiter
func (*Requester) SetTimeoutRetryAttempts ¶
SetTimeoutRetryAttempts sets the amount of times the job will be retried if it times out
func (*Requester) StartCycle ¶
func (r *Requester) StartCycle()
StartCycle restarts the cycle time and requests counters