27 lines
553 B
Go
27 lines
553 B
Go
package conf
|
|
|
|
import "time"
|
|
|
|
type ListenYaml struct {
|
|
Web string `yaml:"web"`
|
|
ReadTimeout time.Duration `yaml:"readTimeout"`
|
|
WriteTimeout time.Duration `yaml:"writeTimeout"`
|
|
Identify bool `yaml:"identify"`
|
|
}
|
|
|
|
func (ly ListenYaml) GetReadTimeout() time.Duration {
|
|
if ly.ReadTimeout.Seconds() < 1 {
|
|
return 1 * time.Second
|
|
} else {
|
|
return ly.ReadTimeout
|
|
}
|
|
}
|
|
|
|
func (ly ListenYaml) GetWriteTimeout() time.Duration {
|
|
if ly.WriteTimeout.Seconds() < 1 {
|
|
return 1 * time.Second
|
|
} else {
|
|
return ly.WriteTimeout
|
|
}
|
|
}
|