Documentation ¶
Index ¶
- Constants
- Variables
- func VerifyHost(host string, remote net.Addr, key ssh.PublicKey) error
- type DockerCli
- func (s *DockerCli) AddOption(format string, args ...interface{}) *DockerCli
- func (cli *DockerCli) ContainerExec(containerId, command string) *DockerCli
- func (cli *DockerCli) ContainerLogs(containerId string) *DockerCli
- func (cli *DockerCli) CopyFromContainer(containerId, srcPath, destPath string) *DockerCli
- func (cli *DockerCli) CopyIntoContainer(srcPath, containerId, destPath string) *DockerCli
- func (cli *DockerCli) CreateContainer(image, command string) *DockerCli
- func (cli *DockerCli) DockerInfo() *DockerCli
- func (cli *DockerCli) Execute(options ExecOptions) (string, error)
- func (cli *DockerCli) InspectContainer(containerId string) *DockerCli
- func (cli *DockerCli) ListContainers() *DockerCli
- func (cli *DockerCli) PullImage(image string) *DockerCli
- func (cli *DockerCli) RemoveContainer(containerId ...string) *DockerCli
- func (cli *DockerCli) RestartContainer(containerId ...string) *DockerCli
- func (cli *DockerCli) StartContainer(containerId ...string) *DockerCli
- func (cli *DockerCli) StopContainer(containerId ...string) *DockerCli
- func (cli *DockerCli) WaitContainer(containerId ...string) *DockerCli
- type ExecOptions
- type FileManager
- type Module
- type SSHClient
- type SSHConfig
- type Shell
- func (s *Shell) AddOption(format string, args ...interface{}) *Shell
- func (s *Shell) BashScript(scriptPath string, args ...string) *Shell
- func (s *Shell) BlkId(device string) *Shell
- func (s *Shell) Cat(files ...string) *Shell
- func (s *Shell) Chmod(mode, file string) *Shell
- func (s *Shell) Command(command string) *Shell
- func (s *Shell) Copy(source, dest string) *Shell
- func (s *Shell) Curl(url string) *Shell
- func (s *Shell) Date(format string) *Shell
- func (s *Shell) DiskFree(file ...string) *Shell
- func (s *Shell) Dpkg() *Shell
- func (s *Shell) Execute(options ExecOptions) (string, error)
- func (s *Shell) Fuser(name ...string) *Shell
- func (s *Shell) List(files ...string) *Shell
- func (s *Shell) LsBlk(device ...string) *Shell
- func (s *Shell) Mkdir(directory ...string) *Shell
- func (s *Shell) Mkfs(device string) *Shell
- func (s *Shell) ModInfo(modulename string) *Shell
- func (s *Shell) ModProbe(modulename string, args ...string) *Shell
- func (s *Shell) Mount(source, directory string) *Shell
- func (s *Shell) Ping(destination string) *Shell
- func (s *Shell) Remove(file ...string) *Shell
- func (s *Shell) Rename(source, dest string) *Shell
- func (s *Shell) Rmdir(directory ...string) *Shell
- func (s *Shell) Rpm() *Shell
- func (s *Shell) Scp(source, user, host, target string) *Shell
- func (s *Shell) Sed(file ...string) *Shell
- func (s *Shell) SocketStatistics(filter string) *Shell
- func (s *Shell) Stat(files ...string) *Shell
- func (s *Shell) String() (string, error)
- func (s *Shell) Tar(file string) *Shell
- func (s *Shell) Tune2FS(device string) *Shell
- func (s *Shell) Umount(directory string) *Shell
- func (s *Shell) UnixName() *Shell
- func (s *Shell) Whoami() *Shell
- type TimeoutError
Constants ¶
View Source
const ( TEMPLATE_DOCKER_INFO = "{{.engine}} info" TEMPLATE_PULL_IMAGE = "{{.engine}} pull {{.options}} {{.name}}" TEMPLATE_CREATE_CONTAINER = "{{.engine}} create {{.options}} {{.image}} {{.command}}" TEMPLATE_START_CONTAINER = "{{.engine}} start {{.options}} {{.containers}}" TEMPLATE_STOP_CONTAINER = "{{.engine}} stop {{.options}} {{.containers}}" TEMPLATE_RESTART_CONTAINER = "{{.engine}} restart {{.options}} {{.containers}}" TEMPLATE_WAIT_CONTAINER = "{{.engine}} wait {{.options}} {{.containers}}" TEMPLATE_REMOVE_CONTAINER = "{{.engine}} rm {{.options}} {{.containers}}" TEMPLATE_LIST_CONTAINERS = "{{.engine}} ps {{.options}}" TEMPLATE_CONTAINER_EXEC = "{{.engine}} exec {{.options}} {{.container}} {{.command}}" TEMPLATE_COPY_FROM_CONTAINER = "{{.engine}} cp {{.options}} {{.container}}:{{.srcPath}} {{.destPath}}" TEMPLATE_COPY_INTO_CONTAINER = "{{.engine}} cp {{.options}} {{.srcPath}} {{.container}}:{{.destPath}}" TEMPLATE_INSPECT_CONTAINER = "{{.engine}} inspect {{.options}} {{.container}}" TEMPLATE_CONTAINER_LOGS = "{{.engine}} logs {{.options}} {{.container}}" TEMPLATE_UPDATE_CONTAINER = "{{.engine}} update {{.options}} {{.container}}" )
View Source
const ( // text TEMPLATE_SED = "sed {{.options}} {{.files}}" // storage (filesystem/block) TEMPLATE_LIST = "ls {{.options}} {{.files}}" TEMPLATE_MKDIR = "mkdir {{.options}} {{.directorys}}" TEMPLATE_RMDIR = "rmdir {{.options}} {{.directorys}}" TEMPLATE_REMOVE = "rm {{.options}} {{.files}}" TEMPLATE_RENAME = "mv {{.options}} {{.source}} {{.dest}}" TEMPLATE_COPY = "cp {{.options}} {{.source}} {{.dest}}" TEMPLATE_CHMOD = "chmod {{.options}} {{.mode}} {{.file}}" TEMPLATE_STAT = "stat {{.options}} {{.files}}" TEMPLATE_CAT = "cat {{.options}} {{.files}}" TEMPLATE_MKFS = "mkfs.ext4 {{.options}} {{.device}}" TEMPLATE_MOUNT = "mount {{.options}} {{.source}} {{.directory}}" TEMPLATE_UMOUNT = "umount {{.options}} {{.directory}}" TEMPLATE_TUNE2FS = "tune2fs {{.options}} {{.device}}" TEMPLATE_FUSER = "fuser {{.options}} {{.names}}" TEMPLATE_DISKFREE = "df {{.options}} {{.files}}" TEMPLATE_LSBLK = "lsblk {{.options}} {{.devices}}" TEMPLATE_BLKID = "blkid {{.options}} {{.device}}" // network TEMPLATE_SS = "ss {{.options}} '{{.filter}}'" TEMPLATE_PING = "ping {{.options}} {{.destination}}" TEMPLATE_CURL = "curl {{.options}} {{.url}}" // kernel TEMPLATE_WHOAMI = "whoami" TEMPLATE_DATE = "date {{.options}} {{.format}}" TEMPLATE_UNAME = "uname {{.options}}" TEMPLATE_MODPROBE = "modprobe {{.options}} {{.modulename}} {{.arguments}}" TEMPLATE_MODINFO = "modinfo {{.modulename}}" // others TEMPLATE_TAR = "tar {{.options}} {{.file}}" TEMPLATE_DPKG = "dpkg {{.options}}" TEMPLATE_RPM = "rpm {{.options}}" TEMPLATE_SCP = "scp {{.options}} {{.source}} {{.user}}@{{.host}}:{{.target}}" // bash TEMPLATE_COMMAND = "{{.command}}" TEMPLATE_BASH_SCEIPT = "bash {{.scriptPath}} {{.arguments}}" )
View Source
const (
TEMP_DIR = "/tmp"
)
Variables ¶
View Source
var (
ERR_UNREACHED = errors.New("remote unreached")
)
Functions ¶
Types ¶
type DockerCli ¶
type DockerCli struct {
// contains filtered or unexported fields
}
func NewDockerCli ¶
func (*DockerCli) ContainerExec ¶
func (*DockerCli) ContainerLogs ¶ added in v0.1.0
func (*DockerCli) CopyFromContainer ¶
func (*DockerCli) CopyIntoContainer ¶
func (*DockerCli) CreateContainer ¶
func (*DockerCli) DockerInfo ¶ added in v0.1.0
func (*DockerCli) InspectContainer ¶
func (*DockerCli) ListContainers ¶
func (*DockerCli) RemoveContainer ¶
func (*DockerCli) RestartContainer ¶
func (*DockerCli) StartContainer ¶
func (*DockerCli) StopContainer ¶
func (*DockerCli) WaitContainer ¶
type ExecOptions ¶ added in v0.1.0
type FileManager ¶
type FileManager struct {
// contains filtered or unexported fields
}
func NewFileManager ¶
func NewFileManager(sshClient *SSHClient) *FileManager
func (*FileManager) Download ¶
func (f *FileManager) Download(remotePath, localPath string) error
func (*FileManager) Install ¶
func (f *FileManager) Install(content, destPath string) error
func (*FileManager) Upload ¶
func (f *FileManager) Upload(localPath, remotePath string) error
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func (*Module) File ¶
func (m *Module) File() *FileManager
type SSHClient ¶ added in v0.1.0
type SSHClient struct {
// contains filtered or unexported fields
}
func NewSSHClient ¶ added in v0.1.0
type Shell ¶
type Shell struct {
// contains filtered or unexported fields
}
TODO(P1): support command pipe
func (*Shell) BashScript ¶ added in v0.1.0
func (*Shell) SocketStatistics ¶ added in v0.1.0
network
type TimeoutError ¶ added in v0.1.0
type TimeoutError struct {
// contains filtered or unexported fields
}
func (*TimeoutError) Error ¶ added in v0.1.0
func (e *TimeoutError) Error() string
Click to show internal directories.
Click to hide internal directories.