feat(plugins): hand SOCKS5 transport proxy routes to connections

This commit is contained in:
Jinpy authored and GitHub committed 2026-09-19 09:47:15 +08:00
1 parent 8518a5bd25
commit 2b15327de3
13 files changed
+330 -46

No files matched your search

+12 -11
View File
@@ -273,8 +273,8 @@ async fn run_temporary_connection_test(
if config.db_type == DatabaseType::Plugin {
let result = async {
let (host, port) = app.connection_host_port(&temp_id, &config).await?;
app.plugin_host.test_connection(&config, &host, port).await
let endpoint = app.plugin_connection_endpoint(&temp_id, &config).await?;
app.plugin_host.test_connection(&config, &endpoint.host, endpoint.port, endpoint.proxy).await
}
.await;
app.reset_connection_transport_for_config(&temp_id, &config).await;
@@ -428,7 +428,7 @@ pub async fn connect_db(
app.configs.write().await.insert(connection_id.clone(), runtime_config);
if config.db_type == dbx_core::models::connection::DatabaseType::Plugin {
let (host, port) = match app.connection_host_port(&connection_id, &config).await {
let endpoint = match app.plugin_connection_endpoint(&connection_id, &config).await {
Ok(endpoint) => endpoint,
Err(error) => {
app.reset_connection_transport_for_config(&connection_id, &config).await;
@@ -441,14 +441,15 @@ pub async fn connect_db(
rollback_session_credential_writes(app, &session_credential_writes);
return Err(AppError::from(error));
}
let handle = match app.plugin_host.connect_connection(&config, &host, port).await {
Ok(handle) => handle,
Err(error) => {
app.reset_connection_transport_for_config(&connection_id, &config).await;
rollback_session_credential_writes(app, &session_credential_writes);
return Err(AppError::from(error));
}
};
let handle =
match app.plugin_host.connect_connection(&config, &endpoint.host, endpoint.port, endpoint.proxy).await {
Ok(handle) => handle,
Err(error) => {
app.reset_connection_transport_for_config(&connection_id, &config).await;
rollback_session_credential_writes(app, &session_credential_writes);
return Err(AppError::from(error));
}
};
let pool = PoolKind::PluginConnection(handle);
if let Err(error) =
app.insert_connection_pool_for_attempt(&connection_id, attempt, connection_id.clone(), pool, &config).await