server_other.go 410 B

1234567891011121314151617
  1. // +build !windows
  2. package router
  3. import (
  4. "github.com/fvbock/endless"
  5. "github.com/gin-gonic/gin"
  6. "time"
  7. )
  8. func initServer(address string, readTimeOut, writeTimeOut int, router *gin.Engine) server {
  9. s := endless.NewServer(address, router)
  10. s.ReadHeaderTimeout = time.Duration(readTimeOut) * time.Second
  11. s.WriteTimeout = time.Duration(writeTimeOut) * time.Second
  12. s.MaxHeaderBytes = 1 << 20
  13. return s
  14. }