server

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectFtp

func ConnectFtp(cfg Params) (*ftp, error)

Connect to the FTP server.

func ConnectSsh

func ConnectSsh(cfg Params) (*sftp, error)

Connect to the SFTP server.

Types

type Connection

type Connection struct {
	Driver Driver
}

Holds the connection driver.

func Manage

func Manage(driver Driver) *Connection

Initialise a connection with a driver.

func (*Connection) Close

func (c *Connection) Close()

Close connection.

func (*Connection) Delete

func (c *Connection) Delete(path string) error

Delete a file.

func (*Connection) Exec

func (c *Connection) Exec(command string) (string, error)

Execute a command on the server.

func (*Connection) MkDir

func (c *Connection) MkDir(path string) error

Create a directory.

func (*Connection) Read

func (c *Connection) Read(path string) (string, error)

Read a file contents.

func (*Connection) Upload

func (c *Connection) Upload(path, destination string) error

Upload a file.

type Driver

type Driver interface {
	MkDir(path string) error
	Upload(path, destination string) error
	Read(path string) (string, error)
	Delete(path string) error
	Exec(command string) (string, error)
	Close()
}

Server connection driver.

type Params

type Params struct {
	Host       string
	Port       int
	Username   string
	Password   string
	Privatekey string
	Path       string
	Maxclients int
}

Connection parameters.

Jump to

Keyboard shortcuts

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