about summary refs log tree commit diff
path: root/auth.go
diff options
context:
space:
mode:
authorAlexander Karl <akarl@darknebu.la>2019-02-13 22:28:50 +0100
committerAlexander Karl <akarl@darknebu.la>2019-02-13 22:28:50 +0100
commitb0ac27c3c943e4db6c23e780f0e9829c1bdefcaf (patch)
treee7e1cb272546ff2d2b328515e5e354573b67e7b2 /auth.go
Init commit - welcome ftp-grab-password
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
+}