]> Cypherpunks.ru repositories - gocheese.git/commitdiff
Move everything related to passwords out
authorSergey Matveev <stargrave@stargrave.org>
Wed, 4 Dec 2019 13:40:12 +0000 (16:40 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 4 Dec 2019 13:41:08 +0000 (16:41 +0300)
gocheese.go
passwd.go

index 9b74ee7d5cf729b6f6f0faf09fb108b26ca896bc..02aa225f252bbbd2461b298b6f59be5d9b942f9e 100644 (file)
@@ -66,6 +66,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.`
 )
 
 var (
+       pkgPyPI        = regexp.MustCompile(`^.*<a href="([^"]+)"[^>]*>(.+)</a><br/>.*$`)
+       Version string = "UNKNOWN"
+
        root             = flag.String("root", "./packages", "Path to packages directory")
        bind             = flag.String("bind", "[::]:8080", "Address to bind to")
        tlsCert          = flag.String("tls-cert", "", "Path to TLS X.509 certificate")
@@ -79,17 +82,8 @@ var (
        maxClients       = flag.Int("maxclients", 128, "Maximal amount of simultaneous clients")
        version          = flag.Bool("version", false, "Print version information")
        warranty         = flag.Bool("warranty", false, "Print warranty information")
-
-       pkgPyPI        = regexp.MustCompile(`^.*<a href="([^"]+)"[^>]*>(.+)</a><br/>.*$`)
-       Version string = "UNKNOWN"
-
-       passwords map[string]Auther = make(map[string]Auther)
 )
 
-type Auther interface {
-       Auth(password string) bool
-}
-
 func mkdirForPkg(w http.ResponseWriter, r *http.Request, dir string) bool {
        path := filepath.Join(*root, dir)
        if _, err := os.Stat(path); os.IsNotExist(err) {
index 6fb75f57a192702bcc793495a9c44de708d163af..dbdac8c178065bb20fb77495548da27554661d3b 100644 (file)
--- a/passwd.go
+++ b/passwd.go
@@ -25,6 +25,12 @@ import (
        "strings"
 )
 
+var passwords map[string]Auther = make(map[string]Auther)
+
+type Auther interface {
+       Auth(password string) bool
+}
+
 func strToAuther(verifier string) (string, Auther, error) {
        st := strings.SplitN(verifier, "$", 3)
        if len(st) != 3 || st[0] != "" {