8000 GitHub - pyama86/pftp: pyama ftp proxy
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pyama86/pftp

Repository files navigation

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, pa
60D0
ram 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

About

pyama ftp proxy

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

0