Golang FTP EPRT错误

时间:2017-02-07 18:56:43

标签: go ftp ftp-client

我正在尝试使用github.com/secsy/goftp库将文件发送到Go中的FTP服务器。我可以毫无问题地连接/验证服务器,但是我在发送文件时遇到了问题。我能找到的错误没有太多背景。我试过手动强制客户端使用主动和被动传输而没有任何成功。有什么想法吗?

config := goftp.Config{
    User:               "username",
    Password:           "password",
    ConnectionsPerHost: 1,
    Timeout:            10 * time.Second,
    IPv6Lookup:         false,
    ActiveTransfers:    false,
    Logger:             os.Stderr,
}

client, err := goftp.DialConfig(config, "server_hostname:2121")
if err != nil {
    fmt.Println("Error connecting to FTP")
    fmt.Println(err.Error())
    os.Exit(1)
}

uploadFile, err := os.Open(fileLocation)
if err != nil {
    fmt.Println("Error opening file for FTP")
    fmt.Println(err.Error())
    os.Exit(1)
}

err = client.Store(ftpPath, uploadFile)
if err != nil {
    fmt.Println("Error FTP'ing File")
    fmt.Println(err.Error())
    os.Exit(1)
}

以下是客户发布的消息:

goftp: 0.000 #1 opening control connection to [server]:2121
goftp: 0.056 #1 sending command USER username
goftp: 0.084 #1 got 331-User name ok, password required
goftp: 0.084 #1 sending command PASS ******
goftp: 0.111 #1 got 230-Password ok, continue
goftp: 0.112 #1 sending command FEAT
goftp: 0.137 #1 got 211-211-Extensions supported:
goftp: 0.137 #1 was ready
goftp: 0.137 #1 sending command TYPE I
goftp: 0.137 #1 error reading response: short response:  EPRT
Error FTP'ing File
error reading response: short response:  EPRT
exit status 1

以下是从服务器发布的消息:

2017/02/07 13:14:26 3c2634d4f643fe779c9a: Connection Established
2017/02/07 13:14:26 3c2634d4f643fe779c9a: 220 Welcome to the Go FTP Server
2017/02/07 13:14:26 3c2634d4f643fe779c9a: USER username
2017/02/07 13:14:26 3c2634d4f643fe779c9a: 331 User name ok, password required
2017/02/07 13:14:26 3c2634d4f643fe779c9a: PASS ****
2017/02/07 13:14:26 3c2634d4f643fe779c9a: 230 Password ok, continue
2017/02/07 13:14:27 3c2634d4f643fe779c9a: FEAT 
2017/02/07 13:14:27 3c2634d4f643fe779c9a: 211 211-Extensions supported:
 EPRT
 EPSV
211 END
2017/02/07 13:14:27 3c2634d4f643fe779c9a: TYPE I
2017/02/07 13:14:27 3c2634d4f643fe779c9a: 200 Type set to binary
2017/02/07 13:14:27 3c2634d4f643fe779c9a: Connection Terminated

0 个答案:

没有答案