pluggable ftp proxy server
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)
}
}
In pftp, you can hook into the ftp command and execute arbitrary processing.
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
}
- Go 1.15 or later
- @pyama86
- @heat1024