-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
36 lines (28 loc) · 822 Bytes
/
main.go
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
34
35
36
package main
import (
"log"
"net/http"
"time"
api "github.com/dubs3c/Dojo/api"
)
func main() {
router := http.NewServeMux()
router.HandleFunc("/health", func(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("I'm OK"))
})
router.HandleFunc("/v1/padding-oracle/encrypt", api.PaddingOracleV1Encrypt)
router.HandleFunc("/v1/padding-oracle/decrypt", api.PaddingOracleV1Decrypt)
HTTPServer := &http.Server{
Addr: "0.0.0.0:8282",
Handler: router,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 15 * time.Second,
MaxHeaderBytes: 1 << 20,
}
log.Println("Starting server...")
if err := HTTPServer.ListenAndServe(); err != http.ErrServerClosed {
log.Fatalf("HTTP server ListenAndServe: %v", err)
}
}