scp

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParallelScp

func ParallelScp(sftpItem ScpItem, servers []runner.ServerInternal) chan error

ParallelScp 并发拷贝 todo: Modify

func Scp

func Scp(sftpItem *ScpItem) error

Scp 远程写文件

Types

type IOCopy64Err

type IOCopy64Err struct {
	Host    string
	SrcPath string
	DstPath string
	Err     error
}

func (IOCopy64Err) Error

func (ioCopy64Err IOCopy64Err) Error() string

type NewSftpClientErr

type NewSftpClientErr struct {
	Host string
	Err  error
}

func (NewSftpClientErr) Error

func (newSftpClientErr NewSftpClientErr) Error() string

type ScpItem

type ScpItem struct {
	Logger *logrus.Logger
	SftpInterface
	SftpExecutor
	SftpConnectTimeout time.Duration
	// contains filtered or unexported fields
}

ScpItem 定义跨主机拷贝属性

func (*ScpItem) IOCopy64

func (sftp *ScpItem) IOCopy64(size int64, srcPath string, dstPath string, hostSign string, logger *logrus.Logger) (err error)

func (*ScpItem) NewSftpClient

func (sftp *ScpItem) NewSftpClient(server runner.ServerInternal, timeout time.Duration) (err error)

NewSftpClient sftp客户端

func (*ScpItem) SftpChmod

func (sftp *ScpItem) SftpChmod(dstPath string, mode os.FileMode) error

func (*ScpItem) SftpCreate

func (sftp *ScpItem) SftpCreate(path string) (err error)

type SftpChmodErr

type SftpChmodErr struct {
	Host    string
	DstPath string
	Err     error
}

func (SftpChmodErr) Error

func (chmodErr SftpChmodErr) Error() string

type SftpCreateErr

type SftpCreateErr struct {
	Host    string
	DstPath string
	Err     error
}

func (SftpCreateErr) Error

func (sftpCreateErr SftpCreateErr) Error() string

type SftpExecutor

type SftpExecutor struct {
	SrcPath string
	DstPath string
	Mode    os.FileMode
	Server  runner.ServerInternal
	sync.Mutex
	SftpClient *sftp.Client

	ProxyReader io.ReadCloser
	P           *mpb.Progress
	// contains filtered or unexported fields
}

type SftpInterface

type SftpInterface interface {
	NewSftpClient(server runner.ServerInternal, timeout time.Duration) (err error)
	SftpCreate(path string) (err error)
	SftpChmod(dstPath string, mode os.FileMode) error
	IOCopy64(size int64, srcPath string, dstPath string, hostSign string, logger *logrus.Logger) (err error)
}

type SftpItem

type SftpItem struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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