gofmt
This commit is contained in:
parent
872a244347
commit
acaf7edcbc
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
testData = "Just some text"
|
testData = "Just some text"
|
||||||
testDir = "mydir"
|
testDir = "mydir"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConn(t *testing.T) {
|
func TestConn(t *testing.T) {
|
||||||
@ -76,7 +76,7 @@ func TestConn(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
} else {
|
} else {
|
||||||
if dir != "/" + testDir {
|
if dir != "/"+testDir {
|
||||||
t.Error("Wrong dir: " + dir)
|
t.Error("Wrong dir: " + dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ package ftp
|
|||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
type line struct {
|
type line struct {
|
||||||
line string
|
line string
|
||||||
name string
|
name string
|
||||||
size uint64
|
size uint64
|
||||||
entryType EntryType
|
entryType EntryType
|
||||||
}
|
}
|
||||||
|
|
||||||
var listTests = []line {
|
var listTests = []line{
|
||||||
// UNIX ls -l style
|
// UNIX ls -l style
|
||||||
line{"drwxr-xr-x 3 110 1002 3 Dec 02 2009 pub", "pub", 0, EntryTypeFolder},
|
line{"drwxr-xr-x 3 110 1002 3 Dec 02 2009 pub", "pub", 0, EntryTypeFolder},
|
||||||
line{"drwxr-xr-x 3 110 1002 3 Dec 02 2009 p u b", "p u b", 0, EntryTypeFolder},
|
line{"drwxr-xr-x 3 110 1002 3 Dec 02 2009 p u b", "p u b", 0, EntryTypeFolder},
|
||||||
@ -23,7 +23,7 @@ var listTests = []line {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Not supported, at least we should properly return failure
|
// Not supported, at least we should properly return failure
|
||||||
var listTestsFail = []line {
|
var listTestsFail = []line{
|
||||||
line{"d [R----F--] supervisor 512 Jan 16 18:53 login", "login", 0, EntryTypeFolder},
|
line{"d [R----F--] supervisor 512 Jan 16 18:53 login", "login", 0, EntryTypeFolder},
|
||||||
line{"- [R----F--] rhesus 214059 Oct 20 15:27 cx.exe", "cx.exe", 0, EntryTypeFile},
|
line{"- [R----F--] rhesus 214059 Oct 20 15:27 cx.exe", "cx.exe", 0, EntryTypeFile},
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ func TestParseListLine(t *testing.T) {
|
|||||||
t.Errorf("parseListLine(%v).Name = '%v', want '%v'", lt.line, entry.Name, lt.name)
|
t.Errorf("parseListLine(%v).Name = '%v', want '%v'", lt.line, entry.Name, lt.name)
|
||||||
}
|
}
|
||||||
if entry.Type != lt.entryType {
|
if entry.Type != lt.entryType {
|
||||||
t.Errorf("parseListLine(%v).EntryType = %v, want %v", lt.line, entry.Type, lt.entryType,)
|
t.Errorf("parseListLine(%v).EntryType = %v, want %v", lt.line, entry.Type, lt.entryType)
|
||||||
}
|
}
|
||||||
if entry.Size != lt.size {
|
if entry.Size != lt.size {
|
||||||
t.Errorf("parseListLine(%v).Size = %v, want %v", lt.line, entry.Size, lt.size)
|
t.Errorf("parseListLine(%v).Size = %v, want %v", lt.line, entry.Size, lt.size)
|
||||||
|
167
status.go
167
status.go
@ -2,102 +2,109 @@ package ftp
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Positive Preliminary reply
|
// Positive Preliminary reply
|
||||||
StatusInitiating = 100
|
StatusInitiating = 100
|
||||||
StatusRestartMarker = 110
|
StatusRestartMarker = 110
|
||||||
StatusReadyMinute = 120
|
StatusReadyMinute = 120
|
||||||
StatusAlreadyOpen = 125
|
StatusAlreadyOpen = 125
|
||||||
StatusAboutToSend = 150
|
StatusAboutToSend = 150
|
||||||
|
|
||||||
// Positive Completion reply
|
// Positive Completion reply
|
||||||
StatusCommandOK = 200
|
StatusCommandOK = 200
|
||||||
StatusCommandNotImplemented = 202
|
StatusCommandNotImplemented = 202
|
||||||
StatusSystem = 211
|
StatusSystem = 211
|
||||||
StatusDirectory = 212
|
StatusDirectory = 212
|
||||||
StatusFile = 213
|
StatusFile = 213
|
||||||
StatusHelp = 214
|
StatusHelp = 214
|
||||||
StatusName = 215
|
StatusName = 215
|
||||||
StatusReady = 220
|
StatusReady = 220
|
||||||
StatusClosing = 221
|
StatusClosing = 221
|
||||||
StatusDataConnectionOpen = 225
|
StatusDataConnectionOpen = 225
|
||||||
StatusClosingDataConnection = 226
|
StatusClosingDataConnection = 226
|
||||||
StatusPassiveMode = 227
|
StatusPassiveMode = 227
|
||||||
StatusLongPassiveMode = 228
|
StatusLongPassiveMode = 228
|
||||||
StatusExtendedPassiveMode = 229
|
StatusExtendedPassiveMode = 229
|
||||||
StatusLoggedIn = 230
|
StatusLoggedIn = 230
|
||||||
StatusLoggedOut = 231
|
StatusLoggedOut = 231
|
||||||
StatusLogoutAck = 232
|
StatusLogoutAck = 232
|
||||||
StatusRequestedFileActionOK = 250
|
StatusRequestedFileActionOK = 250
|
||||||
StatusPathCreated = 257
|
StatusPathCreated = 257
|
||||||
|
|
||||||
// Positive Intermediate reply
|
// Positive Intermediate reply
|
||||||
StatusUserOK = 331
|
StatusUserOK = 331
|
||||||
StatusLoginNeedAccount = 332
|
StatusLoginNeedAccount = 332
|
||||||
StatusRequestFilePending = 350
|
StatusRequestFilePending = 350
|
||||||
|
|
||||||
// Transient Negative Completion reply
|
// Transient Negative Completion reply
|
||||||
StatusNotAvailable = 421
|
StatusNotAvailable = 421
|
||||||
StatusCanNotOpenDataConnection = 425
|
StatusCanNotOpenDataConnection = 425
|
||||||
StatusTransfertAborted = 426
|
StatusTransfertAborted = 426
|
||||||
StatusInvalidCredentials = 430
|
StatusInvalidCredentials = 430
|
||||||
StatusHostUnavailable = 434
|
StatusHostUnavailable = 434
|
||||||
StatusFileActionIgnored = 450
|
StatusFileActionIgnored = 450
|
||||||
StatusActionAborted = 451
|
StatusActionAborted = 451
|
||||||
Status452 = 452
|
Status452 = 452
|
||||||
|
|
||||||
// Permanent Negative Completion reply
|
// Permanent Negative Completion reply
|
||||||
StatusBadCommand = 500
|
StatusBadCommand = 500
|
||||||
StatusBadArguments = 501
|
StatusBadArguments = 501
|
||||||
StatusNotImplemented = 502
|
StatusNotImplemented = 502
|
||||||
StatusBadSequence = 503
|
StatusBadSequence = 503
|
||||||
StatusNotImplementedParameter = 504
|
StatusNotImplementedParameter = 504
|
||||||
StatusNotLoggedIn = 530
|
StatusNotLoggedIn = 530
|
||||||
StatusStorNeedAccount = 532
|
StatusStorNeedAccount = 532
|
||||||
StatusFileUnavailable = 550
|
StatusFileUnavailable = 550
|
||||||
StatusPageTypeUnknown = 551
|
StatusPageTypeUnknown = 551
|
||||||
StatusExceededStorage = 552
|
StatusExceededStorage = 552
|
||||||
StatusBadFileName = 553
|
StatusBadFileName = 553
|
||||||
)
|
)
|
||||||
|
|
||||||
var statusText = map[int]string{
|
var statusText = map[int]string{
|
||||||
// 200
|
// 200
|
||||||
StatusCommandOK: "Command okay.",
|
StatusCommandOK: "Command okay.",
|
||||||
StatusCommandNotImplemented: "Command not implemented, superfluous at this site.",
|
StatusCommandNotImplemented: "Command not implemented, superfluous at this site.",
|
||||||
StatusSystem: "System status, or system help reply.",
|
StatusSystem: "System status, or system help reply.",
|
||||||
StatusDirectory: "Directory status.",
|
StatusDirectory: "Directory status.",
|
||||||
StatusFile: "File status.",
|
StatusFile: "File status.",
|
||||||
StatusHelp: "Help message.",
|
StatusHelp: "Help message.",
|
||||||
StatusName: "",
|
StatusName: "",
|
||||||
StatusReady: "Service ready for new user.",
|
StatusReady: "Service ready for new user.",
|
||||||
StatusClosing: "Service closing control connection.",
|
StatusClosing: "Service closing control connection.",
|
||||||
StatusDataConnectionOpen: "Data connection open; no transfer in progress.",
|
StatusDataConnectionOpen: "Data connection open; no transfer in progress.",
|
||||||
StatusClosingDataConnection: "Closing data connection. Requested file action successful.",
|
StatusClosingDataConnection: "Closing data connection. Requested file action successful.",
|
||||||
StatusPassiveMode: "Entering Passive Mode.",
|
StatusPassiveMode: "Entering Passive Mode.",
|
||||||
StatusLongPassiveMode: "Entering Long Passive Mode.",
|
StatusLongPassiveMode: "Entering Long Passive Mode.",
|
||||||
StatusExtendedPassiveMode: "Entering Extended Passive Mode.",
|
StatusExtendedPassiveMode: "Entering Extended Passive Mode.",
|
||||||
StatusLoggedIn: "User logged in, proceed.",
|
StatusLoggedIn: "User logged in, proceed.",
|
||||||
StatusLoggedOut: "User logged out; service terminated.",
|
StatusLoggedOut: "User logged out; service terminated.",
|
||||||
StatusLogoutAck: "Logout command noted, will complete when transfer done.",
|
StatusLogoutAck: "Logout command noted, will complete when transfer done.",
|
||||||
StatusRequestedFileActionOK: "Requested file action okay, completed.",
|
StatusRequestedFileActionOK: "Requested file action okay, completed.",
|
||||||
StatusPathCreated: "Path created.",
|
StatusPathCreated: "Path created.",
|
||||||
|
|
||||||
// 300
|
// 300
|
||||||
StatusUserOK: "User name okay, need password.",
|
StatusUserOK: "User name okay, need password.",
|
||||||
StatusLoginNeedAccount: "Need account for login.",
|
StatusLoginNeedAccount: "Need account for login.",
|
||||||
StatusRequestFilePending: "Requested file action pending further information.",
|
StatusRequestFilePending: "Requested file action pending further information.",
|
||||||
|
|
||||||
// 400
|
// 400
|
||||||
StatusNotAvailable: "Service not available, closing control connection.",
|
StatusNotAvailable: "Service not available, closing control connection.",
|
||||||
StatusCanNotOpenDataConnection: "Can't open data connection.",
|
StatusCanNotOpenDataConnection: "Can't open data connection.",
|
||||||
StatusTransfertAborted: "Connection closed; transfer aborted.",
|
StatusTransfertAborted: "Connection closed; transfer aborted.",
|
||||||
StatusInvalidCredentials: "Invalid username or password.",
|
StatusInvalidCredentials: "Invalid username or password.",
|
||||||
StatusHostUnavailable: "Requested host unavailable.",
|
StatusHostUnavailable: "Requested host unavailable.",
|
||||||
StatusFileActionIgnored: "Requested file action not taken.",
|
StatusFileActionIgnored: "Requested file action not taken.",
|
||||||
StatusActionAborted: "Requested action aborted. Local error in processing.",
|
StatusActionAborted: "Requested action aborted. Local error in processing.",
|
||||||
Status452: "Insufficient storage space in system.",
|
Status452: "Insufficient storage space in system.",
|
||||||
|
|
||||||
// 500
|
// 500
|
||||||
StatusBadCommand: "Command unrecognized.",
|
StatusBadCommand: "Command unrecognized.",
|
||||||
StatusBadArguments: "Syntax error in parameters or arguments.",
|
StatusBadArguments: "Syntax error in parameters or arguments.",
|
||||||
StatusNotImplemented: "Command not implemented.",
|
StatusNotImplemented: "Command not implemented.",
|
||||||
StatusBadSequence: "Bad sequence of commands.",
|
StatusBadSequence: "Bad sequence of commands.",
|
||||||
StatusNotImplementedParameter: "Command not implemented for that parameter.",
|
StatusNotImplementedParameter: "Command not implemented for that parameter.",
|
||||||
StatusNotLoggedIn: "Not logged in.",
|
StatusNotLoggedIn: "Not logged in.",
|
||||||
StatusStorNeedAccount: "Need account for storing files.",
|
StatusStorNeedAccount: "Need account for storing files.",
|
||||||
StatusFileUnavailable: "File unavailable.",
|
StatusFileUnavailable: "File unavailable.",
|
||||||
StatusPageTypeUnknown: "Page type unknown.",
|
StatusPageTypeUnknown: "Page type unknown.",
|
||||||
StatusExceededStorage: "Exceeded storage allocation.",
|
StatusExceededStorage: "Exceeded storage allocation.",
|
||||||
StatusBadFileName: "File name not allowed.",
|
StatusBadFileName: "File name not allowed.",
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user