-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
40 lines (31 loc) · 838 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 (
"fmt"
"github.com/gin-gonic/gin"
"github.com/jayxtt999/ip-ddos-sz/pkg/logging"
"github.com/jayxtt999/ip-ddos-sz/pkg/setting"
"github.com/jayxtt999/ip-ddos-sz/routers"
"log"
"net/http"
)
func init() {
setting.Setup()
logging.Setup()
}
func main() {
gin.SetMode(setting.ServerSetting.RunMode)
routersInit := routers.InitRouter()
readTimeout := setting.ServerSetting.ReadTimeout
writeTimeout := setting.ServerSetting.WriteTimeout
endPoint := fmt.Sprintf(":%d", setting.ServerSetting.HttpPort)
maxHeaderBytes := 1 << 20
server := &http.Server{
Addr: endPoint,
Handler: routersInit,
ReadTimeout: readTimeout,
WriteTimeout: writeTimeout,
MaxHeaderBytes: maxHeaderBytes,
}
log.Printf("[info] start http server listening %s", endPoint)
server.ListenAndServe()
}