| 16 | |
| 17 | type Middleware func(string, http.Handler) http.Handler |
| 18 | type HTTP struct { |
| 19 | ListenAddr string `desc:"监听地址"` |
| 20 | ListenAddrTLS string `desc:"监听地址HTTPS"` |
| 21 | CertFile string `desc:"HTTPS证书文件"` |
| 22 | KeyFile string `desc:"HTTPS密钥文件"` |
| 23 | CORS bool `default:"true" desc:"是否自动添加CORS头"` //是否自动添加CORS头 |
| 24 | UserName string `desc:"基本身份认证用户名"` |
| 25 | Password string `desc:"基本身份认证密码"` |
| 26 | ReadTimeout time.Duration `desc:"读取超时"` |
| 27 | WriteTimeout time.Duration `desc:"写入超时"` |
| 28 | IdleTimeout time.Duration `desc:"空闲超时"` |
| 29 | mux *http.ServeMux |
| 30 | middlewares []Middleware |
| 31 | } |
| 32 | type HTTPConfig interface { |
| 33 | GetHTTPConfig() *HTTP |
| 34 | Listen(ctx context.Context) error |
nothing calls this directly
no outgoing calls
no test coverage detected