Documentation
¶
Overview ¶
This file contains the common plugin processing logic for XRP. It provides a generic framework for processing any document type (HTML, XML) with plugins while maintaining type safety and consistent error handling.
Package proxy implements the core HTTP reverse proxy functionality for XRP.
This package provides an HTTP-aware reverse proxy that can intercept and modify HTML and XML responses using a plugin system. The proxy supports:
- Intelligent Redis-based caching with HTTP compliance - Plugin-based content modification for HTML/XML responses - Request/response size validation and security controls - Version headers and cache status reporting - Configuration hot-reloading and graceful error handling
The proxy works by intercepting HTTP responses, checking if they contain HTML or XML content that should be processed, parsing the content into a document tree, running configured plugins against the tree, and then serializing the modified content back to the response.
Example usage:
proxy, err := proxy.New(config, "v1.0.0") if err != nil { log.Fatal(err) } http.ListenAndServe(":8080", proxy)
The proxy automatically adds X-XRP-Version and X-XRP-Cache headers to all responses to indicate processing status and enable monitoring.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ParserFunc ¶
ParserFunc defines a function that parses body bytes into a document
type ProcessorFunc ¶
type ProcessorFunc func(plugin *plugins.LoadedPlugin, ctx context.Context, url *url.URL, document interface{}) error
ProcessorFunc defines a function that processes a document with a plugin
type RendererFunc ¶
RendererFunc defines a function that renders a document back to bytes