util

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(bytes []byte) string

This casting *does not* copy data. Note that casting via "string(value)" *does* copy data.

func CopySSH

func CopySSH(host string, username string, key string, reader io.Reader, targetPath string, permissions *int64) error

func CreateSelfSignedX509 added in v0.1.31

func CreateSelfSignedX509(organization string, host string) ([]byte, []byte, error)

func ExecSSH

func ExecSSH(host string, username string, key string, stdin io.Reader, command ...string) (string, error)

func Exit added in v0.1.22

func Exit(code int)

func ExitOnSIGTERM added in v0.1.33

func ExitOnSIGTERM()

func Fail

func Fail(message string)

func FailOnError

func FailOnError(err error)

func Failf

func Failf(f string, args ...interface{})

func FromBase64 added in v0.1.4

func FromBase64(b64 string) ([]byte, error)

func GetFileHash

func GetFileHash(path string) (string, error)

func GetGoBin added in v0.1.31

func GetGoBin() (string, error)

func GetGoPath added in v0.1.31

func GetGoPath() (string, error)

func GetLock

func GetLock(pointer interface{}) *sync.RWMutex

func ParseX509CertPool added in v0.1.6

func ParseX509CertPool(bytes []byte) (*x509.CertPool, error)

func ParseX509Certificates added in v0.1.6

func ParseX509Certificates(bytes []byte) ([]*x509.Certificate, error)

func ReaderSize

func ReaderSize(reader io.Reader) (int64, error)

func ResetLocks

func ResetLocks()

func SanitizeFilename

func SanitizeFilename(name string) string

func SetFlagsFromEnvironment

func SetFlagsFromEnvironment(prefix string)

func SetupSignalHandler

func SetupSignalHandler() <-chan struct{}

SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1.

func SortedMapStringStringKeys

func SortedMapStringStringKeys(map_ map[string]string) []string

func StringToBytes

func StringToBytes(string_ string) (bytes []byte)

This casting *does not* copy data. Note that casting via "[]byte(value)" *does* copy data.

func Timestamp

func Timestamp(asString bool) interface{}

func ToBase64 added in v0.1.4

func ToBase64(bytes []byte) string

func WriteNewline added in v0.1.27

func WriteNewline(writer io.Writer) error

Types

type BufferedWriter added in v0.1.22

type BufferedWriter struct {
	// contains filtered or unexported fields
}

func NewBufferedWriter added in v0.1.22

func NewBufferedWriter(writer io.Writer, size int) BufferedWriter

func (BufferedWriter) Close added in v0.1.22

func (self BufferedWriter) Close() error

io.Closer interface

func (BufferedWriter) CloseOnExit added in v0.1.27

func (self BufferedWriter) CloseOnExit() ExitFunctionHandle

func (BufferedWriter) Write added in v0.1.22

func (self BufferedWriter) Write(p []byte) (int, error)

io.Writer interface

type ExitFunctionHandle added in v0.1.22

type ExitFunctionHandle uint64

func OnExit added in v0.1.22

func OnExit(exitFunction func()) ExitFunctionHandle

func (ExitFunctionHandle) Cancel added in v0.1.22

func (self ExitFunctionHandle) Cancel()

type ForceHTTPSRoundTripper added in v0.1.4

type ForceHTTPSRoundTripper struct {
	// contains filtered or unexported fields
}

func NewForceHTTPSRoundTripper added in v0.1.4

func NewForceHTTPSRoundTripper(roundTripper http.RoundTripper) *ForceHTTPSRoundTripper

func (*ForceHTTPSRoundTripper) RoundTrip added in v0.1.4

func (self *ForceHTTPSRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

http.RoundTripper interface

type SyncedWriter added in v0.1.22

type SyncedWriter struct {
	Writer io.Writer
	// contains filtered or unexported fields
}

func NewSyncedWriter added in v0.1.22

func NewSyncedWriter(writer io.Writer) *SyncedWriter

func (*SyncedWriter) Close added in v0.1.22

func (self *SyncedWriter) Close() error

io.Closer interface

func (*SyncedWriter) Write added in v0.1.22

func (self *SyncedWriter) Write(p []byte) (int, error)

io.Writer interface

type TarEncoder

type TarEncoder struct {
	// contains filtered or unexported fields
}

func NewTarEncoder

func NewTarEncoder(reader io.Reader, name string, size int64) *TarEncoder

func (*TarEncoder) Drain

func (self *TarEncoder) Drain()

func (*TarEncoder) Encode

func (self *TarEncoder) Encode() io.Reader

Jump to

Keyboard shortcuts

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