util

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToString

func ByteToString(orig []byte) string

func FileExist added in v1.0.3

func FileExist(path string) bool

func FindTargetDeviceID

func FindTargetDeviceID(mi *MountInfo) bool

find block device id

func HttpSendJson added in v0.1.10

func HttpSendJson(method string, url string, data string) (string, error)

func IntContains added in v1.0.4

func IntContains(s []int, e int) bool

IntContains check string array contains a int number

func IsDir

func IsDir(FilePath string) bool

func IsDirectory added in v1.0.2

func IsDirectory(path string) bool
func IsSoftLink(FilePath string) bool

func MakeDev

func MakeDev(major, minor string) int

func RandString

func RandString(n int) string

func ReadLines added in v1.0.3

func ReadLines(path string) ([]string, error)

ReadLines reads a whole file into memory and returns a slice of its lines. from https://stackoverflow.com/questions/5884154/read-text-file-into-string-array-and-write

func RemoveDuplicateElement

func RemoveDuplicateElement(addrs []string) []string

func RewriteFile

func RewriteFile(path string, content string, perm os.FileMode)

func SetBlockAccessible

func SetBlockAccessible(path string) error

set all block device accessible

func ShellExec

func ShellExec(shellPath string) error

ShellExec run shell script by bash

func StringContains added in v1.0.4

func StringContains(s []string, e string) bool

StringContains check string array contains a string

func UnixHttpSend

func UnixHttpSend(method string, unixPath string, uri string, data string) (string, error)

ref https://docs.docker.com/engine/api/v1.24/

func WriteFile

func WriteFile(path string, content string) error

func WriteFileAdd added in v1.0.1

func WriteFileAdd(path string, content string) error

func WriteShellcodeToCrontab added in v1.0.1

func WriteShellcodeToCrontab(header string, filePath string, shellcode string) error

Types

type MountInfo

type MountInfo struct {
	Device     string
	Fstype     string
	Root       string
	MountPoint string
	Opts       []string
	Marjor     string
	Minor      string
}

func GetMountInfo

func GetMountInfo() ([]MountInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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