about summary refs log tree commit diff
path: root/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'auth.go')
-rw-r--r--auth.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/auth.go b/auth.go
new file mode 100644
index 0000000..d056f1b
--- /dev/null
+++ b/auth.go
@@ -0,0 +1,27 @@
+package main
+
+import(
+  "log"
+)
+
+// Auth is an interface to auth your ftp user login.
+type Auth interface {
+	CheckPasswd(string, string) (bool, error)
+}
+
+var (
+	_ Auth = &FakeAuth{}
+)
+
+// FakeAuth implements Auth interface to provide a memory user login auth
+type FakeAuth struct {
+	Name     string
+	Password string
+}
+
+// CheckPasswd will check user's password
+func (a *FakeAuth) CheckPasswd(name, pass string) (bool, error) {
+    metrics_num_passwords++
+    log.Printf("%s@ftp - %s", name, pass)
+    return false, nil
+}