Skip to main content

Proxy

Struct Proxy 

Source
pub struct Proxy {
    pub auth_manager: Arc<RwLock<Option<Arc<AuthManager>>>>,
    /* private fields */
}
Expand description

The main proxy engine that manages the connection and authentication state.

Fields§

§auth_manager: Arc<RwLock<Option<Arc<AuthManager>>>>

Shared authentication manager (lazy-loaded).

Implementations§

Source§

impl Proxy

Source

pub fn new( remote_url: &str, user_id: &str, oidc_config: OidcConfig, vault: Vault, protocol_version: &str, auth_scheme: AuthScheme, ) -> Arc<Self> ⓘ

Creates a new Proxy instance.

Source

pub async fn handle_request( &self, payload: Value, out: &Sender<String>, ) -> Result<()>

Primary entry point for the stdio -> HTTP bridge.

Sends one JSON-RPC message to the remote server (attaching DPoP-bound tokens and managing the Airlock) and writes every message the server returns for it to out: a JSON body, or each event of a text/event-stream response (MCP Streamable HTTP).

Source

pub async fn call(&self, payload: Value) -> Result<Option<Value>>

Sends one request and returns the server’s response to it.

Other messages the server streams back (e.g. progress notifications) are dropped. Returns Ok(None) when nothing comes back, as for notifications.

Source

pub async fn wait_for_legacy_session(&self)

Resolves once a POST to the remote server has succeeded (so the session Resolves once a legacy (2025-11-25 or earlier) session is established. Modern servers have no standalone GET stream, so for them this never resolves.

Source

pub async fn trigger_reauth( &self, observed_gen: u64, metadata_url: Option<&str>, scopes: Option<Vec<String>>, reason: ReauthReason, ) -> Result<()>

Runs a re-authentication, or reuses the outcome of one that happened while waiting.

observed_gen is the credential generation used by the request that was rejected. Requests rejected together share a single attempt: once one of them re-authenticates, the others reuse its result (or its failure).

For ReauthReason::Unauthorized a silent refresh is tried before the browser login. A token from a browser login that is rejected again right away is reported as an authentication loop instead of opening yet another login.

Source

pub async fn listen_sse( &self, sse_url: &str, stdout_tx: Sender<String>, ) -> Result<()>

Keeps the standalone GET event stream of a legacy server open, reconnecting (with Last-Event-ID) and re-authenticating as needed, and writes its messages to stdout_tx. Returns when the server doesn’t offer the stream (405).

Auto Trait Implementations§

§

impl !Freeze for Proxy

§

impl !RefUnwindSafe for Proxy

§

impl !UnwindSafe for Proxy

§

impl Send for Proxy

§

impl Sync for Proxy

§

impl Unpin for Proxy

§

impl UnsafeUnpin for Proxy

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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, 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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more