zhangqian
2023-11-27 b4aff74b597ad5604694903cd6b36f355bdfd2a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//go:build !windows
// +build !windows
 
package core
 
import (
    "time"
 
    "github.com/fvbock/endless"
    "github.com/gin-gonic/gin"
)
 
func initServer(address string, router *gin.Engine) server {
    s := endless.NewServer(address, router)
    s.ReadHeaderTimeout = 20 * time.Second
    s.WriteTimeout = 20 * time.Second
    s.MaxHeaderBytes = 1 << 20
    return s
}