fix registry addr error for mq-rpc
This commit is contained in:
@@ -14,12 +14,13 @@ func HostPort(addr string, port interface{}) string {
|
||||
if strings.Count(addr, ":") > 0 {
|
||||
host = fmt.Sprintf("[%s]", addr)
|
||||
}
|
||||
// TODO check for NATS case
|
||||
if v, ok := port.(string); ok {
|
||||
if v == "" {
|
||||
return fmt.Sprintf("%s", host)
|
||||
}
|
||||
// when port is blank or 0, host is a queue name
|
||||
if v, ok := port.(string); ok && v == "" {
|
||||
return host
|
||||
} else if v, ok := port.(int); ok && v == 0 && net.ParseIP(host) == nil {
|
||||
return host
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s:%v", host, port)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user