Documentation
¶
Overview ¶
Package http implements the RoadRunner HTTP plugin, orchestrating HTTP/HTTPS/HTTP3/FastCGI servers and PHP worker pools to serve PSR-7-compatible requests.
Index ¶
- Constants
- type Informer
- type Plugin
- func (p *Plugin) AddWorker() error
- func (p *Plugin) Collects() []*dep.In
- func (p *Plugin) Init(cfg api.Configurer, log api.Logger, srv api.Server) error
- func (p *Plugin) MetricsCollector() []prometheus.Collector
- func (p *Plugin) Name() string
- func (p *Plugin) Ready() (*status.Status, error)
- func (p *Plugin) RemoveWorker(ctx context.Context) error
- func (p *Plugin) Reset() error
- func (p *Plugin) Serve() chan error
- func (p *Plugin) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (p *Plugin) Status() (*status.Status, error)
- func (p *Plugin) Stop(ctx context.Context) error
- func (p *Plugin) Workers() []*process.State
- type StatsExporter
- type StdLogAdapter
Constants ¶
const ( // PluginName declares plugin name. PluginName = "http" MB uint64 = 1024 * 1024 // RrMode RR_HTTP env variable key (internal) if the HTTP presents RrMode = "RR_MODE" RrModeHTTP = "http" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin manages pool, http servers. The main http plugin structure
func (*Plugin) Init ¶
Init must return configure svc and return true if svc hasStatus enabled. Must return error in case of misconfiguration. Services must not be used without proper configuration pushed first.
func (*Plugin) MetricsCollector ¶
func (p *Plugin) MetricsCollector() []prometheus.Collector
func (*Plugin) Reset ¶
Reset destroys the old pool and replaces it with new one, waiting for old pool to die
func (*Plugin) ServeHTTP ¶
func (p *Plugin) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles connection using set of middleware and pool PSR-7 server.
type StatsExporter ¶
type StatsExporter struct {
TotalMemoryDesc *prometheus.Desc
StateDesc *prometheus.Desc
WorkerMemoryDesc *prometheus.Desc
TotalWorkersDesc *prometheus.Desc
WorkersReady *prometheus.Desc
WorkersWorking *prometheus.Desc
WorkersInvalid *prometheus.Desc
Workers Informer
}
func (*StatsExporter) Collect ¶
func (s *StatsExporter) Collect(ch chan<- prometheus.Metric)
func (*StatsExporter) Describe ¶
func (s *StatsExporter) Describe(d chan<- *prometheus.Desc)
type StdLogAdapter ¶
type StdLogAdapter struct {
// contains filtered or unexported fields
}
StdLogAdapter can be passed to the http.Server or any place which required standard logger to redirect output to the logger plugin
func NewStdAdapter ¶
func NewStdAdapter(log *zap.Logger) *StdLogAdapter
NewStdAdapter constructs StdLogAdapter
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acme provides automatic TLS certificate issuance and management via Let's Encrypt using the ACME protocol.
|
Package acme provides automatic TLS certificate issuance and management via Let's Encrypt using the ACME protocol. |
|
Package api defines the core interfaces shared across the HTTP plugin, including worker pool, server, middleware, configuration, and logger contracts.
|
Package api defines the core interfaces shared across the HTTP plugin, including worker pool, server, middleware, configuration, and logger contracts. |
|
Package attributes manages PSR-7-style request attributes stored in the request context, enabling data passing from Go middleware to PHP workers.
|
Package attributes manages PSR-7-style request attributes stored in the request context, enabling data passing from Go middleware to PHP workers. |
|
Package config defines the configuration structures for the HTTP plugin, covering server addresses, TLS, FastCGI, HTTP2/3, upload handling, and worker pool settings.
|
Package config defines the configuration structures for the HTTP plugin, covering server addresses, TLS, FastCGI, HTTP2/3, upload handling, and worker pool settings. |
|
Package handler transforms incoming HTTP requests into PSR-7-compatible protobuf payloads, dispatches them to PHP workers, and writes back responses.
|
Package handler transforms incoming HTTP requests into PSR-7-compatible protobuf payloads, dispatches them to PHP workers, and writes back responses. |
|
Package middleware provides built-in HTTP middleware for request size limiting, HTTP-to-HTTPS redirection, and access logging.
|
Package middleware provides built-in HTTP middleware for request size limiting, HTTP-to-HTTPS redirection, and access logging. |
|
Package servers defines the internal interface for starting and stopping the various HTTP server implementations.
|
Package servers defines the internal interface for starting and stopping the various HTTP server implementations. |
|
fcgi
Package fcgi implements a FastCGI server that serves HTTP requests over the FastCGI protocol.
|
Package fcgi implements a FastCGI server that serves HTTP requests over the FastCGI protocol. |
|
http11
Package http implements a plain HTTP/1.1 server with optional h2c (HTTP/2 cleartext) support.
|
Package http implements a plain HTTP/1.1 server with optional h2c (HTTP/2 cleartext) support. |
|
http3
Package http3 implements an experimental HTTP/3 server using QUIC with TLS and optional ACME certificate support.
|
Package http3 implements an experimental HTTP/3 server using QUIC with TLS and optional ACME certificate support. |
|
https
Package https implements an HTTPS server with TLS, optional mutual TLS client authentication, HTTP/2, and ACME certificate automation.
|
Package https implements an HTTPS server with TLS, optional mutual TLS client authentication, HTTP/2, and ACME certificate automation. |
|
Package tlsconf provides a secure default TLS configuration with hardware-aware cipher suite selection.
|
Package tlsconf provides a secure default TLS configuration with hardware-aware cipher suite selection. |