Reduced number of exported identifiers
This commit is contained in:
30
config.go
Normal file
30
config.go
Normal file
@ -0,0 +1,30 @@
|
||||
package web
|
||||
|
||||
import "time"
|
||||
|
||||
// config represents the server configuration.
|
||||
type config struct {
|
||||
Timeout timeoutConfig `json:"timeout"`
|
||||
}
|
||||
|
||||
// timeoutConfig lets you configure the different timeout durations.
|
||||
type timeoutConfig struct {
|
||||
Idle time.Duration `json:"idle"`
|
||||
Read time.Duration `json:"read"`
|
||||
ReadHeader time.Duration `json:"readHeader"`
|
||||
Write time.Duration `json:"write"`
|
||||
Shutdown time.Duration `json:"shutdown"`
|
||||
}
|
||||
|
||||
// Reset resets all fields to the default configuration.
|
||||
func defaultConfig() config {
|
||||
return config{
|
||||
Timeout: timeoutConfig{
|
||||
Idle: 3 * time.Minute,
|
||||
Write: 2 * time.Minute,
|
||||
Read: 5 * time.Second,
|
||||
ReadHeader: 5 * time.Second,
|
||||
Shutdown: 250 * time.Millisecond,
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user