Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
81d7390
test(browser_egress): assert denied navigation never dials the allowe…
senamakel Oct 22, 2026
2201c9a
test(browser_egress): reflow an over-wrapped assertion binding
senamakel Oct 22, 2026
2026946
docs(test): qualify live browser egress test filter
senamakel Oct 22, 2026
82d0aa6
Merge pull request #152 from tinyhumansai/tinycomputer-egress-7328
senamakel Oct 22, 2026
d1cc183
feat: relay host context to consequence reviews
senamakel Oct 22, 2026
e022e1e
chore(vendor): bump agent-browser, agent-desktop, tinybus and tinyinf…
senamakel Oct 22, 2026
826a885
docs(specs): document host context relay in desktop module contract
senamakel Oct 22, 2026
b1b67c6
chore(deps): refresh Cargo.lock
senamakel Oct 22, 2026
dc77292
fix(deps): restore compatible vendor pins
senamakel Oct 22, 2026
0897cd3
test(consequence_gate): mark review interface as confidential
senamakel Oct 22, 2026
aacc758
fix(consequence_gate): call review without confidential flag
senamakel Oct 22, 2026
32d5b6e
test(task): add host context to describe test fixture
senamakel Oct 22, 2026
89fd8d9
feat(task): add host_context field to continue task schema
senamakel Oct 22, 2026
611a563
test(consequence_gate): cover host context denial for unconfidential …
senamakel Oct 22, 2026
3c41a8c
feat(tinybus_module): route consequence reviews to a confidential host
senamakel Oct 22, 2026
46e3f51
docs(tinybus_module): document confidential consequence reviews
senamakel Oct 22, 2026
3ca0865
fix(task): omit host-only context from continue task schema
senamakel Oct 22, 2026
f05687a
test(task): cover continuation request fields in describe schemas
senamakel Oct 22, 2026
18ab9ea
fix(consequence): fail closed for missing configured callback
senamakel Oct 22, 2026
52e3596
docs(consequence): describe callback configuration and denial scope
senamakel Oct 22, 2026
e172609
fix(consequence): satisfy workspace clippy
senamakel Oct 22, 2026
e52203c
Merge pull request #153 from tinyhumansai/tinycomputer-consequence-co…
senamakel Oct 22, 2026
43817bd
fix(flow): gate posting, transferring, checkout, logout and signing; …
M3gA-Mind Oct 22, 2026
de74cb6
build(deps): source tinyinference crates from git with a local patch
senamakel Oct 22, 2026
b3d1fc7
chore: restore canonical TinyComputer submodule pins
senamakel Oct 22, 2026
759273c
Merge pull request #156 from tinyhumansai/tinycomputer-single-inference
senamakel Oct 22, 2026
196dab4
Merge pull request #155 from M3gA-Mind/fix/destructive-action-gate
M3gA-Mind Oct 22, 2026
8ac02a1
test(browser): cover worker egress authorization
senamakel Oct 22, 2026
ed424f2
style(tinycomputer): reformat browser egress live tests
senamakel Oct 22, 2026
10473e3
test(browser_egress): allow extra clippy lints in live tests
senamakel Oct 22, 2026
80b0975
test(tinycomputer): scope clippy allows to the items that need them
senamakel Oct 22, 2026
a942705
test(browser_egress): extract shared fixture host setup for live tests
senamakel Oct 22, 2026
4dee0d5
test(browser_egress): reuse fixture host helper in worker egress test
senamakel Oct 22, 2026
7060a52
test(browser_egress): align broker task handle type with tinybus result
senamakel Oct 22, 2026
ba7663f
test(browser): report observations when worker egress times out
senamakel Oct 22, 2026
a32341a
test(browser): distinguish bypass from unreached host authorization
senamakel Oct 22, 2026
b8fb10e
test(browser_egress): keep host connection and module host alive in l…
senamakel Oct 22, 2026
9080d6c
test(browser_egress): scope observation lock to assertion block
senamakel Oct 22, 2026
960447a
test(browser): wait for worker completion before asserting egress
senamakel Oct 22, 2026
c3f56dc
test(browser_egress): assert exact allowed connection count
senamakel Oct 22, 2026
eab0940
test(browser_egress): split live tests into a module directory
senamakel Oct 22, 2026
b9aa8d6
test(browser_egress): remove trailing blank line
senamakel Oct 22, 2026
37cc9f4
test(browser): document opt-in worker egress coverage
senamakel Oct 22, 2026
8313543
Merge pull request #157 from tinyhumansai/tinycomputer-worker-egress
senamakel Oct 22, 2026
07a7794
test(browser): cover exact-socket egress pinning in live chromium
senamakel Oct 23, 2026
6b0a3c8
test(browser): fix content-length in live socket fixture
senamakel Oct 23, 2026
02f9aac
Merge pull request #158 from tinyhumansai/tinycomputer-111-transport-…
senamakel Oct 23, 2026
b801cf2
test(browser): cover proxied redirects and transport classes
senamakel Oct 23, 2026
20424fb
test(consequence): a host denial turns a service-level approval into …
M3gA-Mind Oct 23, 2026
afdf9be
fix(browser): classify page script errors before keyword matches
M3gA-Mind Oct 23, 2026
2fa02ac
test(accessibility): helper cache dir and reply-id matching
M3gA-Mind Oct 23, 2026
129fc44
test(browser): correlate each transport authorization
senamakel Oct 23, 2026
ae85236
test(browser_egress): assert websocket upgrade headers in socket fixture
senamakel Oct 23, 2026
a3936d2
test(browser-egress): add module doc for transport class live tests
senamakel Oct 23, 2026
5a29fd0
test(consequence): build the flow result's vars with BTreeMap::new
M3gA-Mind Oct 23, 2026
2379243
test(browser_egress): add authority denial live tests
senamakel Oct 23, 2026
174f08d
test(browser_egress): tidy transport class live test assertions
senamakel Oct 23, 2026
4296ed9
Let a task set how many turns a do step may spend
YellowSnnowmann Oct 23, 2026
fe18747
Pin contract 2.28 in the public API test
YellowSnnowmann Oct 23, 2026
23e1180
Merge pull request #164 from tinyhumansai/feat/configurable-do-turns
YellowSnnowmann Oct 23, 2026
2ccc266
Merge branch 'main' into epic-7328-continue
senamakel Oct 23, 2026
2da2f42
Merge pull request #160 from M3gA-Mind/fix/browser-eval-error-class-f…
M3gA-Mind Oct 23, 2026
6388f99
Merge pull request #161 from M3gA-Mind/test/host-denial-declines-appr…
M3gA-Mind Oct 23, 2026
a642df6
Merge pull request #162 from M3gA-Mind/test/accessibility-helper-cach…
M3gA-Mind Oct 23, 2026
370d0e1
Merge pull request #159 from tinyhumansai/epic-7328-continue
senamakel Oct 23, 2026
94ea324
feat(egress): add test-connector seam for host integration tests
senamakel Oct 23, 2026
8e80684
test(browser): bound connector test waits with timeouts
senamakel Oct 23, 2026
8e94ffb
test: improve proxy response assertion diagnostics
senamakel Oct 23, 2026
b540493
test(tinycomputer-browser): update proxy connector fixture credentials
senamakel Oct 23, 2026
04453a7
test: allow panics and unwraps in connector tests
senamakel Oct 23, 2026
9e67cbb
feat(browser): add test connector hook for egress integration tests
senamakel Oct 23, 2026
2b8ea53
test(browser_egress): use crate-relative path for connector helper
senamakel Oct 23, 2026
ee84152
test(browser_egress): scope connector overrides by policy and generation
senamakel Oct 23, 2026
7184008
test(browser_egress): add failure message to callback order assertion
senamakel Oct 23, 2026
4e33cd0
test(browser_egress): assert lease validation precedes background req…
senamakel Oct 23, 2026
415bdba
refactor(tinycomputer): move test connector override into browser config
senamakel Oct 23, 2026
2546d05
feat(browser): add module-config test connector mapping
senamakel Oct 23, 2026
cda3b6f
refactor(tinybus_module): widen test connector map visibility
senamakel Oct 23, 2026
1c32bcd
refactor(linked): extract egress proxy binding into a helper
senamakel Oct 23, 2026
ae2dc3a
docs(egress): document opt-in loaded-module Chromium test
senamakel Oct 23, 2026
31e3120
docs(egress): document test-connector host fixture mapping
senamakel Oct 23, 2026
bfa9bd3
Merge epic/7328-security-bus into public control
senamakel Oct 23, 2026
81c158f
test(linked): cover loopback proxy binding before launch
senamakel Oct 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ TINYCOMPUTER_LAB_SELF_EMAIL=
# TINYCOMPUTER_LIVE_BROWSER=1
# Compile and run the linked browser egress tests against installed Chromium.
# TINYCOMPUTER_LIVE_BROWSER_TESTS=1
# Compile and run TinyComputer's module-path egress test against installed Chromium
# Compile and run TinyComputer's module-path egress tests against installed Chromium
# using only local fixture listeners:
# Run all module-path egress tests, or select the exact-socket test:
# TINYCOMPUTER_LIVE_BROWSER_EGRESS_TESTS=1 cargo test --manifest-path crates/tinycomputer/Cargo.toml -p tinycomputer --lib --features static-link tinybus_module::browser_egress_live_tests -- --nocapture
# TINYCOMPUTER_LIVE_BROWSER_EGRESS_TESTS=1 cargo test --manifest-path crates/tinycomputer/Cargo.toml -p tinycomputer --lib --features static-link live_chromium_module_dials_only_the_host_returned_socket_and_rejects_changed_policy -- --nocapture
13 changes: 10 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ tinycomputer-accessibility = { path = "crates/tinycomputer-accessibility" }
# crate of the vendored `vendor/tinyinference` submodule, pinned by its gitlink
# so provider validation and retry behavior are reproducible. Only this crate
# of TinyInference is linked into the module.
tinyinference-decisions = { path = "vendor/tinyinference/crates/tinyinference-decisions" }
tinyinference-decisions = { git = "https://github.com/tinyhumansai/tinyinference", rev = "02c01b72f70cd3747304b2a5a696b52a49fdd4fd" }
# The optional LLM planner's model client (engine `planner` feature) and the
# lab's author.
tinyinference-llm = { path = "vendor/tinyinference/crates/tinyinference-llm" }
# lab's author. Naming the shared source lets a host workspace redirect it to
# its single TinyInference copy; standalone builds use the local patch below.
tinyinference-llm = { git = "https://github.com/tinyhumansai/tinyinference", rev = "02c01b72f70cd3747304b2a5a696b52a49fdd4fd" }
# The browser automation engine, linked as a library: `execute_command` over a
# `DaemonState`. Vendored from the tinyhumansai fork until
# vercel-labs/agent-browser#2008 lands upstream.
Expand Down Expand Up @@ -121,6 +122,12 @@ tinybus = { path = "vendor/tinybus/crates/tinybus" }
tinybus-macros = { path = "vendor/tinybus/crates/tinybus-macros" }
tinybus-module = { path = "vendor/tinybus/crates/tinybus-module" }

[patch."https://github.com/tinyhumansai/tinyinference"]
# Keep standalone TinyComputer builds on the pinned submodule while allowing
# an embedding workspace's top-level patch to provide its shared copy.
tinyinference-decisions = { path = "vendor/tinyinference/crates/tinyinference-decisions" }
tinyinference-llm = { path = "vendor/tinyinference/crates/tinyinference-llm" }

[workspace.lints.rust]
unsafe_code = "forbid"
missing_docs = "warn"
Expand Down
3 changes: 3 additions & 0 deletions MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ is optional:
and requested task reports. Sink mode replaces local trace/session storage
and does not fall back to `trace_path`; event errors follow `trace_strict`,
and report write errors return a recoverable `TRACE_SINK_FAILED` response;
- `consequence_host`: an object containing only the unique destination prepared
for the confidential `ConsequenceHost` callback. When reviewing an approved
pending action, a missing object, interface, or failed callback declines it;
- `jev`: the decision model and its API key, needed by the Jev-driven and
task members. `provider` picks it: Jev through `type_safe` (the default),
`open_router`, or `tiny_humans_open_router`; `open_jev` (OpenJEV's
Expand Down
15 changes: 12 additions & 3 deletions crates/tinycomputer-accessibility/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@ mod swift_source;

#[cfg(target_os = "macos")]
pub(crate) fn private_cache_dir(name: &str) -> Result<std::path::PathBuf, String> {
use std::os::unix::fs::{MetadataExt, PermissionsExt};

let temp_dir = std::fs::canonicalize(std::env::temp_dir())
.map_err(|error| format!("failed to resolve temporary directory: {error}"))?;
let temp_metadata = std::fs::symlink_metadata(&temp_dir)
private_cache_dir_in(&temp_dir, name)
}

/// [`private_cache_dir`] under `temp_dir`, an already-resolved directory.
#[cfg(target_os = "macos")]
fn private_cache_dir_in(
temp_dir: &std::path::Path,
name: &str,
) -> Result<std::path::PathBuf, String> {
use std::os::unix::fs::{MetadataExt, PermissionsExt};

let temp_metadata = std::fs::symlink_metadata(temp_dir)
.map_err(|error| format!("failed to inspect temporary directory: {error}"))?;
if !temp_metadata.is_dir()
|| temp_metadata.mode() & 0o077 != 0
Expand Down
37 changes: 29 additions & 8 deletions crates/tinycomputer-accessibility/src/helper/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,35 @@ pub(crate) fn helper_send_receive(
} // UNIFIED_HELPER released here — fire-and-forget callers can proceed

// Read until the line matches `id` (discards stale lines after a timeout or reordering).
let deadline = Instant::now() + HELPER_RECV_TIMEOUT;
match await_reply(&RESPONSE_RX, &id_str, HELPER_RECV_TIMEOUT)? {
Some(value) => Ok(value),
None => {
reset_helper_process();
Err(format!(
"helper response timed out waiting for id {id_str} (stale lines may follow)"
))
}
}
}

/// Reads lines from the helper's reply channel until one carries `id_str`,
/// discarding blank, stale, and unnumbered lines. `None` when `timeout`
/// passes first.
#[cfg(target_os = "macos")]
fn await_reply(
rx_slot: &StdMutex<Option<mpsc::Receiver<String>>>,
id_str: &str,
timeout: Duration,
) -> Result<Option<Value>, String> {
let deadline = Instant::now() + timeout;
loop {
let remaining = deadline.saturating_duration_since(Instant::now());
if remaining.is_zero() {
reset_helper_process();
return Err(format!(
"helper response timed out waiting for id {id_str} (stale lines may follow)"
));
return Ok(None);
}
let chunk = remaining.min(Duration::from_millis(500));
let response_line = {
let rx_guard = RESPONSE_RX
let rx_guard = rx_slot
.lock()
.map_err(|_| "response rx lock poisoned".to_string())?;
let rx = rx_guard
Expand Down Expand Up @@ -148,9 +165,9 @@ pub(crate) fn helper_send_receive(
let matches = value
.get("id")
.and_then(|v| v.as_str())
.is_some_and(|rid| rid == id_str.as_str());
.is_some_and(|rid| rid == id_str);
if matches {
return Ok(value);
return Ok(Some(value));
}
log::debug!(
"[accessibility] discarding helper response with mismatched or missing id (want id={id_str})"
Expand Down Expand Up @@ -397,3 +414,7 @@ fn ensure_helper_binary() -> Result<PathBuf, String> {

Ok(binary_path)
}

#[cfg(test)]
#[path = "process_tests.rs"]
mod tests;
54 changes: 54 additions & 0 deletions crates/tinycomputer-accessibility/src/helper/process_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//! The helper reply wait: only the line carrying the request's id answers it.

#![cfg(target_os = "macos")]
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]

use std::sync::{Mutex as StdMutex, mpsc};
use std::time::Duration;

use super::await_reply;

/// A reply channel holding `lines`. Keep the sender alive so an empty
/// channel times out instead of disconnecting.
fn channel(
lines: &[&str],
) -> (
mpsc::Sender<String>,
StdMutex<Option<mpsc::Receiver<String>>>,
) {
let (tx, rx) = mpsc::channel();
for line in lines {
tx.send((*line).to_owned()).unwrap();
}
(tx, StdMutex::new(Some(rx)))
}

#[test]
fn stale_blank_and_unnumbered_lines_are_skipped_until_the_id_matches() {
let (_tx, rx) = channel(&[
r#"{"id":"6","ok":"stale"}"#,
" ",
r#"{"ok":"no id"}"#,
r#"{"id":"7","ok":"mine"}"#,
]);
let reply = await_reply(&rx, "7", Duration::from_secs(1))
.unwrap()
.unwrap();
assert_eq!(reply["ok"], "mine");
}

#[test]
fn no_matching_reply_before_the_timeout_is_none() {
let (_tx, rx) = channel(&[r#"{"id":"6"}"#]);
assert!(
await_reply(&rx, "7", Duration::from_millis(50))
.unwrap()
.is_none()
);
}

#[test]
fn a_reply_that_is_not_json_is_an_error() {
let (_tx, rx) = channel(&["not json"]);
assert!(await_reply(&rx, "7", Duration::from_secs(1)).is_err());
}
59 changes: 58 additions & 1 deletion crates/tinycomputer-accessibility/src/helper_tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,64 @@
//! Tests for the platform-independent entry points of the Swift helper module.
//! Tests for the platform-independent entry points of the Swift helper module,
//! and the macOS helper cache directory.

#[cfg(not(target_os = "macos"))]
#[test]
fn precompile_entry_point_is_a_noop_off_macos() {
super::precompile_helper_background();
}

#[cfg(target_os = "macos")]
mod cache_dir {
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]

use std::os::unix::fs::PermissionsExt;

use super::super::private_cache_dir_in;

/// A resolved temporary directory private to its owner.
fn private_temp() -> (tempfile::TempDir, std::path::PathBuf) {
let temp = tempfile::tempdir().unwrap();
let path = std::fs::canonicalize(temp.path()).unwrap();
std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o700)).unwrap();
(temp, path)
}

fn mode(path: &std::path::Path) -> u32 {
std::fs::metadata(path).unwrap().permissions().mode() & 0o777
}

#[test]
fn a_new_cache_dir_is_created_owner_only() {
let (_temp, root) = private_temp();
let dir = private_cache_dir_in(&root, "helper").unwrap();
assert_eq!(dir, root.join("helper"));
assert_eq!(mode(&dir), 0o700);
}

#[test]
fn an_existing_own_cache_dir_is_reused_and_made_owner_only() {
let (_temp, root) = private_temp();
let existing = root.join("helper");
std::fs::create_dir(&existing).unwrap();
std::fs::set_permissions(&existing, std::fs::Permissions::from_mode(0o755)).unwrap();
assert_eq!(private_cache_dir_in(&root, "helper").unwrap(), existing);
assert_eq!(mode(&existing), 0o700);
}

#[test]
fn a_symlinked_cache_dir_is_refused() {
let (_temp, root) = private_temp();
let elsewhere = root.join("elsewhere");
std::fs::create_dir(&elsewhere).unwrap();
std::os::unix::fs::symlink(&elsewhere, root.join("helper")).unwrap();
assert!(private_cache_dir_in(&root, "helper").is_err());
}

#[test]
fn a_temp_dir_others_can_write_is_refused() {
let (_temp, root) = private_temp();
std::fs::set_permissions(&root, std::fs::Permissions::from_mode(0o770)).unwrap();
assert!(private_cache_dir_in(&root, "helper").is_err());
assert!(!root.join("helper").exists(), "nothing is created there");
}
}
3 changes: 3 additions & 0 deletions crates/tinycomputer-browser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ agent-browser = { workspace = true, optional = true }
default = []
# Link agent-browser in-process and provide `AgentBrowser`, its `Launcher`.
agent-browser = ["dep:agent-browser"]
# Lets host integration tests substitute the final TCP connector while keeping
# authorization, grant consumption, and proxy forwarding on the production path.
test-connector = []

[dev-dependencies]
tokio = { workspace = true, features = ["test-util"] }
Expand Down
26 changes: 26 additions & 0 deletions crates/tinycomputer-browser/src/egress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@ the engine adapter (`EgressAuthorizer`) small: the host authorizes the parsed
destination, returns a one-use grant and exact socket addresses, consumes a
grant before each dial, and revalidates active leases.

Host integration tests can enable the `test-connector` feature and provide
`EgressProxy::bind_with_test_connector` (or the corresponding
`EnforcedAgentBrowser` builder) to replace only the final TCP operation. The
connector receives the exact approved socket after grant consumption. The
TinyComputer module exposes a stricter module-config mapping for dynamic test
artifacts; it accepts one `8.8.8.8:port` to loopback `127.0.0.1:port` mapping
and denies all other sockets. Production builds do not parse that test-only
field. In a `test-connector` build, a host fixture supplies it at
`browser.egress.test_connector_map` as
`{"approved":"8.8.8.8:<port>","fixture":"127.0.0.1:<same-port>"}`.

The loaded-module Chromium test is opt-in and is not part of hosted CI, whose
module-e2e lane packages and verifies the artifact without launching Chromium.
With Chromium installed, run the focused test locally with:

```sh
TINYCOMPUTER_LIVE_BROWSER_EGRESS_TESTS=1 cargo test -p tinycomputer \
--features static-link,test-connector \
browser_egress_live_tests::public_connector_tests::loaded_module_consumes_public_socket_before_fixture_mapping \
-- --nocapture
```

It uses a local HTTP listener and the TinyComputer fixture callback host; the
host's real TinySecurity policy composition is covered by the separate
OpenHuman fixture.

## Structure

- `mod.rs` defines the public `BrowserDialTarget`, `DialGrant`,
Expand Down
58 changes: 57 additions & 1 deletion crates/tinycomputer-browser/src/egress/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ mod forward;
mod request;
mod serve;

/// Fixture-only replacement for the final TCP connect in host integration tests.
///
/// The callback receives the exact socket selected by authorization and grant
/// consumption. Test connectors should map it to a local fixture only.
#[cfg(feature = "test-connector")]
pub type TestConnector = Arc<
dyn Fn(SocketAddr) -> Pin<Box<dyn Future<Output = io::Result<TcpStream>> + Send>> + Send + Sync,
>;

#[cfg(test)]
pub(crate) use serve::connect_approved_addresses;

Expand Down Expand Up @@ -95,6 +104,45 @@ impl EgressProxy {
session_id: String,
proxy_password: String,
) -> io::Result<Self> {
Self::bind_inner(authorizer, session_id, proxy_password, TcpStream::connect).await
}

/// Bind the production proxy path with a fixture-only final socket connector.
///
/// This feature-gated seam is for host integration tests that need to keep
/// policy authorization and one-use grant consumption real while mapping an
/// approved public socket operation onto a local fixture listener. The
/// connector receives the exact socket address after authorization and
/// consumption; it must not make public network connections.
///
/// # Errors
///
/// Returns an I/O error when the proxy listener cannot bind or its address
/// cannot be read.
#[cfg(feature = "test-connector")]
pub async fn bind_with_test_connector<C, F>(
authorizer: Arc<dyn EgressAuthorizer>,
session_id: String,
proxy_password: String,
connector: C,
) -> io::Result<Self>
where
C: Fn(SocketAddr) -> F + Clone + Send + Sync + 'static,
F: Future<Output = io::Result<TcpStream>> + Send + 'static,
{
Self::bind_inner(authorizer, session_id, proxy_password, connector).await
}

async fn bind_inner<C, F>(
authorizer: Arc<dyn EgressAuthorizer>,
session_id: String,
proxy_password: String,
connector: C,
) -> io::Result<Self>
where
C: Fn(SocketAddr) -> F + Clone + Send + Sync + 'static,
F: Future<Output = io::Result<TcpStream>> + Send + 'static,
{
let listener = TcpListener::bind(("127.0.0.1", 0)).await?;
let address = listener.local_addr()?;
let task = tokio::spawn(async move {
Expand All @@ -106,8 +154,16 @@ impl EgressProxy {
let auth = authorizer.clone();
let session = session_id.clone();
let password = proxy_password.clone();
let connector = connector.clone();
connections.spawn(async move {
let _ = Box::pin(serve::serve(stream, auth, session, password)).await;
let _ = Box::pin(serve::serve_with_connector(
stream,
auth,
session,
password,
connector,
))
.await;
});
}
_ = connections.join_next(), if !connections.is_empty() => {}
Expand Down
Loading
Loading