bookclerk_plugin_sdk::callback_tunnel

Development These docs follow the development version and change with every merge.

Last updated View as Markdown

Multiplexed byte tunnel for host-owned OAuth callback listeners.

Thin wrappers around [crate::mux]: the host TunnelHost::opens one stream per accepted browser connection; the guest TunnelGuest::accepts them. Flow control is the mux per-stream credit window.

Item Kind Summary
TunnelHost struct Host end of the callback tunnel: opens logical connections toward the guest.
TunnelGuest struct Guest end of the callback tunnel: accepts logical connections from the host.
TunnelStream type alias One multiplexed logical connection implementing AsyncRead + AsyncWrite.

Structs

TunnelHost

pub struct TunnelHost {
    /* private fields */
}

Host end of the callback tunnel: opens logical connections toward the guest.

TunnelHost::new

pub fn new<R, W>(reader: R, writer: W) -> Self
where
    R: AsyncRead + Send + Unpin + 'static,
    W: AsyncWrite + Send + Unpin + 'static,

Spawns reader/writer tasks on the host half of a duplex IPC link.

Arguments
  • reader - Async half that receives guest→host frames.
  • writer - Async half that sends host→guest frames.

TunnelHost::open

pub async fn open(&self) -> Result<TunnelStream>

Opens one logical connection toward the guest and returns its stream.

Errors

Returns crate::SdkError when the mux writer has exited.

TunnelGuest

pub struct TunnelGuest {
    /* private fields */
}

Guest end of the callback tunnel: accepts logical connections from the host.

TunnelGuest::new

pub fn new<R, W>(reader: R, writer: W) -> Self
where
    R: AsyncRead + Send + Unpin + 'static,
    W: AsyncWrite + Send + Unpin + 'static,

Spawns reader/writer tasks on the guest half of a duplex IPC link.

Arguments
  • reader - Async half that receives host→guest frames.
  • writer - Async half that sends guest→host frames.

TunnelGuest::accept

pub async fn accept(&mut self) -> Result<TunnelStream>

Waits for the next logical connection opened by TunnelHost::open.

Errors

Returns crate::SdkError when the mux reader exits.

Type aliases

TunnelStream

pub type TunnelStream = MuxStream;

One multiplexed logical connection implementing AsyncRead + AsyncWrite.

Generated from crates/bookclerk-plugin-sdk at main · View as Markdown