utils

package
v0.0.0-...-a16fe4d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSignature

func CheckSignature(dst string, sign string) error

CheckSignature checks the dst and sign for local usage

func DecompressDefault

func DecompressDefault(dst string, r io.Reader) (err error)

func DecompressTarGz

func DecompressTarGz(dst string, r io.Reader) (err error)

func Download

func Download(ctx context.Context, dst string, sha256sum string, urls []string, suffix string) (err error)

Download function to download executable or gzip or remote server From Elkeid v1.9.1

Elkeid v1.9.1 enhance this function by setting a more robust http client configuration and also the reader part

var DefaultTransport RoundTripper = &Transport{
	Proxy: ProxyFromEnvironment,
	DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
	}).DialContext,
	ForceAttemptHTTP2:     true,
	MaxIdleConns:          100,
	IdleConnTimeout:       90 * time.Second,
	TLSHandshakeTimeout:   10 * time.Second,
	ExpectContinueTimeout: 1 * time.Second,
}

https://github.com/golang/go/blob/b2faff18ce28edad98303d2c3134dec1331fd7b5/src/net/http/transport.go

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL