Initial commit
This commit is contained in:
commit
404792c2eb
4 changed files with 174 additions and 0 deletions
34
validator/main.go
Normal file
34
validator/main.go
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var staticDir string
|
||||
var bind = flag.String("bind", ":8081", "Bind port/socket")
|
||||
flag.StringVar(&staticDir, "static", "./static/", "Directory containing static files")
|
||||
flag.StringVar(&ARPTable, "arp", ARPTable, "Path to ARP table")
|
||||
//var tftpdLogs = flag.String("tftpd", "/var/logs/tftpd.log", "Path to TFTPd logs")
|
||||
flag.Parse()
|
||||
|
||||
var err error
|
||||
|
||||
// Sanitize options
|
||||
log.Println("Checking paths...")
|
||||
if staticDir, err = filepath.Abs(staticDir); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
log.Println("Registering handlers...")
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/", Index)
|
||||
mux.Handle("/login", loginChecker{students})
|
||||
http.HandleFunc("/", mux.ServeHTTP)
|
||||
|
||||
log.Println("Ready, listening on port", *bind)
|
||||
http.ListenAndServe(*bind, nil)
|
||||
}
|
||||
Reference in a new issue