| 12345678910111213141516171819202122232425262728293031323334353637383940414243 | 
							- package server
 
- import (
 
- 	"context"
 
- 	"time"
 
- 	"github.com/Snawoot/dtlspipe/ciphers"
 
- 	"github.com/Snawoot/dtlspipe/util"
 
- )
 
- type Config struct {
 
- 	BindAddress     string
 
- 	RemoteAddress   string
 
- 	Timeout         time.Duration
 
- 	IdleTimeout     time.Duration
 
- 	BaseContext     context.Context
 
- 	PSKCallback     func([]byte) ([]byte, error)
 
- 	MTU             int
 
- 	SkipHelloVerify bool
 
- 	CipherSuites    ciphers.CipherList
 
- 	EllipticCurves  ciphers.CurveList
 
- 	StaleMode       util.StaleMode
 
- 	TimeLimit       time.Duration
 
- }
 
- 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
 
- 	}
 
- 	if cfg.CipherSuites == nil {
 
- 		cfg.CipherSuites = ciphers.DefaultCipherList
 
- 	}
 
- 	if cfg.EllipticCurves == nil {
 
- 		cfg.EllipticCurves = ciphers.DefaultCurveList
 
- 	}
 
- 	return cfg
 
- }
 
 
  |