1234567891011121314151617181920212223242526272829 |
- package server
- import (
- "context"
- "time"
- )
- type Config struct {
- BindAddress string
- RemoteAddress string
- Timeout time.Duration
- IdleTimeout time.Duration
- BaseContext context.Context
- PSKCallback func([]byte) ([]byte, error)
- MTU int
- }
- func (cfg *Config) populateDefaults() *Config {
- newCfg := new(Config)
- *newCfg = *cfg
- cfg = newCfg
- if cfg.BaseContext == nil {
- cfg.BaseContext = context.Background()
- }
- if cfg.IdleTimeout == 0 {
- cfg.IdleTimeout = 90 * time.Second
- }
- return cfg
- }
|