Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat: add IPv6 support for connection URLs by bracketing host addresses

t8y24c4f5de6d89d
diff --git a/src-tauri/src/models/connection.rs b/src-tauri/src/models/connection.rs
index 9b778585fe..df58ea021a 100644
--- a/src-tauri/src/models/connection.rs
+++ b/src-tauri/src/models/connection.rs
@@ -76,6 +76,7 @@ impl ConnectionConfig {
}
pub fn redacted_connection_url_with_host(&self, host: &str, port: u16) -> String {
+ let host = bracket_ipv6(host);
let db_part = self
.database
.as_deref()
@@ -118,6 +119,7 @@ impl ConnectionConfig {
}
pub fn connection_url_with_host(&self, host: &str, port: u16) -> String {
+ let host = bracket_ipv6(host);
let db_part = self
.database
.as_deref()
@@ -206,6 +208,14 @@ fn encode_url_part(value: &str) -> String {
utf8_percent_encode(value, NON_ALPHANUMERIC).to_string()
}
+fn bracket_ipv6(host: &str) -> String {
+ if host.contains(':') && !host.starts_with('[') {
+ format!("[{host}]")
+ } else {
+ host.to_string()
+ }
+}
+
#[cfg(test)]
mod tests {
use super::{ConnectionConfig, DatabaseType};