ftp

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 Wenhui Shen <www.webx.top>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = &Config{
		PidFile:      `ftp.pid`,
		DBType:       `mysql`,
		FTPStoreType: `file`,
		ServerOpts: ftpserver.ServerOpts{
			Name:           `TinyFTP`,
			PassivePorts:   `6001-7000`,
			Port:           25,
			PublicIp:       `127.0.0.1`,
			WelcomeMessage: `Welcome to the TinyFTP`,
		},
	}
	DefaultPidFile = `ftp.pid`
)

Functions

func Fixed

func Fixed(c *Config)

Types

type Auth

type Auth struct {
	*model.FtpUser
}

func NewAuth

func NewAuth() *Auth

type Config

type Config struct {
	PidFile      string            `json:"pidFile"`
	DBType       string            `json:"dbType"`
	FTPStoreType string            `json:"ftpStoreType"`
	FTPOptions   map[string]string `json:"ftpOptions"`
	ftpserver.ServerOpts
	// contains filtered or unexported fields
}

func (*Config) Init

func (c *Config) Init() *Config

func (*Config) SetAuth

func (c *Config) SetAuth(auth ftpserver.Auth) *Config

func (*Config) SetAuthByType

func (c *Config) SetAuthByType(storeType string) *Config

func (*Config) SetPerm

func (c *Config) SetPerm(perm ftpserver.Perm, owner string, group string) *Config

func (*Config) SetPermByType

func (c *Config) SetPermByType(storeType string, owner string, group string) *Config

func (*Config) SetPort

func (c *Config) SetPort(port int) *Config

func (*Config) SetStore

func (c *Config) SetStore(store ftpserver.DriverFactory) *Config

func (*Config) SetStoreByType

func (c *Config) SetStoreByType(storeType string, options ...map[string]string) *Config

func (*Config) Start

func (c *Config) Start()

Start start ftp server

type FileDriver

type FileDriver struct {
	ftpserver.Perm
	// contains filtered or unexported fields
}

func (*FileDriver) ChangeDir

func (driver *FileDriver) ChangeDir(path string) error

func (*FileDriver) DeleteDir

func (driver *FileDriver) DeleteDir(path string) error

func (*FileDriver) DeleteFile

func (driver *FileDriver) DeleteFile(path string) error

func (*FileDriver) GetFile

func (driver *FileDriver) GetFile(path string, offset int64) (int64, io.ReadCloser, error)

func (*FileDriver) Init

func (driver *FileDriver) Init(conn *ftpserver.Conn)

func (*FileDriver) ListDir

func (driver *FileDriver) ListDir(path string, callback func(ftpserver.FileInfo) error) error

func (*FileDriver) MakeDir

func (driver *FileDriver) MakeDir(path string) error

func (*FileDriver) PutFile

func (driver *FileDriver) PutFile(destPath string, data io.Reader, appendData bool) (int64, error)

func (*FileDriver) Rename

func (driver *FileDriver) Rename(fromPath string, toPath string) error

func (*FileDriver) Stat

func (driver *FileDriver) Stat(path string) (ftpserver.FileInfo, error)

type FileDriverFactory

type FileDriverFactory struct {
	ftpserver.Perm
}

func (*FileDriverFactory) NewDriver

func (factory *FileDriverFactory) NewDriver() (ftpserver.Driver, error)

type FileInfo

type FileInfo struct {
	os.FileInfo
	// contains filtered or unexported fields
}

func (*FileInfo) Group

func (f *FileInfo) Group() string

func (*FileInfo) Mode

func (f *FileInfo) Mode() os.FileMode

func (*FileInfo) Owner

func (f *FileInfo) Owner() string

type Perm

type Perm struct {
	*ftpserver.SimplePerm
}

func NewPerm

func NewPerm(owner, group string) *Perm

func (*Perm) GetMode

func (s *Perm) GetMode(string) (os.FileMode, error)

Jump to

Keyboard shortcuts

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