Support clnt #143
19
cmd.go
19
cmd.go
@ -34,6 +34,7 @@ var (
|
||||
"CWD": commandCwd{},
|
||||
"CCC": commandCcc{},
|
||||
"CONF": commandConf{},
|
||||
"CLNT": commandCLNT{},
|
||||
"DELE": commandDele{},
|
||||
"ENC": commandEnc{},
|
||||
"EPRT": commandEprt{},
|
||||
@ -139,7 +140,25 @@ func (cmd commandAppe) Execute(sess *Session, param string) {
|
||||
} else {
|
||||
sess.writeMessage(450, fmt.Sprint("error during transfer: ", err))
|
||||
}
|
||||
}
|
||||
|
||||
type commandCLNT struct{}
|
||||
|
||||
func (cmd commandCLNT) IsExtend() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (cmd commandCLNT) RequireParam() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (cmd commandCLNT) RequireAuth() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (cmd commandCLNT) Execute(sess *Session, param string) {
|
||||
sess.clientSoft = param
|
||||
sess.writeMessage(200, "OK")
|
||||
}
|
||||
|
||||
type commandOpts struct{}
|
||||
|
@ -273,6 +273,7 @@ func (server *Server) ListenAndServe() error {
|
||||
func (server *Server) Serve(l net.Listener) error {
|
||||
server.listener = l
|
||||
server.ctx, server.cancel = context.WithCancel(context.Background())
|
||||
defer server.cancel()
|
||||
sessionID := newSessionID()
|
||||
for {
|
||||
tcpConn, err := server.listener.Accept()
|
||||
|
@ -42,6 +42,7 @@ type Session struct {
|
||||
preCommand string
|
||||
closed bool
|
||||
tls bool
|
||||
clientSoft string
|
||||
Data map[string]interface{} // shared data between different commands
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user