I was creating an ftp client using the goftp library. Connecting to the server works but when I try to list the contents of the current directory the server hangs with 229 Entering Extended Passive Mode
. I read that it could be a firewall issue but if I use Filezilla to connect to the FTP server it just works.
What am I doing wrong?
Here is the code that I'm using:
c, err := ftp.Dial(
os.Getenv("ftpserver"),
ftp.DialWithExplicitTLS(
&tls.Config{
InsecureSkipVerify: true,
},
),
ftp.DialWithDebugOutput(os.Stdout),
ftp.DialWithTimeout(5*time.Second),
)
err = c.Login(os.Getenv("username"), os.Getenv("password"))
if err != nil {
log.Fatal(err)
}
fmt.Println(c.List("/"))
// Do something with the FTP conn
if err := c.Quit(); err != nil {
log.Fatal(err)
}
and this is the output that it gives me:
220 (vsFTPd 3.0.3)
AUTH TLS
234 Proceed with negotiation.
USER username
331 Please specify the password.
PASS pasword
230 Login successful.
FEAT
211-Features:
AUTH TLS
UTF8
EPRT
EPSV
MDTM
PASV
PBSZ
PROT
REST STREAM
SIZE
TVFS
211 End
TYPE I
200 Switching to Binary mode.
OPTS UTF8 ON
200 Always in UTF8 mode.
PBSZ 0
200 PBSZ set to 0.
PROT P
200 PROT now Private.
EPSV
229 Entering Extended Passive Mode (|||7339|)