{"modulePath":"github.com/adiom-data/framework","version":"v0.0.0-20261126062518-b2853e86f00e","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httpserver\n\n## Constants\n\n```go\nconst (\n\t// LivenessService is the Kubernetes gRPC health service label for liveness.\n\tLivenessService = \"liveness\"\n\t// ReadinessService is the Kubernetes gRPC health service label for readiness.\n\tReadinessService = \"readiness\"\n)\n```\n\n```go\nconst (\n\t// DefaultAddr is the default listen address for internal services.\n\tDefaultAddr = \":8080\"\n)\n```\n\n## Functions\n\n```go\nfunc RegisterConnect(mux *http.ServeMux, services ...ConnectService)\n```\nRegisterConnect mounts Connect services on mux.\n\n```go\nfunc RegisterHealth(mux *http.ServeMux, health Health)\n```\nRegisterHealth mounts the standard gRPC health service on mux.\n\n```go\nfunc RegisterReflection(mux *http.ServeMux, serviceNames ...string)\n```\nRegisterReflection mounts explicit Connect reflection handlers on mux.\n\n```go\nfunc ServiceNames(services ...ConnectService) []string\n```\nServiceNames returns the service names for registration with reflection or health.\n\n```go\nfunc SignalContext(parent context.Context) (context.Context, context.CancelFunc)\n```\nSignalContext returns a context canceled on SIGINT or SIGTERM.\n\n## Types\n\n```go\ntype Check func(context.Context) error\n```\nCheck is a health dependency check.\n\n```go\nfunc LivenessCheck(fn func(context.Context) error) Check\n```\nLivenessCheck adapts fn into a liveness check.\n\n```go\nfunc ReadinessCheck(fn func(context.Context) error) Check\n```\nReadinessCheck adapts fn into a readiness check.\n\n```go\ntype ConnectService struct {\n\tName    string\n\tPath    string\n\tHandler http.Handler\n}\n```\nConnectService describes a generated Connect handler mounted on an HTTP mux.\n\n```go\nfunc Connect(name, path string, handler http.Handler) ConnectService\n```\nConnect builds a ConnectService from a generated service name, path, and handler.\n\n```go\ntype Health struct {\n\tEnabled         bool\n\tLivenessChecks  []Check\n\tReadinessChecks []Check\n\tServiceNames    []string\n}\n```\nHealth configures the standard gRPC health service.\n\n```go\ntype Protocols int\n```\nProtocols selects the HTTP protocols accepted by a server.\n\n```go\nconst (\n\t// ProtocolsInternalCleartext serves HTTP/1 and unencrypted HTTP/2.\n\tProtocolsInternalCleartext Protocols = iota\n\t// ProtocolsTLS serves HTTP/1 and HTTP/2 over TLS.\n\tProtocolsTLS\n\t// ProtocolsHTTP1Only serves only HTTP/1.\n\tProtocolsHTTP1Only\n)\n```\n\n```go\ntype Server struct {\n\tAddr              string\n\tHandler           http.Handler\n\tReadHeaderTimeout time.Duration\n\tIdleTimeout       time.Duration\n\tShutdownTimeout   time.Duration\n\tProtocols         Protocols\n\tTLSConfig         *tls.Config\n\tTLSCertFile       string\n\tTLSKeyFile        string\n\tLogger            *slog.Logger\n\tOnShutdown        func()\n}\n```\nServer runs an http.Handler with common lifecycle defaults.\n\n```go\nfunc (s Server) Run(ctx context.Context) error\n```\nRun starts the server and gracefully shuts it down when ctx is canceled.\n\n","path":"github.com/adiom-data/framework/httpserver","name":"httpserver","synopsis":"","isRedistributable":true}
