perf: support unix-socket via url string #142
This commit is contained in:
parent
a2331675d7
commit
09264134ec
|
@ -536,18 +536,28 @@ func (c *connectionService) ParseConnectURL(url string) (resp types.JSResp) {
|
|||
return
|
||||
}
|
||||
|
||||
var network, addr string
|
||||
var port int
|
||||
if urlOpt.Network == "unix" {
|
||||
network = urlOpt.Network
|
||||
addr = urlOpt.Addr
|
||||
} else {
|
||||
network = "tcp"
|
||||
addrPart := strings.Split(urlOpt.Addr, ":")
|
||||
addr := addrPart[0]
|
||||
port := 6379
|
||||
addr = addrPart[0]
|
||||
port = 6379
|
||||
if len(addrPart) > 1 {
|
||||
port, _ = strconv.Atoi(addrPart[1])
|
||||
}
|
||||
}
|
||||
var sslServerName string
|
||||
if urlOpt.TLSConfig != nil {
|
||||
sslServerName = urlOpt.TLSConfig.ServerName
|
||||
}
|
||||
resp.Success = true
|
||||
resp.Data = struct {
|
||||
Network string `json:"network"`
|
||||
Sock string `json:"sock"`
|
||||
Addr string `json:"addr"`
|
||||
Port int `json:"port"`
|
||||
Username string `json:"username"`
|
||||
|
@ -556,6 +566,7 @@ func (c *connectionService) ParseConnectURL(url string) (resp types.JSResp) {
|
|||
ExecTimeout int64 `json:"execTimeout"`
|
||||
SSLServerName string `json:"sslServerName,omitempty"`
|
||||
}{
|
||||
Network: network,
|
||||
Addr: addr,
|
||||
Port: port,
|
||||
Username: urlOpt.Username,
|
||||
|
|
|
@ -278,6 +278,7 @@ const pasteFromClipboard = async () => {
|
|||
$message.error(i18n.t('dialogue.connection.parse_fail', { reason: e.message }))
|
||||
return
|
||||
}
|
||||
generalForm.value.network = opt.network || 'tcp'
|
||||
generalForm.value.name = generalForm.value.addr = opt.addr
|
||||
generalForm.value.port = opt.port
|
||||
generalForm.value.username = opt.username
|
||||
|
|
Loading…
Reference in New Issue