(w io.Writer, addr string)
| 273 | } |
| 274 | |
| 275 | func writeAddrWithStr(w io.Writer, addr string) error { |
| 276 | host, port, err := splitHostPort(addr) |
| 277 | if err != nil { |
| 278 | return err |
| 279 | } |
| 280 | if ip := net.ParseIP(host); ip != nil { |
| 281 | return writeAddr(w, &address{IP: ip, Port: port}) |
| 282 | } |
| 283 | return writeAddr(w, &address{Name: host, Port: port}) |
| 284 | } |
| 285 | |
| 286 | func splitHostPort(address string) (string, int, error) { |
| 287 | host, port, err := net.SplitHostPort(address) |
no test coverage detected