17 Commits

Author SHA1 Message Date
769c04685a Merge pull request #69 from aykhans/fix/connections-bottleneck
🐛 Remove 'CloseIdleConnections' from 'Send' function
2025-01-15 21:44:02 +04:00
e43378a9a4 🔖 bump version to 0.5.6 2025-01-15 21:43:46 +04:00
e29e4f1bc6 🐛 Remove 'CloseIdleConnections' from 'Send' function 2025-01-14 20:43:45 +04:00
7d2168a014 Merge pull request #67 from aykhans/dependabot/go_modules/github.com/go-playground/validator/v10-10.24.0
Bump github.com/go-playground/validator/v10 from 10.23.0 to 10.24.0
2025-01-14 16:29:25 +04:00
ba53e6b7f7 Bump github.com/go-playground/validator/v10 from 10.23.0 to 10.24.0
Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.23.0 to 10.24.0.
- [Release notes](https://github.com/go-playground/validator/releases)
- [Commits](https://github.com/go-playground/validator/compare/v10.23.0...v10.24.0)

---
updated-dependencies:
- dependency-name: github.com/go-playground/validator/v10
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-14 00:26:46 +00:00
58964e1098 Merge pull request #66 from aykhans/dependabot/go_modules/golang.org/x/net-0.34.0
Bump golang.org/x/net from 0.33.0 to 0.34.0
2025-01-08 15:27:52 +04:00
d4bf7358ff Bump golang.org/x/net from 0.33.0 to 0.34.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.34.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-07 00:38:29 +00:00
779d5e9b18 Merge pull request #65 from aykhans/refactor/rename-cli-flags
🔨 Rename CLI flags
2025-01-03 13:27:24 +04:00
6a79d0b1d7 🔖 bump version to 0.5.502 2025-01-03 13:26:34 +04:00
1e53b8a7fb 📚 Update docs 2025-01-03 13:26:00 +04:00
0a8dbec739 🔨 Renama JSON parameters 2025-01-03 13:17:20 +04:00
3762890914 🔨 Rename CLI flags 2025-01-03 13:14:25 +04:00
ca6b3d4eb2 Merge pull request #64 from aykhans/bump/version
🔖 Bump version to 0.5.501
2024-12-25 02:08:59 +04:00
1ee06aacc3 🔖 Bump version to 0.5.501 2024-12-25 02:08:47 +04:00
3d5834a6a6 Merge pull request #63 from aykhans/fix/empty-slice
🐛 Return empty brackets instead of null when slice length is 0
2024-12-25 01:24:28 +04:00
f1521cbb74 💄 Update config table 2024-12-23 18:58:22 +04:00
40f8a1cc37 🐛 Return empty brackets instead of null when slice length is 0 2024-12-22 23:15:10 +04:00
8 changed files with 37 additions and 35 deletions

View File

@ -60,8 +60,8 @@ You can find an example config structure in the [config.json](https://github.com
"url": "https://example.com", "url": "https://example.com",
"no_proxy_check": false, "no_proxy_check": false,
"timeout": 2000, "timeout": 2000,
"dodos_count": 10, "dodos": 10,
"request_count": 1000, "requests": 1000,
"params": {}, "params": {},
"headers": {}, "headers": {},
"cookies": {}, "cookies": {},
@ -108,8 +108,8 @@ If the Headers, Params, Cookies and Body fields have multiple values, each reque
| Yes | - | --yes | -y | Boolean | Answer yes to all questions | false | | Yes | - | --yes | -y | Boolean | Answer yes to all questions | false |
| URL | url | --url | -u | String | URL to send the request to | - | | URL | url | --url | -u | String | URL to send the request to | - |
| Method | method | --method | -m | String | HTTP method | GET | | Method | method | --method | -m | String | HTTP method | GET |
| Request count | request_count | --request-count | -r | Integer | Total number of requests to send | 1000 | | Requests | requests | --requests | -r | Integer | Total number of requests to send | 1000 |
| Dodos count (Threads) | dodos_count | --dodos-count | -d | Integer | Number of dodos (threads) to send requests in parallel | 1 | | Dodos (Threads) | dodos | --dodos | -d | Integer | Number of dodos (threads) to send requests in parallel | 1 |
| Timeout | timeout | --timeout | -t | Integer | Timeout for canceling each request (milliseconds) | 10000 | | Timeout | timeout | --timeout | -t | Integer | Timeout for canceling each request (milliseconds) | 10000 |
| No Proxy Check | no_proxy_check | --no-proxy-check| - | Boolean | Disable proxy check | false | | No Proxy Check | no_proxy_check | --no-proxy-check| - | Boolean | Disable proxy check | false |
| Params | params | - | - | Key-Value {String: [String]} | Request parameters | - | | Params | params | - | - | Key-Value {String: [String]} | Request parameters | - |

View File

@ -3,8 +3,8 @@
"url": "https://example.com", "url": "https://example.com",
"no_proxy_check": false, "no_proxy_check": false,
"timeout": 10000, "timeout": 10000,
"dodos_count": 1, "dodos": 1,
"request_count": 1, "requests": 1,
"params": {}, "params": {},
"headers": {}, "headers": {},
"cookies": {}, "cookies": {},

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
VERSION string = "0.5.5" VERSION string = "0.5.6"
DefaultUserAgent string = "Dodo/" + VERSION DefaultUserAgent string = "Dodo/" + VERSION
ProxyCheckURL string = "https://www.google.com" ProxyCheckURL string = "https://www.google.com"
DefaultMethod string = "GET" DefaultMethod string = "GET"
@ -79,7 +79,7 @@ func (config *RequestConfig) Print() {
t.AppendSeparator() t.AppendSeparator()
t.AppendRow(table.Row{"Cookies", string(utils.PrettyJSONMarshal(config.Cookies, 3, "", " "))}) t.AppendRow(table.Row{"Cookies", string(utils.PrettyJSONMarshal(config.Cookies, 3, "", " "))})
t.AppendSeparator() t.AppendSeparator()
t.AppendRow(table.Row{"Proxies Count", string(utils.PrettyJSONMarshal(config.Proxies, 3, "", " "))}) t.AppendRow(table.Row{"Proxies", string(utils.PrettyJSONMarshal(config.Proxies, 3, "", " "))})
t.AppendSeparator() t.AppendSeparator()
t.AppendRow(table.Row{"Proxy Check", !config.NoProxyCheck}) t.AppendRow(table.Row{"Proxy Check", !config.NoProxyCheck})
t.AppendSeparator() t.AppendSeparator()
@ -107,8 +107,8 @@ type Config struct {
Method string `json:"method" validate:"http_method"` // custom validations: http_method Method string `json:"method" validate:"http_method"` // custom validations: http_method
URL string `json:"url" validate:"http_url,required"` URL string `json:"url" validate:"http_url,required"`
Timeout uint32 `json:"timeout" validate:"gte=1,lte=100000"` Timeout uint32 `json:"timeout" validate:"gte=1,lte=100000"`
DodosCount uint `json:"dodos_count" validate:"gte=1"` DodosCount uint `json:"dodos" validate:"gte=1"`
RequestCount uint `json:"request_count" validation_name:"request-count" validate:"gte=1"` RequestCount uint `json:"requests" validation_name:"request-count" validate:"gte=1"`
NoProxyCheck Option[bool] `json:"no_proxy_check"` NoProxyCheck Option[bool] `json:"no_proxy_check"`
} }

12
go.mod
View File

@ -3,15 +3,15 @@ module github.com/aykhans/dodo
go 1.23.2 go 1.23.2
require ( require (
github.com/go-playground/validator/v10 v10.23.0 github.com/go-playground/validator/v10 v10.24.0
github.com/jedib0t/go-pretty/v6 v6.6.5 github.com/jedib0t/go-pretty/v6 v6.6.5
github.com/valyala/fasthttp v1.58.0 github.com/valyala/fasthttp v1.58.0
golang.org/x/net v0.33.0 golang.org/x/net v0.34.0
) )
require ( require (
github.com/andybalholm/brotli v1.1.1 // indirect github.com/andybalholm/brotli v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/klauspost/compress v1.17.11 // indirect github.com/klauspost/compress v1.17.11 // indirect
@ -19,8 +19,8 @@ require (
github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/rivo/uniseg v0.4.7 // indirect github.com/rivo/uniseg v0.4.7 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect
golang.org/x/crypto v0.31.0 // indirect golang.org/x/crypto v0.32.0 // indirect
golang.org/x/sys v0.28.0 // indirect golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.27.0 // indirect golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect golang.org/x/text v0.21.0 // indirect
) )

24
go.sum
View File

@ -2,16 +2,16 @@ github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7X
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
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/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I= github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s= github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o= github.com/go-playground/validator/v10 v10.24.0 h1:KHQckvo8G6hlWnrPX4NJJ+aBfWNAE/HH+qdL2cBpCmg=
github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
github.com/jedib0t/go-pretty/v6 v6.6.5 h1:9PgMJOVBedpgYLI56jQRJYqngxYAAzfEUua+3NgSqAo= github.com/jedib0t/go-pretty/v6 v6.6.5 h1:9PgMJOVBedpgYLI56jQRJYqngxYAAzfEUua+3NgSqAo=
github.com/jedib0t/go-pretty/v6 v6.6.5/go.mod h1:Uq/HrbhuFty5WSVNfjpQQe47x16RwVGXIveNGEyGtHs= github.com/jedib0t/go-pretty/v6 v6.6.5/go.mod h1:Uq/HrbhuFty5WSVNfjpQQe47x16RwVGXIveNGEyGtHs=
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
@ -33,14 +33,14 @@ github.com/valyala/fasthttp v1.58.0 h1:GGB2dWxSbEprU9j0iMJHgdKYJVDyjrOwF9RE59PbR
github.com/valyala/fasthttp v1.58.0/go.mod h1:SYXvHHaFp7QZHGKSHmoMipInhrI5StHrhDTYVEjK/Kw= github.com/valyala/fasthttp v1.58.0/go.mod h1:SYXvHHaFp7QZHGKSHmoMipInhrI5StHrhDTYVEjK/Kw=
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@ -28,9 +28,9 @@ Flags:
-h, --help help for dodo -h, --help help for dodo
-v, --version version for dodo -v, --version version for dodo
-c, --config-file string Path to the config file -c, --config-file string Path to the config file
-d, --dodos-count uint Number of dodos(threads) (default %d) -d, --dodos uint Number of dodos(threads) (default %d)
-m, --method string HTTP Method (default %s) -m, --method string HTTP Method (default %s)
-r, --request-count uint Number of total requests (default %d) -r, --request uint Number of total requests (default %d)
-t, --timeout uint32 Timeout for each request in milliseconds (default %d) -t, --timeout uint32 Timeout for each request in milliseconds (default %d)
-u, --url string URL for stress testing -u, --url string URL for stress testing
--no-proxy-check bool Do not check for proxies (default false) --no-proxy-check bool Do not check for proxies (default false)
@ -74,10 +74,10 @@ func CLIConfigReader() (*config.CLIConfig, error) {
flag.StringVar(&url, "url", "", "URL to send the request") flag.StringVar(&url, "url", "", "URL to send the request")
flag.StringVar(&url, "u", "", "URL to send the request") flag.StringVar(&url, "u", "", "URL to send the request")
flag.UintVar(&dodosCount, "dodos-count", 0, "Number of dodos(threads)") flag.UintVar(&dodosCount, "dodos", 0, "Number of dodos(threads)")
flag.UintVar(&dodosCount, "d", 0, "Number of dodos(threads)") flag.UintVar(&dodosCount, "d", 0, "Number of dodos(threads)")
flag.UintVar(&requestsCount, "requests-count", 0, "Number of total requests") flag.UintVar(&requestsCount, "requests", 0, "Number of total requests")
flag.UintVar(&requestsCount, "r", 0, "Number of total requests") flag.UintVar(&requestsCount, "r", 0, "Number of total requests")
flag.UintVar(&timeout, "timeout", 0, "Timeout for each request in milliseconds") flag.UintVar(&timeout, "timeout", 0, "Timeout for each request in milliseconds")
@ -107,9 +107,9 @@ func CLIConfigReader() (*config.CLIConfig, error) {
cliConfig.Method = method cliConfig.Method = method
case "url", "u": case "url", "u":
cliConfig.URL = url cliConfig.URL = url
case "dodos-count", "d": case "dodos", "d":
cliConfig.DodosCount = dodosCount cliConfig.DodosCount = dodosCount
case "requests-count", "r": case "requests", "r":
cliConfig.RequestCount = requestsCount cliConfig.RequestCount = requestsCount
case "timeout", "t": case "timeout", "t":
var maxUint32 uint = 4294967295 var maxUint32 uint = 4294967295

View File

@ -26,7 +26,6 @@ type Request struct {
func (r *Request) Send(ctx context.Context, timeout time.Duration) (*fasthttp.Response, error) { func (r *Request) Send(ctx context.Context, timeout time.Duration) (*fasthttp.Response, error) {
client := r.getClient() client := r.getClient()
request := r.getRequest() request := r.getRequest()
defer client.CloseIdleConnections()
defer fasthttp.ReleaseRequest(request) defer fasthttp.ReleaseRequest(request)
response := fasthttp.AcquireResponse() response := fasthttp.AcquireResponse()

View File

@ -17,6 +17,9 @@ func (t TruncatedMarshaller) MarshalJSON() ([]byte, error) {
if val.Kind() != reflect.Slice && val.Kind() != reflect.Array { if val.Kind() != reflect.Slice && val.Kind() != reflect.Array {
return json.Marshal(t.Value) return json.Marshal(t.Value)
} }
if val.Len() == 0 {
return []byte("[]"), nil
}
length := val.Len() length := val.Len()
if length <= t.MaxItems { if length <= t.MaxItems {