util

package
v0.0.13-rc11-z5nctl3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirIfNotExist

func CreateDirIfNotExist(dir string)

CreateDirIfNotExist create dir

func DropHosts

func DropHosts(hostsMap map[string]string)

DropHosts ...

func DumpHosts

func DumpHosts(hostsMap map[string]string)

DumpHosts DumpToHosts

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 HomeDir

func HomeDir() string

HomeDir Current User home dir

func Interrupt

func Interrupt() chan bool

Interrupt ...

func IsDaemonRunning

func IsDaemonRunning(pidFile string) bool

IsDaemonRunning check daemon is running or not

func IsWindows

func IsWindows() bool

IsWindows check runtime is windows

func PrivateKeyPath

func PrivateKeyPath(component, identifier string) string

PrivateKeyPath ...

func RandomString

func RandomString(n int) string

RandomString Generate RandomString

func StopBackendProcess

func StopBackendProcess(stop bool, cancel func())

StopBackendProcess ...

func String2Map

func String2Map(str string) map[string]string

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

func WritePidFile

func WritePidFile(pidFile string) (pid int, err error)

WritePidFile write pid to file

func WritePrivateKey

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

WritePrivateKey write ssh private key to privateKeyPath

Types

type SSHCredential

type SSHCredential struct {
	RemoteHost     string
	Port           string
	PrivateKeyPath string
}

SSHCredential ssh info

func NewDefaultSSHCredential

func NewDefaultSSHCredential() *SSHCredential

NewDefaultSSHCredential ...

type SSHGenerator

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

SSHGenerator ssh key pair generator

func Generate

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

Generate generate SSHGenerator

func NewSSHGenerator

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