Code Monkey home page Code Monkey logo

server's People

Contributors

admpub avatar allenluce avatar codeskyblue avatar discobean avatar folbricht avatar fuzzac avatar klingtnet avatar lichao2014 avatar lunny avatar mr-dai avatar ncw avatar notorca avatar odknt avatar preng69 avatar sapk avatar simon3z avatar titanous avatar wzshiming avatar xetorthio avatar yob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

server's Issues

Implement APPE command

Since goftp doesn't support APPE command, some clients, namely libcurl and programs which use it, cannot perform the upload.

Can you please implement APPE instead of returning 202 Obsolete?

Thanks

Not correctly closing connections

This is my first golang project so I may be mistaken but I don't think the server is correctly handling dropped connections from the client.

To reproduce

  1. Start the server
  2. Telnet to it
  3. Then kill the connection (without using QUIT)

The server tries to keep reading from the connection leading to 100% CPU usage.

I will try and fix the issue and submit a PR but don't hold your breath :)

Reading username from the driver

Hi :)

This is my first project with golang. I'm using your ftp server to provide a way to upload CSV files with user data to be synced with data in Postgres. I've written a driver that receives such data and it works well. Thing is, where these data end up depends on who logged on to the FTP server.

AFAICT, the only place this information is stored is in conn.user after a successful logon. I don't see how I would be able to get at that information from my driver without for example modifying server/cmd.go to send it along as an extra argument to PutFile, but then I'd be destroying the interface contract. Of course, this wouldn't matter in my particular example, but if at all possible, I'd like to avoid forking your project just to accomplish this.

Since I'm so new to golang, I'm wondering if I'm missing something obvious here, so I'm just putting this question out there to see what you think :)

Thanks for your time!

Daniel

How to replace the logger?

The library exposes Logger but all logger fields are private and there is no setLogger or similar method.
How can I assign my own logging struct?

passiveListenIP will get a bad IP string

`func(conn *Conn) passiveListenIP() string {

if len(conn.PublicIp()) > 0 {

    return conn.PublicIp()

}

return conn.conn.LocalAddr().String()

}`

If I do not set "PublicIp" for conn config, the "passiveListenIP" will get a bad IP string likes "ip:port".
I think the correct code is: conn.conn.LocalAddr().(*net.TCPAddr).IP.String().

Incompatible with ncftp?

Hi, I just implemented a server with this framework. I love the clear API by the way.

I couldnt really make it work with any FTP client I had at hand; the one I tried most is NcFTP. When I log in and try to send a file, I get the following output from NcFTP:

[matti@babylon tmp] 20:52:45 % ncftp -P 8021 -u asd -p asd localhost
NcFTP 3.2.6 (Dec 04, 2016) by Mike Gleason (http://www.NcFTP.com/contact/).
Connecting to 127.0.0.1...                                                                                        
Welcome msg
Logging in...                                                                                                     
Password ok, continue
Invalid reply: " EPSV"                                                                                            
Logged in to localhost.                                                                                           
Invalid reply: " EPRT"
ncftp / > put foo.bin
Protocol violation by server: blank line on control.
Passive mode refused.
foo.bin:                          ETA:   0:00    9.54/  9.54 MB  278.26 kB/s = 

So there are some errors (Invalid reply: .. ).. from my logs on the server I can tell the file was received, but NcFTP never sees any progress and the PUT command gets stuck .. ?

Server logs the following for the same session (login + PUT foo.bin):

2017/05/25 20:52:49 53969ae8352a3308d6cb  Connection Established
2017/05/25 20:52:49 53969ae8352a3308d6cb < 220 Welcome msg
2017/05/25 20:52:49 53969ae8352a3308d6cb > USER asd
2017/05/25 20:52:49 53969ae8352a3308d6cb < 331 User name ok, password required
2017/05/25 20:52:49 53969ae8352a3308d6cb > PASS ****
2017/05/25 20:52:49 53969ae8352a3308d6cb < 230 Password ok, continue
2017/05/25 20:52:49 53969ae8352a3308d6cb > PWD 
2017/05/25 20:52:49 53969ae8352a3308d6cb < 257 "/" is the current directory
2017/05/25 20:52:49 53969ae8352a3308d6cb > FEAT 
2017/05/25 20:52:49 53969ae8352a3308d6cb < 211 211-Extensions supported:
 EPSV
 EPRT
211 END
2017/05/25 20:52:49 53969ae8352a3308d6cb > HELP SITE
2017/05/25 20:52:49 53969ae8352a3308d6cb < 500 Command not found
2017/05/25 20:52:49 53969ae8352a3308d6cb > CLNT NcFTP 3.2.6 macosx10.12.2
2017/05/25 20:52:49 53969ae8352a3308d6cb < 500 Command not found
2017/05/25 20:52:58 53969ae8352a3308d6cb > TYPE I
2017/05/25 20:52:58 53969ae8352a3308d6cb < 200 Type set to binary
2017/05/25 20:52:58 53969ae8352a3308d6cb > REST 1
2017/05/25 20:52:58 53969ae8352a3308d6cb < 350 Start transfer from 1
2017/05/25 20:52:58 53969ae8352a3308d6cb > MLST foo.bin
2017/05/25 20:52:58 53969ae8352a3308d6cb < 500 Command not found
2017/05/25 20:52:58 53969ae8352a3308d6cb > SIZE foo.bin
2017/05/25 20:52:58 53969ae8352a3308d6cb < 213 0
2017/05/25 20:52:58 53969ae8352a3308d6cb > MDTM foo.bin
2017/05/25 20:52:58 53969ae8352a3308d6cb < 213 20170101000000
2017/05/25 20:52:58 53969ae8352a3308d6cb > PASV 
2017/05/25 20:52:58 53969ae8352a3308d6cb < 227 Entering Passive Mode (127,0,0,1:8021,31,86)
2017/05/25 20:52:58 53969ae8352a3308d6cb > PORT 127,0,0,1,219,236
2017/05/25 20:52:58 53969ae8352a3308d6cb  Opening active data connection to 127.0.0.1:56300
2017/05/25 20:52:58 53969ae8352a3308d6cb < 200 Connection established (56300)
2017/05/25 20:52:58 53969ae8352a3308d6cb > STOR foo.bin
2017/05/25 20:52:58 53969ae8352a3308d6cb < 150 Data transfer starting
2017/05/25 20:52:58 53969ae8352a3308d6cb < 226 OK, received 10006420 bytes

Looks to me like the passive mode connection is not being set up properly? Instead it seems to be using active mode and opening a socket towards the client?

I am running it on a 64-bit OSX PC (Macbook Pro) with Go 1.8.1. This is how I create my server:

	opts := &ftpd.ServerOpts{
		Factory:        &MyDriverFactory{},
		Auth:           &MyAuth{server: s},
		Port:           port,
		PublicIp:       "127.0.0.1",
		PassivePorts:   "8022-8023",
		WelcomeMessage: "Welcome msg",
	}
	server := ftpd.NewServer(opts)

.. could just be my FTP skills are incredibly rusty.

Can't accept XMKD command

Hello!
In cmd.go listed all supported FTP command but "XMKD" used by default Windows-cmd ftp client.
Cmd.go has all commands from here but "XMKD"
Can you add it, please?

sftp

looks good. DO you know if it supports sftp ?

Docker 中没有写入权限

示例程序exampleftpd,在宿主机上没问题,可以正常运行。但是在docker中,会报: 用户只读权限,有遇到过吗?

500 Command not found, and if via passive address scan failure

I've noticed that when I return an errors.New("XX") error in a Driver implementation for some reason I then get 500 command not found errors almost always within the same session.

When I change to passive mode, I get passive address scan failure

I have built a simple mainTest.go that runs a server, and duplicates the problem.

I've built a new FileInfo and DriverFactory, maybe my implementation is wrong somewhere?

To replicate:

$ go run mainTest.go
2018/09/06 14:26:39   Go FTP Server listening on 2022

in the test I do a rename, the Rename() method isn't implemented so it just returns an error that is printed out as expected. However any subsequent calls (like ls) all fail.

Then FTP:

$ ftp localhost 2022
ftp: connect to address ::1: Connection refused
ftp: Trying 127.0.0.1 ...
Connected to localhost.
220 Welcome to the Go FTP Server
Name (localhost:root): root
331 User name ok, password required
Password: 
230 Password ok, continue
ftp> ls
200 Connection established (57726)
150 Opening ASCII mode data connection for file list
226 Closing data connection, sent 0 bytes
ftp> ren old.txt new.txt
350 Requested file action pending further information.
550 Action not taken Rename not implemented
ftp> ls

200 Connection established (57729)
500 Command not found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.