Categorygithub.com/pyama86/pftp
modulepackage
0.0.1
Repository: https://github.com/pyama86/pftp.git
Documentation: pkg.go.dev

# README

Build Status

pftp

pluggable ftp proxy server

example

func main() {
	confFile := "./example.toml"

	ftpServer, err := pftp.NewFtpServer(confFile)
	if err != nil {
		logrus.Fatal(err)
	}

	if err := ftpServer.Start(); err != nil {
		logrus.Fatal(err)
	}
}

middleware

In pftp, you can hook into the ftp command and execute arbitrary processing.

USER command example

An example of changing the connection destination according to the user name.

func main() {
...
	ftpServer.Use("user", User)
...
}

func User(c *pftp.Context, param string) error {
        if param == "foo" {
	    c.RemoteAddr = "127.0.0.1:10021"
        } else if param == "bar" {
	    c.RemoteAddr = "127.0.0.1:20021"
        }
	return nil
}

Require

  • Go 1.15 or later

author

  • @pyama86
  • @heat1024

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

User function will setup Origin ftp server domain from ftp username If failed get domain from server, the origin will set by local (localhost:21).