diff options
| author | huker667 <huker@tuta.io> | 2026-08-11 18:58:45 +0300 |
|---|---|---|
| committer | huker667 <huker@tuta.io> | 2026-08-11 18:58:45 +0300 |
| commit | d6ebd95cbdbd98b959e52122f2924621b510d291 (patch) | |
| tree | a8a176a2c7186d2a99b2c214a2f6a4aa9af95c0c /helpers/helpers.go | |
| parent | 22359129afeef78e0fcd56e62586819c06950846 (diff) | |
| download | qulay-main.tar.gz qulay-main.tar.bz2 qulay-main.zip | |
Diffstat (limited to 'helpers/helpers.go')
| -rw-r--r-- | helpers/helpers.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/helpers/helpers.go b/helpers/helpers.go index 2b4763a..780dbf2 100644 --- a/helpers/helpers.go +++ b/helpers/helpers.go @@ -2,6 +2,8 @@ package helpers import ( "fmt" + "net" + "net/http" "strings" "path/filepath" "math/rand" @@ -25,6 +27,18 @@ func Ask(str string) bool { return true } +func HTTPClient() *http.Client { + transport := &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: 10 * time.Second, + }).DialContext, + TLSHandshakeTimeout: 10 * time.Second, + } + return &http.Client{ + Transport: transport, + } +} + func ToString(v interface{}) string { switch val := v.(type) { case int: @@ -67,6 +81,9 @@ func CopyDir(src, dst string) error { if err != nil { return err } + if err := os.RemoveAll(target); err != nil { + return err + } return os.Symlink(link, target) case info.IsDir(): |