util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KtHome = fmt.Sprintf("%s/.ktctl", UserHome)
View Source
var UserHome = os.Getenv("HOME")

Functions

func CleanRsaKeys added in v0.1.0

func CleanRsaKeys()

CleanRsaKeys ...

func Contains added in v0.1.0

func Contains(obj interface{}, target interface{}) bool

Contains check whether obj exist in target, the type of target can be array, slice or map

func CreateDirIfNotExist

func CreateDirIfNotExist(dir string)

CreateDirIfNotExist create dir

func DropHosts added in v0.0.12

func DropHosts()

DropHosts ...

func DumpHosts added in v0.0.12

func DumpHosts(hostsMap map[string]string)

DumpHosts DumpToHosts

func ExtractNetMaskFromCidr added in v0.1.0

func ExtractNetMaskFromCidr(cidr string) string

ExtractNetMaskFromCidr extract net mask length (e.g. 16) from cidr (e.g. 1.2.3.4/16)

func GetDaemonRunning added in v0.1.0

func GetDaemonRunning(componentName string) string

GetDaemonRunning fetch daemon pid if exist

func GetJvmrcFilePath added in v0.1.0

func GetJvmrcFilePath(jvmrcDir string) string

GetJvmrcFilePath get jvmrc file from jvmrc dir

func GetOutboundIP

func GetOutboundIP() (address string)

GetOutboundIP Get preferred outbound ip of this machine

func GetRandomSSHPort

func GetRandomSSHPort(podIP string) string

GetRandomSSHPort get pod random ssh port

func IsLinux added in v0.1.0

func IsLinux() bool

IsLinux check runtime is windows

func IsPidFileExist added in v0.1.0

func IsPidFileExist() bool

IsPidFileExist check pid file is exist or not

func IsProcessExist added in v0.1.0

func IsProcessExist(pid int) bool

IsProcessExist check whether specified process still running

func IsWindows added in v0.0.12

func IsWindows() bool

IsWindows check runtime is windows

func KubeConfig added in v0.1.0

func KubeConfig() string

KubeConfig location of kube-config file

func PrivateKeyPath added in v0.0.12

func PrivateKeyPath(component, identifier string) string

PrivateKeyPath ...

func RandomString

func RandomString(n int) string

RandomString Generate RandomString

func String2Map added in v0.0.12

func String2Map(str string) map[string]string

String2Map Convert parameter string to real map "k1=v1,k2=v2" -> {"k1":"v1","k2","v2"}

func WritePidFile added in v0.0.12

func WritePidFile(componentName string) error

WritePidFile write pid to file

func WritePrivateKey added in v0.1.0

func WritePrivateKey(privateKeyPath string, data []byte) error

WritePrivateKey write ssh private key to privateKeyPath

Types

type SSHCredential added in v0.1.0

type SSHCredential struct {
	RemoteHost     string
	Port           string
	PrivateKeyPath string
}

SSHCredential ssh info

func NewDefaultSSHCredential added in v0.1.0

func NewDefaultSSHCredential() *SSHCredential

NewDefaultSSHCredential ...

type SSHGenerator added in v0.1.0

type SSHGenerator struct {
	PrivateKey, PublicKey []byte
	PrivateKeyPath        string
}

SSHGenerator ssh key pair generator

func Generate added in v0.1.0

func Generate(privateKeyPath string) (*SSHGenerator, error)

Generate generate SSHGenerator

func NewSSHGenerator added in v0.1.0

func NewSSHGenerator(privateKey string, publicKey string, privateKeyPath string) *SSHGenerator

NewSSHGenerator create ssh generator

Jump to

Keyboard shortcuts

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