xssh

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilSshClient   = errors.New("ssh client is nil")
	ErrNilFileHandler = errors.New("create ssh sessionCmd failed, file handler is nil")
)

Functions

func Command

func Command(name string, arg ...string) string

func Dir

func Dir(path string) string

func Exists

func Exists(path string) bool

func FileName

func FileName(path string) string

func NewConfig

func NewConfig(isLocal bool, host string, user string, password string, port uint16) config

func SimpleConfig

func SimpleConfig(host string) config

Types

type FileInfo

type FileInfo struct {
	Name string
	Path string
}

func (*FileInfo) IsDir

func (f *FileInfo) IsDir() bool

type LocalSession

type LocalSession struct {
	// contains filtered or unexported fields
}

func (*LocalSession) Close

func (s *LocalSession) Close() error

func (*LocalSession) CombinedOutput

func (s *LocalSession) CombinedOutput(name string, arg ...string) ([]byte, error)

func (*LocalSession) Connect

func (s *LocalSession) Connect() error

func (*LocalSession) Create

func (s *LocalSession) Create(name string) error

func (*LocalSession) Exists

func (s *LocalSession) Exists(path string) (bool, error)

func (*LocalSession) IsLinux

func (s *LocalSession) IsLinux() bool

func (*LocalSession) IsLocal

func (s *LocalSession) IsLocal() bool

func (*LocalSession) Log added in v1.1.0

func (s *LocalSession) Log(body cmdLogBody)

func (*LocalSession) MakeDirAll

func (s *LocalSession) MakeDirAll(path string, perm os.FileMode) error

func (*LocalSession) Output

func (s *LocalSession) Output(name string, arg ...string) ([]byte, error)

func (*LocalSession) OutputGrep

func (s *LocalSession) OutputGrep(cmdList []struct {
	name string
	arg  []string
}) ([]byte, error)

func (*LocalSession) ReadDir

func (s *LocalSession) ReadDir(dir string) ([]FileInfo, error)

func (*LocalSession) ReadFile

func (s *LocalSession) ReadFile(fileName string) ([]byte, error)

func (*LocalSession) Remove

func (s *LocalSession) Remove(name string) error

func (*LocalSession) RemoveAll

func (s *LocalSession) RemoveAll(path string) error

func (*LocalSession) Run

func (s *LocalSession) Run(name string, arg ...string) error

func (*LocalSession) WriteString

func (s *LocalSession) WriteString(name string, data string, mode ...string) error

type RemoteSession

type RemoteSession struct {
	Client *ssh.Client
	// contains filtered or unexported fields
}

func (*RemoteSession) AddLocalHost added in v1.1.0

func (c *RemoteSession) AddLocalHost(host string)

func (*RemoteSession) Close

func (s *RemoteSession) Close() error

func (*RemoteSession) CombinedOutput

func (s *RemoteSession) CombinedOutput(name string, arg ...string) ([]byte, error)

func (*RemoteSession) Connect

func (s *RemoteSession) Connect() error

func (*RemoteSession) Create

func (s *RemoteSession) Create(name string) error

func (*RemoteSession) Exists

func (s *RemoteSession) Exists(path string) (bool, error)

func (*RemoteSession) Host added in v1.1.0

func (c *RemoteSession) Host() string

func (*RemoteSession) IsLinux

func (s *RemoteSession) IsLinux() bool

func (*RemoteSession) IsLocal

func (s *RemoteSession) IsLocal() bool

func (*RemoteSession) Log added in v1.1.0

func (s *RemoteSession) Log(body cmdLogBody)

func (*RemoteSession) MakeDirAll

func (s *RemoteSession) MakeDirAll(path string, perm os.FileMode) error

func (*RemoteSession) Output

func (s *RemoteSession) Output(name string, arg ...string) ([]byte, error)

func (*RemoteSession) OutputGrep

func (s *RemoteSession) OutputGrep(cmdList []struct {
	name string
	arg  []string
}) ([]byte, error)

func (*RemoteSession) Password added in v1.1.0

func (c *RemoteSession) Password() string

func (*RemoteSession) Port added in v1.1.0

func (c *RemoteSession) Port() uint16

func (*RemoteSession) ReadDir

func (s *RemoteSession) ReadDir(dir string) ([]FileInfo, error)

func (*RemoteSession) ReadFile

func (s *RemoteSession) ReadFile(fileName string) ([]byte, error)

func (*RemoteSession) Remove

func (s *RemoteSession) Remove(name string) error

func (*RemoteSession) RemoveAll

func (s *RemoteSession) RemoveAll(path string) error

func (*RemoteSession) Run

func (s *RemoteSession) Run(name string, arg ...string) error

func (*RemoteSession) User added in v1.1.0

func (c *RemoteSession) User() string

func (*RemoteSession) WriteString

func (s *RemoteSession) WriteString(name string, data string, mode ...string) error

type Session

type Session interface {
	// contains filtered or unexported methods
}

func NewSession

func NewSession(logFile string, config config) (Session, error)

func NewSingleSession

func NewSingleSession(logFile string, config config) (Session, error)

type SingleSession

type SingleSession struct {
	Lock *sync.Mutex
	// contains filtered or unexported fields
}

func (SingleSession) Close

func (c SingleSession) Close() error

func (SingleSession) CombinedOutput

func (c SingleSession) CombinedOutput(name string, arg ...string) ([]byte, error)

func (SingleSession) Connect

func (c SingleSession) Connect() error

func (SingleSession) Create

func (c SingleSession) Create(name string) error

func (SingleSession) Exists

func (c SingleSession) Exists(path string) (bool, error)

func (SingleSession) IsLocal

func (c SingleSession) IsLocal() bool

func (SingleSession) MakeDirAll

func (c SingleSession) MakeDirAll(path string, perm os.FileMode) error

func (SingleSession) Output

func (c SingleSession) Output(name string, arg ...string) ([]byte, error)

func (SingleSession) OutputGrep

func (c SingleSession) OutputGrep(cmdList []struct {
	name string
	arg  []string
}) ([]byte, error)

func (SingleSession) ReadDir

func (c SingleSession) ReadDir(dir string) ([]FileInfo, error)

func (SingleSession) ReadFile

func (c SingleSession) ReadFile(fileName string) ([]byte, error)

func (SingleSession) Remove

func (c SingleSession) Remove(name string) error

func (SingleSession) RemoveAll

func (c SingleSession) RemoveAll(path string) error

func (SingleSession) Run

func (c SingleSession) Run(name string, arg ...string) error

func (SingleSession) WriteString

func (c SingleSession) WriteString(name string, data string, mode ...string) error

Jump to

Keyboard shortcuts

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