utils

package
v0.0.0-...-1791fcb Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHARNUMBER    = "0123456789"
	CHARCHARACTER = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
)

Variables

This section is empty.

Functions

func BASE64DecodeString

func BASE64DecodeString(str string) string

BASE64DecodeString base64 decode string

func BASE64EncodeString

func BASE64EncodeString(str string) string

BASE64EncodeString base64 encode string

func Exists

func Exists(name string) (bool, error)

func HMACSHA256

func HMACSHA256(plain string, key string) string

HMACSHA256 Hmac

func MD5

func MD5(str string) string

MD5 MD5

func MapToStruct

func MapToStruct(_map map[string]interface{}, obj interface{})

MapToStruct

func ParseFloat64

func ParseFloat64(i interface{}) (val float64)

ParseFloat64

func ParseInt

func ParseInt(i interface{}) (val int)

ParseInt

func ParseInt64

func ParseInt64(i interface{}) (val int64)

ParseInt64

func ParseString

func ParseString(i interface{}) string

ParseString

func RandomString

func RandomString(chars string, length int) string

RandomString

func Round

func Round(f float64, n int) float64

Round float

func SCPFile

func SCPFile(conf SSHConfig, srcFile string, destFile string) error

func SCPFileFromRemote

func SCPFileFromRemote(conf SSHConfig, srcFile string, destFile string) error

func SHA1

func SHA1(str string) string

SHA1 SHA1

func SHA256

func SHA256(str string) string

SHA256 SHA256

func SSHRun

func SSHRun(conf SSHConfig, shell string) (string, error)

func StructToMap

func StructToMap(obj interface{}) map[string]interface{}

StructToMap

func TimeHex

func TimeHex(time time.Time) (hex string)

TimeHex ...

func TimeHexNano

func TimeHexNano(time int64) (hex string)

TimeHexNano ...

func UUIDNewV4

func UUIDNewV4() uuid.UUID

UUIDNewV4

func UnGzip

func UnGzip(data []byte) (result []byte, err error)

UnGzip ...

Types

type SSHClient

type SSHClient struct {
	Result string
	// contains filtered or unexported fields
}

func NewSSH

func NewSSH(conf SSHConfig) *SSHClient

func (*SSHClient) Run

func (s *SSHClient) Run(shell string) (string, error)

func (*SSHClient) RunTerminal

func (s *SSHClient) RunTerminal(shell string, stdout, stderr io.Writer) error

type SSHConfig

type SSHConfig struct {
	IP             string
	Port           uint64
	UserName       string
	Password       string
	PrivateKeyPath string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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