Documentation
¶
Index ¶
- Variables
- type HTTPClientOptions
- type MrokiGate
- func (MrokiGate) CaddyModule() caddy.ModuleInfo
- func (m *MrokiGate) Provision(ctx caddy.Context) error
- func (m MrokiGate) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error
- func (m *MrokiGate) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (m *MrokiGate) Validate() error
Constants ¶
This section is empty.
Variables ¶
var ( ErrRequiredLiveURL = errors.New("live URL is required") ErrRequiredShadowURL = errors.New("shadow URL is required") )
Functions ¶
This section is empty.
Types ¶
type HTTPClientOptions ¶ added in v1.6.0
type HTTPClientOptions struct {
RawMaxIdleConns *string `json:"max_idle_conns,omitempty"`
RawMaxIdleConnsPerHost *string `json:"max_idle_conns_per_host,omitempty"`
RawMaxConnsPerHost *string `json:"max_conns_per_host,omitempty"`
RawIdleConnTimeout *string `json:"idle_conn_timeout,omitempty"`
}
HTTPClientOptions holds the raw, unparsed outbound connection-pool directives from the http_client block. Values are parsed and validated in buildHTTPClientConfig; a value of 0 follows net/http semantics (no limit, or no timeout for idle_conn_timeout).
type MrokiGate ¶
type MrokiGate struct {
// Required
RawLive string `json:"live,omitempty"`
RawShadow string `json:"shadow,omitempty"`
// Proxy options
SamplingRate *string `json:"sampling_rate,omitempty"`
RawLiveTimeout *string `json:"live_timeout,omitempty"`
RawShadowTimeout *string `json:"shadow_timeout,omitempty"`
RawMaxBodySize *string `json:"max_body_size,omitempty"`
RawShadowRules *string `json:"shadow_rules,omitempty"`
// RawMaxConcurrentCallbacks bounds concurrent background callback
// goroutines (0 = unbounded). A nil pointer means the module default
// (defaultMaxConcurrentCallbacks) applies.
RawMaxConcurrentCallbacks *string `json:"max_concurrent_callbacks,omitempty"`
// Outbound HTTP client connection-pool tuning (optional). Grouped under the
// http_client block to mirror the proxy binary's MROKI_APP_HTTP_CLIENT_*
// env namespace. A nil pointer means the module defaults apply.
HTTPClient *HTTPClientOptions `json:"http_client,omitempty"`
// Diff options
DiffIgnoredFields *string `json:"diff_ignored_fields,omitempty"`
DiffIncludedFields *string `json:"diff_included_fields,omitempty"`
DiffFloatTolerance *string `json:"diff_float_tolerance,omitempty"`
DiffSortArrays *string `json:"diff_sort_arrays,omitempty"`
// Redaction options
RedactedFields *string `json:"redacted_fields,omitempty"`
// contains filtered or unexported fields
}
func (MrokiGate) CaddyModule ¶
func (MrokiGate) CaddyModule() caddy.ModuleInfo
func (MrokiGate) ServeHTTP ¶
ServeHTTP is a terminating handler — it writes the full live response via proxy.ServeHTTP, then fires shadow async. next is intentionally not called because the response is already written.
func (*MrokiGate) UnmarshalCaddyfile ¶
UnmarshalCaddyfile parses the Caddyfile tokens into the MrokiGate struct. It expects the following format:
mroki_gate {
live <url>
shadow <url>
[sampling_rate <float>]
[live_timeout <duration>]
[shadow_timeout <duration>]
[max_body_size <bytes>]
[shadow_rules <comma-separated ACTION METHOD:path>]
[max_concurrent_callbacks <int>]
[http_client {
[max_idle_conns <int>]
[max_idle_conns_per_host <int>]
[max_conns_per_host <int>]
[idle_conn_timeout <duration>]
}]
[diff_ignored_fields <comma-separated>]
[diff_included_fields <comma-separated>]
[diff_float_tolerance <float>]
[diff_sort_arrays <bool>]
[redacted_fields <comma-separated>]
}