normalize ensures an IPv6 hostname (i.e. [::1]) representation is converted to its IP representation (::1).
(name string)
| 849 | // normalize ensures an IPv6 hostname (i.e. [::1]) representation is |
| 850 | // converted to its IP representation (::1). |
| 851 | func normalize(name string) string { |
| 852 | if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") { |
| 853 | if ip := net.ParseIP(name[1 : len(name)-1]); ip != nil { |
| 854 | name = ip.String() |
| 855 | } |
| 856 | } |
| 857 | return name |
| 858 | } |
| 859 | |
| 860 | // allEmpty loops through all strings in the slice and returns if |
| 861 | // all are empty (length 0). |
no test coverage detected
searching dependent graphs…