-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
33 lines (24 loc) · 672 Bytes
/
main.go
File metadata and controls
33 lines (24 loc) · 672 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main
import (
"fmt"
"github.com/coooold/simpleotp_go/internal"
"log"
"net/http"
"time"
)
func startHttpServer() {
http.HandleFunc("/totp/check", internal.CheckAuthHandler)
http.HandleFunc("/totp/login", internal.LoginHandler)
server := &http.Server{
Addr: fmt.Sprintf(":%d", internal.Port),
ReadTimeout: 15 * time.Second,
WriteTimeout: 15 * time.Second,
}
log.Printf("Server is listening on port %d", internal.Port)
log.Fatal(server.ListenAndServe())
}
func main() {
internal.InitParams()
log.Printf("start with port %d max_age %d login stop %d", internal.Port, internal.MaxAge, internal.LoginStopSeconds)
startHttpServer()
}