scp

package module
v0.0.0-...-13cc8a4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

scp

codecov go report card test status Apache-2.0 license Go.Dev reference Go project version

Install

go get github.com/chyroc/scp

Usage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Printf(msg string, args ...interface{})
}

func NewFileLogger

func NewFileLogger(file string) (Logger, error)

type Option

type Option struct {
	Logger           Logger  // logger interface
	SymbolicLink     bool    // if true, send link file, else target file
	SkipMd5EqualFile bool    // if true, check file md5 if equal, if equal, skip upload file or download file
	Trigger          Trigger // trigger callback function to do custom logic
}

type SCP

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

func NewSCP

func NewSCP(client *ssh.Client) *SCP

func (*SCP) DownloadFile

func (r *SCP) DownloadFile(src, dest string, opt *Option) error

func (*SCP) UploadFile

func (r *SCP) UploadFile(src, dest string, opt *Option) error

type Trigger

type Trigger func(typ TriggerType, src, dest string, opt *TriggerOption)

type TriggerOption

type TriggerOption struct {
	Skip bool
	Err  error
}

type TriggerType

type TriggerType int
const (
	TriggerBeforeSendFile TriggerType = iota + 1
	TriggerAfterSendFile
	TriggerBeforeSendDir
	TriggerAfterSendDir
)

Jump to

Keyboard shortcuts

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