zdpgo_ftp

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 11 Imported by: 0

README

zdpgo_ftp

FTP服务,FTP文件上传和下载

版本历史

  • v0.1.0 2022/05/30 新增:FTP服务,文件上传下载

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Conn *ftp.ServerConn
	Log  *zdpgo_log.Log
}

func (*Client) ChangeDir

func (c *Client) ChangeDir(dirPath string) error

ChangeDir 切换工作目录

func (*Client) Close

func (c *Client) Close() error

Close 关闭客户端

func (*Client) CurrentDir

func (c *Client) CurrentDir() (string, error)

CurrentDir 获取当前目录

func (*Client) Download

func (c *Client) Download(srcPath, destPath string) error

Download 下载文件

func (*Client) DownloadToBytes

func (c *Client) DownloadToBytes(filePath string) ([]byte, error)

DownloadToBytes 下载文件并转换我bytes数组

func (*Client) MakeDir

func (c *Client) MakeDir(dirPath string) error

MakeDir 创建目录

func (*Client) Retr

func (c *Client) Retr(filePath string) ([]byte, error)

Retr 获取文件内容

func (*Client) Store

func (c *Client) Store(fileName string, fileContent io.Reader) error

Store 存储文件

func (*Client) Upload

func (c *Client) Upload(srcPath, destPath string) error

Upload 上传文件

func (*Client) UploadAndCheckMd5

func (c *Client) UploadAndCheckMd5(srcPath, destPath string) error

UploadAndCheckMd5 上传文件并校验MD5值

type Config

type Config struct {
	Debug       bool   `yaml:"debug" json:"debug"`
	LogFilePath string `yaml:"log_file_path" json:"log_file_path"`
	WorkDir     string `yaml:"root_dir" json:"root_dir"`
	Host        string `yaml:"host" json:"host"`
	Port        int    `yaml:"port" json:"port"`
	Username    string `yaml:"username" json:"username"`
	Password    string `yaml:"password" json:"password"`
}

type Ftp

type Ftp struct {
	Config *Config
	Log    *zdpgo_log.Log
}

func New

func New() *Ftp

func NewWithConfig

func NewWithConfig(config *Config) *Ftp

func (*Ftp) GetClient

func (f *Ftp) GetClient() (*Client, error)

GetClient 获取客户端

func (*Ftp) GetServer

func (f *Ftp) GetServer() *Server

GetServer 获取服务端对象

func (*Ftp) IsHealth

func (f *Ftp) IsHealth() bool

type Server

type Server struct {
	Config *Config
	Log    *zdpgo_log.Log
}

func (*Server) Run

func (s *Server) Run() error

Run 运行服务

Directories

Path Synopsis
Package errwrap implements methods to formalize error wrapping in Go.
Package errwrap implements methods to formalize error wrapping in Go.
examples
server command
Package ftp implements a FTP client as described in RFC 959.
Package ftp implements a FTP client as described in RFC 959.
pkg/credentials
Package credentials provides credential retrieval and management for S3 compatible object storage.
Package credentials provides credential retrieval and management for S3 compatible object storage.

Jump to

Keyboard shortcuts

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