Documentation
¶
Index ¶
- Constants
- func AppendRunLog(host Host, rec RunLogRecord) error
- func BuildRemoteCommand(command string, env map[string]string) (string, error)
- func BuildRemoteCommandWithCWD(command string, env map[string]string, cwd string) (string, error)
- func ErrorString(err error) string
- func ExecuteRemote(host Host, command string, opts RunOptions) ([]byte, error)
- func HostGroupName(host Host) string
- func HostLogName(host Host) string
- func JoinRemotePath(base, elem string) string
- func LoadRunEnv(file string, inline []string) (map[string]string, error)
- func LocalDirPath(remotePath, localPath string) string
- func LocalFilePath(remotePath, localPath string) string
- func LoginRemote(host Host) error
- func LoginRemoteWithOptions(host Host, opts LoginOptions) error
- func NewRemoteScriptPath(value time.Time) string
- func NewRemoteScriptPathInDir(value time.Time, dir string) string
- func Now() time.Time
- func ParseTimeout(value string) (time.Duration, error)
- func ReadRunLogs(target, match string, tail int) ([]string, error)
- func RemoteFilePath(localPath, remotePath string) string
- func RemoteRelPath(root, current string) string
- func RunStatus(err error) string
- func SaveStore(store *Store) error
- func SetNowForTest(fn func() time.Time) func()
- func SetUserHomeDirForTest(fn func() (string, error)) func()
- func SinceMS(start time.Time) int64
- func StorePath() (string, error)
- func ValidateSudoUser(user string) error
- type Host
- type LoginOptions
- type RunLogRecord
- type RunOptions
- type Store
- type TransferJob
- type TransferOptions
- type TransferResult
- func FetchRemote(host Host, remotePath, localPath string, opts TransferOptions) (result TransferResult, err error)
- func UploadRemote(host Host, localPath, remotePath string, opts TransferOptions) (result TransferResult, err error)
- func UploadRemoteBatch(host Host, jobs []TransferJob, opts TransferOptions) (result TransferResult, err error)
Constants ¶
View Source
const ( DefaultSSHPort = 22 DefaultGroup = "default" ConfigEnvKey = "SSHC_CONFIG" )
Variables ¶
This section is empty.
Functions ¶
func AppendRunLog ¶
func AppendRunLog(host Host, rec RunLogRecord) error
func BuildRemoteCommand ¶
func ErrorString ¶
func ExecuteRemote ¶
func ExecuteRemote(host Host, command string, opts RunOptions) ([]byte, error)
func HostGroupName ¶
func HostLogName ¶
func JoinRemotePath ¶
func LocalDirPath ¶
func LocalFilePath ¶
func LoginRemote ¶
func LoginRemoteWithOptions ¶
func LoginRemoteWithOptions(host Host, opts LoginOptions) error
func NewRemoteScriptPath ¶
func RemoteFilePath ¶
func RemoteRelPath ¶
func SetNowForTest ¶
func SetUserHomeDirForTest ¶
func ValidateSudoUser ¶
Types ¶
type Host ¶
type Host struct {
Name string `json:"name"`
IP string `json:"ip"`
User string `json:"user"`
Password string `json:"password"`
KeyPath string `json:"key_path,omitempty"`
Remark string `json:"remark,omitempty"`
Group string `json:"group,omitempty"`
Port int `json:"port"`
}
func LoadSSHConfigHosts ¶
type LoginOptions ¶
type RunLogRecord ¶
type RunOptions ¶
type Store ¶
type Store struct {
Hosts []Host `json:"hosts"`
}
func LoadStoreWithSSHConfig ¶
func (Store) MatchHosts ¶
type TransferJob ¶
type TransferOptions ¶
type TransferResult ¶
type TransferResult struct {
Bytes int64
Files int
Directories int
Elapsed time.Duration
LocalSHA256 string
RemoteSHA256 string
SHA256OK bool
}
func FetchRemote ¶
func FetchRemote(host Host, remotePath, localPath string, opts TransferOptions) (result TransferResult, err error)
func UploadRemote ¶
func UploadRemote(host Host, localPath, remotePath string, opts TransferOptions) (result TransferResult, err error)
func UploadRemoteBatch ¶
func UploadRemoteBatch(host Host, jobs []TransferJob, opts TransferOptions) (result TransferResult, err error)
Click to show internal directories.
Click to hide internal directories.