mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
chore: switch to deno_tunnel crate (#30049)
switch to `deno_tunnel` crate for shared code with deploy
This commit is contained in:
parent
1dd0db2e16
commit
46009f7368
10 changed files with 132 additions and 378 deletions
34
cli/main.rs
34
cli/main.rs
|
@ -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?
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue