Skip to main content

ProxyConfig

Struct ProxyConfig 

Source
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>,
}
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Expand description

Configuration for proxy behavior

Fieldsยง

ยงenabled: bool
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Whether the proxy is enabled

ยงtarget_url: Option<String>
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Target URL to proxy requests to

ยงtimeout_seconds: u64
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Timeout for proxy requests in seconds

ยงfollow_redirects: bool
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Whether to follow redirects

ยงheaders: HashMap<String, String>
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Additional headers to add to proxied requests

ยงprefix: Option<String>
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Proxy prefix to strip from paths

ยงpassthrough_by_default: bool
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Whether to proxy by default

ยงrules: Vec<ProxyRule>
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Proxy rules

ยงmigration_enabled: bool
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Whether migration features are enabled

ยงmigration_groups: HashMap<String, MigrationMode>
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Group-level migration mode overrides Maps group name to migration mode

ยงrequest_replacements: Vec<BodyTransformRule>
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Request body replacement rules for browser proxy mode

ยงresponse_replacements: Vec<BodyTransformRule>
๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Response body replacement rules for browser proxy mode

Implementationsยง

Sourceยง

impl ProxyConfig

Source

pub fn new(upstream_url: String) -> Self

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Create a new proxy configuration

Source

pub fn get_effective_migration_mode(&self, path: &str) -> Option<MigrationMode>

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Get the effective migration mode for a path Checks group overrides first, then route-specific mode

Source

pub fn should_proxy(&self, _method: &Method, path: &str) -> bool

๐Ÿ‘ŽDeprecated:

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

Source

pub fn should_proxy_with_condition( &self, method: &Method, uri: &Uri, headers: &HeaderMap, body: Option<&[u8]>, ) -> bool

๐Ÿ‘ŽDeprecated:

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

Source

pub fn should_shadow(&self, path: &str) -> bool

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Check if a route should use shadow mode (proxy + generate mock)

Source

pub fn get_upstream_url(&self, path: &str) -> String

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Get the upstream URL for a specific path

Source

pub fn strip_prefix(&self, path: &str) -> String

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Strip the proxy prefix from a path

Source

pub fn update_rule_migration_mode( &mut self, pattern: &str, mode: MigrationMode, ) -> bool

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Update migration mode for a specific route pattern Returns true if the rule was found and updated

Source

pub fn update_group_migration_mode(&mut self, group: &str, mode: MigrationMode)

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Update migration mode for an entire group This affects all routes that belong to the group

Source

pub fn toggle_route_migration(&mut self, pattern: &str) -> Option<MigrationMode>

๐Ÿ‘ŽDeprecated:

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

Source

pub fn toggle_group_migration(&mut self, group: &str) -> MigrationMode

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Toggle a groupโ€™s migration mode through the stages: mock โ†’ shadow โ†’ real โ†’ mock Returns the new mode

Source

pub fn get_migration_routes(&self) -> Vec<MigrationRouteInfo>

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Get all routes with their migration status

Source

pub fn get_migration_groups(&self) -> HashMap<String, MigrationGroupInfo>

๐Ÿ‘ŽDeprecated:

Will be extracted to mockforge-proxy crate

Get all migration groups with their status

Trait Implementationsยง

Sourceยง

impl Clone for ProxyConfig

Sourceยง

fn clone(&self) -> ProxyConfig

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Debug for ProxyConfig

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Default for ProxyConfig

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl<'de> Deserialize<'de> for ProxyConfig

Sourceยง

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Sourceยง

impl JsonSchema for ProxyConfig

Sourceยง

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Sourceยง

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Sourceยง

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Sourceยง

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Sourceยง

impl Serialize for ProxyConfig

Sourceยง

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> DynClone for T
where T: Clone,

Sourceยง

fn __clone_box(&self, _: Private) -> *mut ()

Sourceยง

impl<T> Fake for T

Sourceยง

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Sourceยง

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> FromRef<T> for T
where T: Clone,

Sourceยง

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Sourceยง

impl<T> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

impl<T> PolicyExt for T
where T: ?Sized,

Sourceยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Sourceยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Sourceยง

impl<T> ParallelSend for T