Skip to main content

Crate pingap_core

Crate pingap_core 

Source

Structs§

BackgroundTaskService
A unified background service runner that can handle one or more named tasks.
CacheInfo
All cache-related configuration and statistics for a request.
CompressionStat
Statistics about response compression operations.
ConnectionInfo
Information about a single client connection.
Ctx
Represents the state of a request/response cycle, tracking various metrics and properties including connection details, caching information, and upstream server interactions.
DigestDetail
Helper struct to store connection timing and TLS details
Features
Optional features like tracing, plugins, and response modifications.
Guard
A Guard is returned when an Inflight key is incremented via Inflight::incr.
HttpChunkResponse
Represents a chunked HTTP response for streaming large bodies of data.
HttpResponse
Represents a complete HTTP response, including status, headers, and a body. This struct is used for responses where the entire body is known upfront.
HttpResponseBuilder
A builder for creating HttpResponse instances fluently using the builder pattern.
Inflight
An Inflight type tracks the frequency of actions that are actively occurring. When the value is dropped from scope, the count will automatically decrease.
NotificationData
Rate
A stable rate estimator that reports the rate of events per period of interval time.
RequestState
State related to the current request being processed.
Timing
All timing-related metrics for the request lifecycle.
TinyUfo
TinyUfo cache
TtlLruLimit
UpstreamInfo
Information about the upstream (backend) server.

Enums§

Error
ModifiedMode
NotificationLevel
PluginStep
RequestPluginResult
A more expressive return type for handle_request. It clearly states the plugin’s decision.
ResponseBodyPluginResult
ResponsePluginResult
Represents the action a plugin takes on a response.

Constants§

HOST_NAME_TAG

Statics§

HTTP_HEADER_CONTENT_HTML
HTTP_HEADER_CONTENT_JSON
HTTP_HEADER_CONTENT_TEXT
HTTP_HEADER_NAME_X_REQUEST_ID
HTTP_HEADER_NO_CACHE
HTTP_HEADER_NO_STORE
HTTP_HEADER_TRANSFER_CHUNKED

Traits§

BackgroundTask
A unified trait for any task that can be run in the background.
LocationInstance
Trait for location instance
ModifyResponseBody
Trait for modifying the response body.
Notification
Trait for sending notifications
Plugin
Core trait that defines the interface all plugins must implement.
PluginProvider
Plugin provider trait
UpstreamInstance
Trait for upstream instance, used to handle the upstream instance lifecycle.

Functions§

constant_time_eq
Compares two byte slices in constant time relative to their length, avoiding the early exit of == that can leak (via timing) how many leading bytes matched. Use it for verifying secrets, MACs and signatures. The slice lengths are not treated as secret and are compared up front.
convert_header
Converts a single string in “name: value” format into an HttpHeader tuple.
convert_header_value
Processes a HeaderValue that may contain a special dynamic variable (e.g., $host). It replaces the variable with its corresponding runtime value.
convert_headers
Converts a slice of strings into a Vec of HttpHeaders.
ensure_client_ip
Ensures ctx.conn.client_ip is populated and returns a borrowed reference.
format_duration
Format the duration in human readable format, checking smaller units first. e.g., ms, s, m, h.
get_cache_key
Generates a cache key from the request method, URI and state context. The key includes an optional namespace and other key components if configured in the context.
get_client_ip
Gets the client’s IP address.
get_cookie_value
Parses the “Cookie” header to find the value of a specific cookie.
get_digest_detail
Extracts timing and TLS information from connection digest. Used for metrics and logging connection details.
get_host
Gets the request host by checking the URI first, then falling back to the “Host” header.
get_hostname
Returns the system hostname.
get_query_value
Gets the value of a specific query parameter from the request URI.
get_remote_addr
Gets the remote address (IP and port) from the session.
get_req_header_value
A convenient helper to get a header value as a &str from a RequestHeader.
get_super_ts
Returns the number of seconds elapsed since SUPER_TIMESTAMP Returns 0 if the current time is before SUPER_TIMESTAMP
new_internal_error
Creates a new internal error
now_ms
Returns the number of milliseconds since the epoch
now_sec
Returns the number of seconds since the epoch
remove_query_from_header
Removes a specific query parameter from the request header’s URI.
set_trusted_proxies
Sets the trusted downstream proxy addresses (individual IPs or CIDR ranges).

Type Aliases§

HttpHeader
A type alias for a tuple representing an HTTP header.
NamedPlugin
A plugin paired with the name it was registered under in the location config.
NotificationSender
Type alias for a boxed Notification trait object that can be shared between threads
Plugins