pub struct ProxyConfig {
pub enabled: bool,
pub target_url: Option<String>,
pub timeout_seconds: u64,
pub follow_redirects: bool,
pub headers: HashMap<String, String>,
pub prefix: Option<String>,
pub passthrough_by_default: bool,
pub rules: Vec<ProxyRule>,
pub migration_enabled: bool,
pub migration_groups: HashMap<String, MigrationMode>,
pub request_replacements: Vec<BodyTransformRule>,
pub response_replacements: Vec<BodyTransformRule>,
}Will be extracted to mockforge-proxy crate
Expand description
Configuration for proxy behavior
Fieldsยง
ยงenabled: boolWill be extracted to mockforge-proxy crate
Whether the proxy is enabled
target_url: Option<String>Will be extracted to mockforge-proxy crate
Target URL to proxy requests to
timeout_seconds: u64Will be extracted to mockforge-proxy crate
Timeout for proxy requests in seconds
follow_redirects: boolWill be extracted to mockforge-proxy crate
Whether to follow redirects
headers: HashMap<String, String>Will be extracted to mockforge-proxy crate
Additional headers to add to proxied requests
prefix: Option<String>Will be extracted to mockforge-proxy crate
Proxy prefix to strip from paths
passthrough_by_default: boolWill be extracted to mockforge-proxy crate
Whether to proxy by default
rules: Vec<ProxyRule>Will be extracted to mockforge-proxy crate
Proxy rules
migration_enabled: boolWill be extracted to mockforge-proxy crate
Whether migration features are enabled
migration_groups: HashMap<String, MigrationMode>Will be extracted to mockforge-proxy crate
Group-level migration mode overrides Maps group name to migration mode
request_replacements: Vec<BodyTransformRule>Will be extracted to mockforge-proxy crate
Request body replacement rules for browser proxy mode
response_replacements: Vec<BodyTransformRule>Will be extracted to mockforge-proxy crate
Response body replacement rules for browser proxy mode
Implementationsยง
Sourceยงimpl ProxyConfig
impl ProxyConfig
Sourcepub fn new(upstream_url: String) -> Self
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn new(upstream_url: String) -> Self
Will be extracted to mockforge-proxy crate
Create a new proxy configuration
Sourcepub fn get_effective_migration_mode(&self, path: &str) -> Option<MigrationMode>
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn get_effective_migration_mode(&self, path: &str) -> Option<MigrationMode>
Will be extracted to mockforge-proxy crate
Get the effective migration mode for a path Checks group overrides first, then route-specific mode
Sourcepub fn should_proxy(&self, _method: &Method, path: &str) -> bool
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn should_proxy(&self, _method: &Method, path: &str) -> bool
Will be extracted to mockforge-proxy crate
Check if a request should be proxied Respects migration mode: mock forces mock, real forces proxy, shadow forces proxy, auto uses existing logic This is a legacy method that doesnโt evaluate conditions - use should_proxy_with_condition for conditional proxying
Sourcepub fn should_proxy_with_condition(
&self,
method: &Method,
uri: &Uri,
headers: &HeaderMap,
body: Option<&[u8]>,
) -> bool
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn should_proxy_with_condition( &self, method: &Method, uri: &Uri, headers: &HeaderMap, body: Option<&[u8]>, ) -> bool
Will be extracted to mockforge-proxy crate
Check if a request should be proxied with conditional evaluation This method evaluates conditions in proxy rules using request context
Sourcepub fn should_shadow(&self, path: &str) -> bool
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn should_shadow(&self, path: &str) -> bool
Will be extracted to mockforge-proxy crate
Check if a route should use shadow mode (proxy + generate mock)
Sourcepub fn get_upstream_url(&self, path: &str) -> String
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn get_upstream_url(&self, path: &str) -> String
Will be extracted to mockforge-proxy crate
Get the upstream URL for a specific path
Sourcepub fn strip_prefix(&self, path: &str) -> String
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn strip_prefix(&self, path: &str) -> String
Will be extracted to mockforge-proxy crate
Strip the proxy prefix from a path
Sourcepub fn update_rule_migration_mode(
&mut self,
pattern: &str,
mode: MigrationMode,
) -> bool
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn update_rule_migration_mode( &mut self, pattern: &str, mode: MigrationMode, ) -> bool
Will be extracted to mockforge-proxy crate
Update migration mode for a specific route pattern Returns true if the rule was found and updated
Sourcepub fn update_group_migration_mode(&mut self, group: &str, mode: MigrationMode)
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn update_group_migration_mode(&mut self, group: &str, mode: MigrationMode)
Will be extracted to mockforge-proxy crate
Update migration mode for an entire group This affects all routes that belong to the group
Sourcepub fn toggle_route_migration(&mut self, pattern: &str) -> Option<MigrationMode>
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn toggle_route_migration(&mut self, pattern: &str) -> Option<MigrationMode>
Will be extracted to mockforge-proxy crate
Toggle a routeโs migration mode through the stages: mock โ shadow โ real โ mock Returns the new mode if the rule was found
Sourcepub fn toggle_group_migration(&mut self, group: &str) -> MigrationMode
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn toggle_group_migration(&mut self, group: &str) -> MigrationMode
Will be extracted to mockforge-proxy crate
Toggle a groupโs migration mode through the stages: mock โ shadow โ real โ mock Returns the new mode
Sourcepub fn get_migration_routes(&self) -> Vec<MigrationRouteInfo>
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn get_migration_routes(&self) -> Vec<MigrationRouteInfo>
Will be extracted to mockforge-proxy crate
Get all routes with their migration status
Sourcepub fn get_migration_groups(&self) -> HashMap<String, MigrationGroupInfo>
๐Deprecated: Will be extracted to mockforge-proxy crate
pub fn get_migration_groups(&self) -> HashMap<String, MigrationGroupInfo>
Will be extracted to mockforge-proxy crate
Get all migration groups with their status
Trait Implementationsยง
Sourceยงimpl Clone for ProxyConfig
impl Clone for ProxyConfig
Sourceยงfn clone(&self) -> ProxyConfig
fn clone(&self) -> ProxyConfig
1.0.0 ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSourceยงimpl Debug for ProxyConfig
impl Debug for ProxyConfig
Sourceยงimpl Default for ProxyConfig
impl Default for ProxyConfig
Sourceยงimpl<'de> Deserialize<'de> for ProxyConfig
impl<'de> Deserialize<'de> for ProxyConfig
Sourceยงfn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Sourceยงimpl JsonSchema for ProxyConfig
impl JsonSchema for ProxyConfig
Sourceยงfn schema_name() -> String
fn schema_name() -> String
Sourceยงfn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Sourceยงfn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Sourceยงfn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreAuto Trait Implementationsยง
impl Freeze for ProxyConfig
impl RefUnwindSafe for ProxyConfig
impl Send for ProxyConfig
impl Sync for ProxyConfig
impl Unpin for ProxyConfig
impl UnsafeUnpin for ProxyConfig
impl UnwindSafe for ProxyConfig
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Sourceยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more