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>,
}Use mockforge_proxy crate directly
Expand description
Configuration for proxy behavior
Fieldsยง
ยงenabled: boolUse mockforge_proxy crate directly
Whether the proxy is enabled
target_url: Option<String>Use mockforge_proxy crate directly
Target URL to proxy requests to
timeout_seconds: u64Use mockforge_proxy crate directly
Timeout for proxy requests in seconds
follow_redirects: boolUse mockforge_proxy crate directly
Whether to follow redirects
headers: HashMap<String, String>Use mockforge_proxy crate directly
Additional headers to add to proxied requests
prefix: Option<String>Use mockforge_proxy crate directly
Proxy prefix to strip from paths
passthrough_by_default: boolUse mockforge_proxy crate directly
Whether to proxy by default
rules: Vec<ProxyRule>Use mockforge_proxy crate directly
Proxy rules
migration_enabled: boolUse mockforge_proxy crate directly
Whether migration features are enabled
migration_groups: HashMap<String, MigrationMode>Use mockforge_proxy crate directly
Group-level migration mode overrides Maps group name to migration mode
request_replacements: Vec<BodyTransformRule>Use mockforge_proxy crate directly
Request body replacement rules for browser proxy mode
response_replacements: Vec<BodyTransformRule>Use mockforge_proxy crate directly
Response body replacement rules for browser proxy mode
Implementationsยง
Sourceยงimpl ProxyConfig
impl ProxyConfig
Sourcepub fn new(upstream_url: String) -> Self
๐Deprecated: Use mockforge_proxy crate directly
pub fn new(upstream_url: String) -> Self
Use mockforge_proxy crate directly
Create a new proxy configuration
Sourcepub fn get_effective_migration_mode(&self, path: &str) -> Option<MigrationMode>
๐Deprecated: Use mockforge_proxy crate directly
pub fn get_effective_migration_mode(&self, path: &str) -> Option<MigrationMode>
Use mockforge_proxy crate directly
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: Use mockforge_proxy crate directly
pub fn should_proxy(&self, _method: &Method, path: &str) -> bool
Use mockforge_proxy crate directly
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: Use mockforge_proxy crate directly
pub fn should_proxy_with_condition( &self, method: &Method, uri: &Uri, headers: &HeaderMap, body: Option<&[u8]>, ) -> bool
Use mockforge_proxy crate directly
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: Use mockforge_proxy crate directly
pub fn should_shadow(&self, path: &str) -> bool
Use mockforge_proxy crate directly
Check if a route should use shadow mode (proxy + generate mock)
Sourcepub fn get_upstream_url(&self, path: &str) -> String
๐Deprecated: Use mockforge_proxy crate directly
pub fn get_upstream_url(&self, path: &str) -> String
Use mockforge_proxy crate directly
Get the upstream URL for a specific path
Sourcepub fn strip_prefix(&self, path: &str) -> String
๐Deprecated: Use mockforge_proxy crate directly
pub fn strip_prefix(&self, path: &str) -> String
Use mockforge_proxy crate directly
Strip the proxy prefix from a path
Sourcepub fn update_rule_migration_mode(
&mut self,
pattern: &str,
mode: MigrationMode,
) -> bool
๐Deprecated: Use mockforge_proxy crate directly
pub fn update_rule_migration_mode( &mut self, pattern: &str, mode: MigrationMode, ) -> bool
Use mockforge_proxy crate directly
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: Use mockforge_proxy crate directly
pub fn update_group_migration_mode(&mut self, group: &str, mode: MigrationMode)
Use mockforge_proxy crate directly
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: Use mockforge_proxy crate directly
pub fn toggle_route_migration(&mut self, pattern: &str) -> Option<MigrationMode>
Use mockforge_proxy crate directly
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: Use mockforge_proxy crate directly
pub fn toggle_group_migration(&mut self, group: &str) -> MigrationMode
Use mockforge_proxy crate directly
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: Use mockforge_proxy crate directly
pub fn get_migration_routes(&self) -> Vec<MigrationRouteInfo>
Use mockforge_proxy crate directly
Get all routes with their migration status
Sourcepub fn get_migration_groups(&self) -> HashMap<String, MigrationGroupInfo>
๐Deprecated: Use mockforge_proxy crate directly
pub fn get_migration_groups(&self) -> HashMap<String, MigrationGroupInfo>
Use mockforge_proxy crate directly
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