graph LR
AddonManager["AddonManager"]
EventDispatcher["EventDispatcher"]
AddonInvoker["AddonInvoker"]
SafeExecutor["SafeExecutor"]
RequestModifier["RequestModifier"]
ResponseModifier["ResponseModifier"]
OverrideMatcher["OverrideMatcher"]
AddonManager -- "orchestrates" --> EventDispatcher
EventDispatcher -- "invokes" --> AddonInvoker
AddonInvoker -- "uses" --> SafeExecutor
RequestModifier -- "consults" --> OverrideMatcher
ResponseModifier -- "consults" --> OverrideMatcher
The Traffic Modification & Extensibility subsystem is responsible for managing and applying user-defined interception logic (addons) to modify intercepted requests and responses, leveraging mitmproxy's addon framework.
The primary interface for users to register, add, remove, and manage custom interception logic (addons). It acts as the central registry for all active addons, orchestrating their lifecycle and event handling.
Related Classes/Methods:
Dispatches specific network events (e.g., request, response, error) to all registered addons, ensuring their corresponding handler methods are invoked. This is crucial for implementing the Interceptor Pattern.
Related Classes/Methods:
Encapsulates the logic for executing a specific method on a given addon. It acts as an intermediary to ensure proper execution flow and separation of concerns.
Related Classes/Methods:
Provides a robust execution context for addon methods, catching and handling exceptions to prevent a single faulty addon from disrupting the entire proxy operation. This ensures the stability and reliability of the library.
Related Classes/Methods:
Applies predefined and user-defined modifications to outgoing HTTP requests. This component implements the concrete interception logic for requests, allowing for dynamic alteration of request properties.
Related Classes/Methods:
Applies predefined and user-defined modifications to incoming HTTP responses. This component handles the concrete interception logic for responses, enabling manipulation of response content or headers.
Related Classes/Methods:
Identifies and filters the relevant modification rules or overrides that apply to a given request or response based on specified criteria (e.g., URL patterns, headers). It acts as a decision-making component for applying specific modifications.
Related Classes/Methods: