util

package
v0.0.0-...-e1f8a17 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToFloat64

func BytesToFloat64(bytes []byte) float64

BytesToFloat64 converts from little endian 8 bytes to a float64

func BytesToUint16

func BytesToUint16(b []byte) (v uint16)

BytesToUint16 converts big endian 2 bytes into uint16

func BytesToUint32

func BytesToUint32(b []byte) (v uint32)

BytesToUint32 converts big endian 4 bytes into uint32

func BytesToUint64

func BytesToUint64(b []byte) (v uint64)

BytesToUint64 converts big endian 8 bytes into uint64

func FileExists

func FileExists(filepath string) bool

FileExists checks whether the file exists

func Float64ToBytes

func Float64ToBytes(float float64) []byte

Float64ToBytes converts from a float64 to little endian 8 bytes

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns the non loopback local IP of the host

func GetUnixSocketFile

func GetUnixSocketFile(address string) (unixSocket string, fileExists bool)

GetUnixSocketFile checks vasto unix socket exists corresponding to the tcp socket.

func Hash

func Hash(key []byte) uint64

Hash calculates the hash value of the bytes

func Parallel

func Parallel(actions ...func() error) error

Parallel executes multiple actions concurrently. If error happens, one of the errors is returned.

func ReadMessage

func ReadMessage(reader io.Reader) (m []byte, err error)

ReadMessage reads out the []byte for one message

func RetryForever

func RetryForever(ctx context.Context, name string, fn func() error, waitTimes time.Duration)

RetryForever keeps retrying the fn unless the context is cancelled.

func Uint16toBytes

func Uint16toBytes(v uint16) (b []byte)

Uint16toBytes converts uint16 into big endian 2 bytes

func Uint32toBytes

func Uint32toBytes(v uint32) (b []byte)

Uint32toBytes converts uint32 into big endian 4 bytes

func Uint64toBytes

func Uint64toBytes(v uint64) (b []byte)

Uint64toBytes converts uint64 into big endian 8 bytes

func WriteMessage

func WriteMessage(writer io.Writer, m []byte) (err error)

WriteMessage writes little endian size info in 4 bytes, followed by the actual []byte.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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