utils

package
v0.0.0-...-d63592a Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort    = 22
	DefaultUser    = "root"
	DefaultKeyFile = "~/.ssh/id_rsa"
)

default remote info

Variables

This section is empty.

Functions

func IsDir

func IsDir(name string) bool

func IsExists

func IsExists(name string) bool

func Read

func Read(file string) string

func RunCommand

func RunCommand(args string)

func ValidataIP

func ValidataIP(ip ...string) error

func ValidataURL

func ValidataURL(urlSlice ...string) error

func Write

func Write(content, dst string)

Types

type Command

type Command struct {
	Cmd   string
	Shell string
}

type RemoteOption

type RemoteOption struct {
	Host       string
	Port       string
	User       string
	KeyFile    *string
	Password   *string
	WorkDir    string
	Command    *Command
	File       *TransferFile
	Session    *ssh.Session
	SftpClient *sftp.Client
	NetDevice  string
}

func NewRemoteOption

func NewRemoteOption(host, port, user, password, key, netdevice string) (*RemoteOption, error)

NewRemoteOption return a new RemoteOption

func (*RemoteOption) Close

func (r *RemoteOption) Close()

func (*RemoteOption) CopyFileFromRemote

func (r *RemoteOption) CopyFileFromRemote() error

func (*RemoteOption) CopyFileToRmote

func (r *RemoteOption) CopyFileToRmote() error

func (*RemoteOption) RunCommand

func (r *RemoteOption) RunCommand() (string, error)

type TransferFile

type TransferFile struct {
	SrcFile string
	DstFile string
}

Jump to

Keyboard shortcuts

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