-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.go
More file actions
31 lines (29 loc) · 849 Bytes
/
server.go
File metadata and controls
31 lines (29 loc) · 849 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
31
package server
import (
"context"
"fmt"
"net"
"net/http"
"time"
)
// Server initializes a http.Server.
func Server(ctx context.Context, handler http.Handler, port string) *http.Server {
return &http.Server{
Addr: fmt.Sprintf("0.0.0.0:%s", port),
Handler: handler,
DisableGeneralOptionsHandler: false,
TLSConfig: nil,
ReadTimeout: 15 * time.Second,
ReadHeaderTimeout: 0,
WriteTimeout: 60 * time.Second,
IdleTimeout: 30 * time.Second,
MaxHeaderBytes: http.DefaultMaxHeaderBytes,
TLSNextProto: nil,
ConnState: nil,
ErrorLog: nil,
BaseContext: func(net.Listener) context.Context {
return ctx
},
ConnContext: nil,
}
}