stripIPPort converts strings like "[::1]:12345" to "::1"
(addr string)
| 270 | |
| 271 | // stripIPPort converts strings like "[::1]:12345" to "::1" |
| 272 | func stripIPPort(addr string) string { |
| 273 | ip := net.ParseIP(addr) |
| 274 | if ip != nil { |
| 275 | return addr |
| 276 | } |
| 277 | host, _, err := net.SplitHostPort(addr) |
| 278 | if err != nil { |
| 279 | return "" |
| 280 | } |
| 281 | ip = net.ParseIP(host) |
| 282 | if ip != nil { |
| 283 | return host |
| 284 | } |
| 285 | return "" |
| 286 | } |
no outgoing calls
no test coverage detected