status.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package ftp
  2. // FTP status codes, defined in RFC 959
  3. const (
  4. StatusInitiating = 100
  5. StatusRestartMarker = 110
  6. StatusReadyMinute = 120
  7. StatusAlreadyOpen = 125
  8. StatusAboutToSend = 150
  9. StatusCommandOK = 200
  10. StatusCommandNotImplemented = 202
  11. StatusSystem = 211
  12. StatusDirectory = 212
  13. StatusFile = 213
  14. StatusHelp = 214
  15. StatusName = 215
  16. StatusReady = 220
  17. StatusClosing = 221
  18. StatusDataConnectionOpen = 225
  19. StatusClosingDataConnection = 226
  20. StatusPassiveMode = 227
  21. StatusLongPassiveMode = 228
  22. StatusExtendedPassiveMode = 229
  23. StatusLoggedIn = 230
  24. StatusLoggedOut = 231
  25. StatusLogoutAck = 232
  26. StatusRequestedFileActionOK = 250
  27. StatusPathCreated = 257
  28. StatusUserOK = 331
  29. StatusLoginNeedAccount = 332
  30. StatusRequestFilePending = 350
  31. StatusNotAvailable = 421
  32. StatusCanNotOpenDataConnection = 425
  33. StatusTransfertAborted = 426
  34. StatusInvalidCredentials = 430
  35. StatusHostUnavailable = 434
  36. StatusFileActionIgnored = 450
  37. StatusActionAborted = 451
  38. Status452 = 452
  39. StatusBadCommand = 500
  40. StatusBadArguments = 501
  41. StatusNotImplemented = 502
  42. StatusBadSequence = 503
  43. StatusNotImplementedParameter = 504
  44. StatusNotLoggedIn = 530
  45. StatusStorNeedAccount = 532
  46. StatusFileUnavailable = 550
  47. StatusPageTypeUnknown = 551
  48. StatusExceededStorage = 552
  49. StatusBadFileName = 553
  50. )
  51. var statusText = map[int]string{
  52. // 200
  53. StatusCommandOK: "Command okay.",
  54. StatusCommandNotImplemented: "Command not implemented, superfluous at this site.",
  55. StatusSystem: "System status, or system help reply.",
  56. StatusDirectory: "Directory status.",
  57. StatusFile: "File status.",
  58. StatusHelp: "Help message.",
  59. StatusName: "",
  60. StatusReady: "Service ready for new user.",
  61. StatusClosing: "Service closing control connection.",
  62. StatusDataConnectionOpen: "Data connection open; no transfer in progress.",
  63. StatusClosingDataConnection: "Closing data connection. Requested file action successful.",
  64. StatusPassiveMode: "Entering Passive Mode.",
  65. StatusLongPassiveMode: "Entering Long Passive Mode.",
  66. StatusExtendedPassiveMode: "Entering Extended Passive Mode.",
  67. StatusLoggedIn: "User logged in, proceed.",
  68. StatusLoggedOut: "User logged out; service terminated.",
  69. StatusLogoutAck: "Logout command noted, will complete when transfer done.",
  70. StatusRequestedFileActionOK: "Requested file action okay, completed.",
  71. StatusPathCreated: "Path created.",
  72. // 300
  73. StatusUserOK: "User name okay, need password.",
  74. StatusLoginNeedAccount: "Need account for login.",
  75. StatusRequestFilePending: "Requested file action pending further information.",
  76. // 400
  77. StatusNotAvailable: "Service not available, closing control connection.",
  78. StatusCanNotOpenDataConnection: "Can't open data connection.",
  79. StatusTransfertAborted: "Connection closed; transfer aborted.",
  80. StatusInvalidCredentials: "Invalid username or password.",
  81. StatusHostUnavailable: "Requested host unavailable.",
  82. StatusFileActionIgnored: "Requested file action not taken.",
  83. StatusActionAborted: "Requested action aborted. Local error in processing.",
  84. Status452: "Insufficient storage space in system.",
  85. // 500
  86. StatusBadCommand: "Command unrecognized.",
  87. StatusBadArguments: "Syntax error in parameters or arguments.",
  88. StatusNotImplemented: "Command not implemented.",
  89. StatusBadSequence: "Bad sequence of commands.",
  90. StatusNotImplementedParameter: "Command not implemented for that parameter.",
  91. StatusNotLoggedIn: "Not logged in.",
  92. StatusStorNeedAccount: "Need account for storing files.",
  93. StatusFileUnavailable: "File unavailable.",
  94. StatusPageTypeUnknown: "Page type unknown.",
  95. StatusExceededStorage: "Exceeded storage allocation.",
  96. StatusBadFileName: "File name not allowed.",
  97. }
  98. // StatusText returns a text for the FTP status code. It returns the empty string if the code is unknown.
  99. func StatusText(code int) string {
  100. return statusText[code]
  101. }