Host phase 1a follow-up: pass ContainerTarget instead of container ids
Functions that took a bare container id and built `ContainerTarget::docker(id)` internally now take a target, and their callers resolve one from the project (`ContainerTarget::for_project`) or carry the one they already hold. Long-lived holders (auth bridge poller, browser-view proxy/session, file viewer commands) store the target. Collapses the string/target wrapper pairs: `detect::detect` now takes a target (`detect_in` removed) and `tunnel_connection_with_prelude` takes a target (`tunnel_into_with_prelude` removed). No behaviour change. Two temporary Docker constructions remain on the container-start path, marked "phase 1b": the auth bridge start in `start_project_container_locked` and `marketplace::spawn_project_sync`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3ec100e06c
commit
83d63e756d
19 files changed
+143
-169
No files matched your search
@@ -177,7 +177,7 @@ impl AuthBridgeManager {
|
||||
pub async fn start(
|
||||
&self,
|
||||
project_id: String,
|
||||
container_id: String,
|
||||
container: ContainerTarget,
|
||||
app: AppHandle,
|
||||
store: Arc<ProjectsStore>,
|
||||
) {
|
||||
@@ -199,12 +199,12 @@ impl AuthBridgeManager {
|
||||
log::info!(
|
||||
"Auth bridge: starting for project {} (container {})",
|
||||
project_id,
|
||||
&container_id[..container_id.len().min(12)]
|
||||
&container.id()[..container.id().len().min(12)]
|
||||
);
|
||||
|
||||
let poller = tokio::spawn(poll_loop(
|
||||
project_id.clone(),
|
||||
ContainerTarget::docker(container_id),
|
||||
container,
|
||||
epoch,
|
||||
app,
|
||||
store,
|
||||
|
||||
@@ -322,7 +322,7 @@ async fn tunnel_connection(
|
||||
}
|
||||
|
||||
// The bytes already off the socket go back on the wire first, byte-exact.
|
||||
tunnel_into_with_prelude(container, target, stream, port, head.into_buffer()).await
|
||||
tunnel_connection_with_prelude(container, target, stream, port, head.into_buffer()).await
|
||||
}
|
||||
|
||||
/// What the first bytes of an accepted connection turned out to be.
|
||||
@@ -514,29 +514,7 @@ pub(crate) fn web_request_verdict(head: &str) -> Verdict {
|
||||
/// head off the socket to check a token, and then has to put those same bytes
|
||||
/// back on the wire. Passing them here keeps the byte stream exact, rather than
|
||||
/// re-serialising a parsed request.
|
||||
///
|
||||
/// Takes a Docker container id because that is what the browser-view proxy
|
||||
/// holds; [`tunnel_into_with_prelude`] is the same thing for a
|
||||
/// [`ContainerTarget`] already in hand.
|
||||
pub async fn tunnel_connection_with_prelude(
|
||||
container_id: String,
|
||||
target: String,
|
||||
stream: TcpStream,
|
||||
port: u16,
|
||||
prelude: Vec<u8>,
|
||||
) {
|
||||
tunnel_into_with_prelude(
|
||||
ContainerTarget::docker(container_id),
|
||||
target,
|
||||
stream,
|
||||
port,
|
||||
prelude,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
/// [`tunnel_connection_with_prelude`] for a [`ContainerTarget`].
|
||||
pub async fn tunnel_into_with_prelude(
|
||||
container: ContainerTarget,
|
||||
target: String,
|
||||
stream: TcpStream,
|
||||
|
||||
Reference in new issue
Block a user