🔨 Restructure entire project logic

- Moved readers to the config package
- Added an option to read remote config files
- Moved the validation package to the config package and removed the validator dependency
- Moved the customerrors package to the config package
- Replaced fatih/color with jedib0t/go-pretty/v6/text
- Removed proxy check functionality
- Added param, header, cookie, body, and proxy flags to the CLI
- Allowed multiple values for the same key in params, headers, and cookies
This commit is contained in:
2025-03-16 21:20:33 +04:00
parent 8f811e1bec
commit 00f0bcb2de
35 changed files with 1461 additions and 1492 deletions

View File

@ -7,7 +7,6 @@ import (
"time"
"github.com/jedib0t/go-pretty/v6/progress"
"github.com/valyala/fasthttp"
)
// streamProgress streams the progress of a task to the console using a progress bar.
@ -37,9 +36,11 @@ func streamProgress(
for {
select {
case <-ctx.Done():
if ctx.Err() != context.Canceled {
dodosTracker.MarkAsErrored()
}
fmt.Printf("\r")
dodosTracker.MarkAsErrored()
time.Sleep(time.Millisecond * 300)
time.Sleep(time.Millisecond * 500)
pw.Stop()
return
@ -48,28 +49,3 @@ func streamProgress(
}
}
}
// checkConnection checks the internet connection by making requests to different websites.
// It returns true if the connection is successful, otherwise false.
func checkConnection(ctx context.Context) bool {
ch := make(chan bool)
go func() {
_, _, err := fasthttp.Get(nil, "https://www.google.com")
if err != nil {
_, _, err = fasthttp.Get(nil, "https://www.bing.com")
if err != nil {
_, _, err = fasthttp.Get(nil, "https://www.yahoo.com")
ch <- err == nil
}
ch <- true
}
ch <- true
}()
select {
case <-ctx.Done():
return false
case res := <-ch:
return res
}
}