-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
30 lines (24 loc) · 689 Bytes
/
main.go
File metadata and controls
30 lines (24 loc) · 689 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
package main
import (
"log"
"net/http"
"github.com/julienschmidt/httprouter"
"github.com/thylong/whitelist/pkg/server"
)
func main() {
router := server.NewServer("radix")
router.PanicHandler = server.PanicHandler
// Interact with whitelist content
r := httprouter.New()
r.POST("/ip/:ip", server.InsertIP)
r.DELETE("/ip/:ip", server.DeleteIP)
r.GET("/ip/:ip", server.ContainIP)
r.GET("/healthz", server.Healthz)
// Catch all routes
router.GET("/*path", server.Filter)
router.PUT("/*path", server.Filter)
router.DELETE("/*path", server.Filter)
router.POST("/*path", server.Filter)
go http.ListenAndServe(":8081", r)
log.Fatal(http.ListenAndServe(":8080", router))
}