ftp/status.go

120 lines
4.6 KiB
Go
Raw Permalink Normal View History

2011-05-07 01:29:10 +02:00
package ftp
import "fmt"
2015-03-05 11:57:38 +01:00
// FTP status codes, defined in RFC 959
2011-05-07 01:29:10 +02:00
const (
2013-02-17 10:31:56 +01:00
StatusInitiating = 100
2011-05-07 01:29:10 +02:00
StatusRestartMarker = 110
2013-02-17 10:31:56 +01:00
StatusReadyMinute = 120
StatusAlreadyOpen = 125
StatusAboutToSend = 150
StatusCommandOK = 200
2011-05-07 01:29:10 +02:00
StatusCommandNotImplemented = 202
2013-02-17 10:31:56 +01:00
StatusSystem = 211
StatusDirectory = 212
StatusFile = 213
StatusHelp = 214
StatusName = 215
StatusReady = 220
StatusClosing = 221
StatusDataConnectionOpen = 225
2011-05-07 01:29:10 +02:00
StatusClosingDataConnection = 226
2013-02-17 10:31:56 +01:00
StatusPassiveMode = 227
StatusLongPassiveMode = 228
StatusExtendedPassiveMode = 229
StatusLoggedIn = 230
StatusLoggedOut = 231
StatusLogoutAck = 232
2020-04-23 00:49:43 +02:00
StatusAuthOK = 234
2011-05-07 01:29:10 +02:00
StatusRequestedFileActionOK = 250
2013-02-17 10:31:56 +01:00
StatusPathCreated = 257
StatusUserOK = 331
StatusLoginNeedAccount = 332
StatusRequestFilePending = 350
2013-02-17 10:31:56 +01:00
StatusNotAvailable = 421
2011-05-07 01:29:10 +02:00
StatusCanNotOpenDataConnection = 425
2013-02-17 10:31:56 +01:00
StatusTransfertAborted = 426
StatusInvalidCredentials = 430
StatusHostUnavailable = 434
StatusFileActionIgnored = 450
StatusActionAborted = 451
Status452 = 452
StatusBadCommand = 500
StatusBadArguments = 501
StatusNotImplemented = 502
StatusBadSequence = 503
2011-05-07 01:29:10 +02:00
StatusNotImplementedParameter = 504
2013-02-17 10:31:56 +01:00
StatusNotLoggedIn = 530
StatusStorNeedAccount = 532
StatusFileUnavailable = 550
StatusPageTypeUnknown = 551
StatusExceededStorage = 552
StatusBadFileName = 553
2011-05-07 01:29:10 +02:00
)
var statusText = map[int]string{
2013-02-17 10:29:16 +01:00
// 200
2013-02-17 10:31:56 +01:00
StatusCommandOK: "Command okay.",
StatusCommandNotImplemented: "Command not implemented, superfluous at this site.",
StatusSystem: "System status, or system help reply.",
StatusDirectory: "Directory status.",
StatusFile: "File status.",
StatusHelp: "Help message.",
StatusName: "",
StatusReady: "Service ready for new user.",
StatusClosing: "Service closing control connection.",
StatusDataConnectionOpen: "Data connection open; no transfer in progress.",
StatusClosingDataConnection: "Closing data connection. Requested file action successful.",
StatusPassiveMode: "Entering Passive Mode.",
StatusLongPassiveMode: "Entering Long Passive Mode.",
StatusExtendedPassiveMode: "Entering Extended Passive Mode.",
StatusLoggedIn: "User logged in, proceed.",
StatusLoggedOut: "User logged out; service terminated.",
StatusLogoutAck: "Logout command noted, will complete when transfer done.",
2020-04-23 00:49:43 +02:00
StatusAuthOK: "AUTH command OK",
2013-02-17 10:31:56 +01:00
StatusRequestedFileActionOK: "Requested file action okay, completed.",
StatusPathCreated: "Path created.",
2013-02-17 10:29:16 +01:00
// 300
2013-02-17 10:31:56 +01:00
StatusUserOK: "User name okay, need password.",
StatusLoginNeedAccount: "Need account for login.",
StatusRequestFilePending: "Requested file action pending further information.",
2013-02-17 10:29:16 +01:00
// 400
2013-02-17 10:31:56 +01:00
StatusNotAvailable: "Service not available, closing control connection.",
StatusCanNotOpenDataConnection: "Can't open data connection.",
StatusTransfertAborted: "Connection closed; transfer aborted.",
StatusInvalidCredentials: "Invalid username or password.",
StatusHostUnavailable: "Requested host unavailable.",
StatusFileActionIgnored: "Requested file action not taken.",
StatusActionAborted: "Requested action aborted. Local error in processing.",
Status452: "Insufficient storage space in system.",
2013-02-17 10:29:16 +01:00
// 500
2013-02-17 10:31:56 +01:00
StatusBadCommand: "Command unrecognized.",
StatusBadArguments: "Syntax error in parameters or arguments.",
StatusNotImplemented: "Command not implemented.",
StatusBadSequence: "Bad sequence of commands.",
StatusNotImplementedParameter: "Command not implemented for that parameter.",
StatusNotLoggedIn: "Not logged in.",
StatusStorNeedAccount: "Need account for storing files.",
StatusFileUnavailable: "File unavailable.",
StatusPageTypeUnknown: "Page type unknown.",
StatusExceededStorage: "Exceeded storage allocation.",
StatusBadFileName: "File name not allowed.",
2011-05-07 01:29:10 +02:00
}
// StatusText returns a text for the FTP status code. It returns the empty string if the code is unknown.
func StatusText(code int) string {
str, ok := statusText[code]
if !ok {
str = fmt.Sprintf("Unknown status code: %d", code)
}
return str
}