Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

340 changes: 339 additions & 1 deletion Makefile

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions apps/localup-desktop/src-tauri/src/daemon/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ impl DaemonService {
},
"tls" => ProtocolConfig::Tls {
local_port,
sni_hostname: custom_domain.clone(),
sni_hostnames: custom_domain.clone().map(|d| vec![d]).unwrap_or_default(),
http_port: None,
},
other => {
return DaemonResponse::Error {
Expand Down Expand Up @@ -474,7 +475,8 @@ async fn handle_request(
},
"tls" => ProtocolConfig::Tls {
local_port,
sni_hostname: custom_domain.clone(),
sni_hostnames: custom_domain.clone().map(|d| vec![d]).unwrap_or_default(),
http_port: None,
},
other => {
return DaemonResponse::Error {
Expand Down
21 changes: 20 additions & 1 deletion apps/localup-desktop/src-tauri/src/state/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,12 @@ pub fn build_protocol_config(
}),
"tls" => Ok(ProtocolConfig::Tls {
local_port,
sni_hostname: config.custom_domain.clone(),
sni_hostnames: config
.custom_domain
.clone()
.map(|d| vec![d])
.unwrap_or_default(),
http_port: None,
}),
other => Err(format!("Unknown protocol: {}", other)),
}
Expand Down Expand Up @@ -326,6 +331,12 @@ pub async fn run_tunnel(
reconnect_attempt + 1
);

// Update status to Connecting
{
let mut manager = tunnel_manager.write().await;
manager.update_status(&config_id, TunnelStatus::Connecting, None, None, None);
}

match TunnelClient::connect(config.clone()).await {
Ok(client) => {
reconnect_attempt = 0;
Expand Down Expand Up @@ -442,10 +453,18 @@ pub async fn run_tunnel(
// Abort metrics task when connection ends
metrics_task.abort();

// Update status to Disconnected (will change to Connecting on next loop iteration)
{
let mut manager = tunnel_manager.write().await;
manager.update_status(&config_id, TunnelStatus::Disconnected, None, None, None);
}

info!(
"[{}] Connection lost, attempting to reconnect...",
config_id
);

reconnect_attempt += 1;
}
Err(e) => {
error!("[{}] Failed to connect: {}", config_id, e);
Expand Down
8 changes: 4 additions & 4 deletions crates/localup-api/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ pub async fn list_tunnels(
}
localup_proto::Protocol::Tls {
port: _,
sni_pattern,
sni_patterns,
} => TunnelProtocol::Tls {
domain: sni_pattern.clone(),
domains: sni_patterns.clone(),
},
},
public_url: e.public_url.clone(),
Expand Down Expand Up @@ -342,9 +342,9 @@ pub async fn get_tunnel(
}
localup_proto::Protocol::Tls {
port: _,
sni_pattern,
sni_patterns,
} => TunnelProtocol::Tls {
domain: sni_pattern.clone(),
domains: sni_patterns.clone(),
},
},
public_url: e.public_url.clone(),
Expand Down
6 changes: 3 additions & 3 deletions crates/localup-api/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ pub enum TunnelProtocol {
/// Local port to forward
port: u16,
},
/// TLS tunnel with SNI
/// TLS tunnel with SNI (supports multiple domains/patterns)
Tls {
/// Domain for SNI routing
domain: String,
/// Domains/patterns for SNI routing (can include wildcards like *.example.com)
domains: Vec<String>,
},
}

Expand Down
2 changes: 1 addition & 1 deletion crates/localup-cert/src/acme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use instant_acme::{
use thiserror::Error;
use tokio::fs;
use tokio::sync::RwLock;
use tracing::{debug, error, info};
use tracing::{debug, info};

use crate::Certificate;

Expand Down
1 change: 1 addition & 0 deletions crates/localup-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ uuid = { version = "1.0", features = ["v4"] }
ipnetwork = "0.20"
chrono = { workspace = true }
sea-orm = { workspace = true }
axum = { workspace = true }

[build-dependencies]
chrono = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/localup-cli/src/localup_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ mod tests {
connection_timeout: Duration::from_secs(30),
preferred_transport: None,
http_auth: HttpAuthConfig::None,
ip_allowlist: Vec::new(),
},
}
}
Expand Down
Loading
Loading