Rainbond/gateway/controller/openresty/model/http.go

77 lines
1.3 KiB
Go
Raw Normal View History

2018-11-08 17:22:26 +08:00
package model
2018-11-21 17:35:07 +08:00
import "github.com/goodrain/rainbond/cmd/gateway/option"
2018-11-23 14:34:44 +08:00
// HTTP contains data for nginx http configuration
type HTTP struct {
2018-11-08 17:22:26 +08:00
DefaultType string
SendFile bool
KeepaliveTimeout Time
2018-11-21 17:35:07 +08:00
keepaliveRequests int
2018-11-08 17:22:26 +08:00
ClientMaxBodySize Size
ClientBodyBufferSize Size
ProxyConnectTimeout Time
ProxySendTimeout Time
ProxyReadTimeout Time
ProxyBufferSize Size
ProxyBuffers Size
ProxyBusyBuffersSize Size
AuxiliaryPort int
2018-11-23 14:34:44 +08:00
UpstreamsDict Size
2018-11-08 17:22:26 +08:00
}
type LogFormat struct {
Name string
Format string
}
type AccessLog struct {
Name string
Path string
}
2018-11-23 14:34:44 +08:00
// NewHTTP creates a new model.HTTP
func NewHTTP(conf *option.Config) *HTTP {
return &HTTP{
DefaultType: "text/html",
SendFile: true,
AuxiliaryPort: conf.ListenPorts.AuxiliaryPort,
2018-11-08 17:22:26 +08:00
KeepaliveTimeout: Time{
Num: 30,
2018-11-08 17:22:26 +08:00
Unit: "s",
},
ClientMaxBodySize: Size{
Num: 10,
Unit: "m",
},
ClientBodyBufferSize: Size{
Num: 128,
Unit: "k",
},
ProxyConnectTimeout: Time{
Num: 75,
Unit: "s",
},
ProxySendTimeout: Time{
Num: 75,
Unit: "s",
},
ProxyReadTimeout: Time{
Num: 75,
Unit: "s",
},
ProxyBufferSize: Size{
Num: 8,
Unit: "k",
},
ProxyBuffers: Size{
Num: 32,
Unit: "k",
},
2018-11-23 14:34:44 +08:00
UpstreamsDict: Size{
Num: 128,
Unit: "k",
},
2018-11-08 17:22:26 +08:00
}
}