chore: switch to deno_tunnel crate (#30049)

switch to `deno_tunnel` crate for shared code with deploy
This commit is contained in:
snek 2025-07-14 16:11:02 +02:00 committed by GitHub
parent 1dd0db2e16
commit 46009f7368
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 132 additions and 378 deletions

View file

@ -903,29 +903,41 @@ async fn initialize_tunnel(
let cert_store_provider = factory.root_cert_store_provider();
let root_cert_store = cert_store_provider.get_or_try_init()?.clone();
let tls_config = deno_runtime::deno_tls::create_client_config(
Some(root_cert_store),
vec![],
None,
deno_runtime::deno_tls::TlsKeys::Null,
deno_runtime::deno_tls::SocketUse::GeneralSsl,
)?;
let (tunnel, metadata, mut events) =
match deno_runtime::deno_net::tunnel::TunnelListener::connect(
match deno_runtime::deno_net::tunnel::TunnelConnection::connect(
addr,
hostname,
Some(root_cert_store.clone()),
token,
org.clone(),
app.clone(),
tls_config.clone(),
deno_runtime::deno_net::tunnel::Authentication::App {
token,
org: org.clone(),
app: app.clone(),
},
)
.await
{
Ok(res) => res,
Err(deno_runtime::deno_net::tunnel::Error::InvalidToken) => {
Err(deno_runtime::deno_net::tunnel::Error::Unauthorized) => {
tools::deploy::get_token_entry()?.delete_credential()?;
let token = auth_tunnel().await?;
deno_runtime::deno_net::tunnel::TunnelListener::connect(
deno_runtime::deno_net::tunnel::TunnelConnection::connect(
addr,
hostname,
Some(root_cert_store),
token,
org,
app,
tls_config,
deno_runtime::deno_net::tunnel::Authentication::App {
token,
org,
app,
},
)
.await?
}