{"modulePath":"github.com/mutablelogic/go-server","version":"v1.6.0","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httpserver\n\n## Constants\n\n```go\nconst (\n\tPemTypePrivateKey  = \"PRIVATE KEY\"\n\tPemTypeCertificate = \"CERTIFICATE\"\n)\n```\n\n## Functions\n\n```go\nfunc ListenAddr(listen string, tls bool) string\n```\nListenAddr resolves a listen address string into a host:port pair, applying defaults for missing host or port. When tls is true the default port is \"https\" (443); otherwise it is \"http\" (80).\n\n```go\nfunc New(listen string, router http.Handler, cert *tls.Config, opts ...Opt) (*server, error)\n```\n\n```go\nfunc TLSConfig(name string, verify bool, data ...[]byte) (*tls.Config, error)\n```\nTLSConfig creates a [tls.Config](/crypto/tls#Config) from raw PEM-encoded certificate and key data. The data slices may each contain a single PEM block, or they may be concatenated (cert + key in one slice). name sets the ServerName field; when verify is false, client certificate verification is skipped.\n\n```go\nfunc ValidateCert(cert, key []byte) error\n```\nValidateCert checks that the given PEM-encoded certificate and key form a valid key pair and that the leaf certificate has not expired. It is intended for use at plan time to catch configuration errors before Apply.\n\n## Types\n\n```go\ntype Opt func(*opt) error\n```\n\n```go\nfunc WithIdleTimeout(v time.Duration) Opt\n```\nSet the idle timeout for keep-alive connections\n\n```go\nfunc WithReadTimeout(v time.Duration) Opt\n```\nSet the read timeout for the HTTP server\n\n```go\nfunc WithWriteTimeout(v time.Duration) Opt\n```\nSet the write timeout for the HTTP server\n\n","path":"github.com/mutablelogic/go-server/pkg/httpserver","name":"httpserver","synopsis":"","isRedistributable":true}
