splitHostPort splits a host:port string into host and port This is a simplified version that handles the common cases
(addr string)
| 437 | // splitHostPort splits a host:port string into host and port |
| 438 | // This is a simplified version that handles the common cases |
| 439 | func splitHostPort(addr string) (host, port string) { |
| 440 | // Handle Unix sockets |
| 441 | if strings.HasPrefix(addr, "/") || strings.HasPrefix(addr, "@") { |
| 442 | return addr, "" |
| 443 | } |
| 444 | |
| 445 | host, port, err := net.SplitHostPort(addr) |
| 446 | if err != nil { |
| 447 | // If split fails, return the whole address as host |
| 448 | return addr, "" |
| 449 | } |
| 450 | |
| 451 | return host, port |
| 452 | } |
| 453 | |
| 454 | // parseAddr parses a Redis address into host and port |
| 455 | func parseAddr(addr string) (host, port string) { |
no outgoing calls
no test coverage detected