-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_config.go
34 lines (30 loc) · 912 Bytes
/
api_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import "net/http"
// RequestParams for http request
type RequestParams struct {
URL string `json:"url"`
Method string `json:"method"`
Header map[string]string `json:"header"`
Body interface{} `json:"body"`
jsonBody string
request *http.Request
}
// APIConfig which stores the api configuration
type APIConfig struct {
concurrentConnections int
duration int
timeOut int
finalStatus chan *APIStatus
interrupt int32
params []*RequestParams
}
func newAPIConfig(goroutines, duration, timeOut int, finalStatusChan chan *APIStatus, params []*RequestParams) *APIConfig {
a := &APIConfig{
concurrentConnections: goroutines,
duration: duration,
timeOut: timeOut,
finalStatus: finalStatusChan,
params: params,
}
return a
}