MCPcopy
hub / github.com/smallstep/cli / normalize

Function normalize

command/ca/init.go:851–858  ·  view source on GitHub ↗

normalize ensures an IPv6 hostname (i.e. [::1]) representation is converted to its IP representation (::1).

(name string)

Source from the content-addressed store, hash-verified

849// normalize ensures an IPv6 hostname (i.e. [::1]) representation is
850// converted to its IP representation (::1).
851func 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).

Callers 1

processDNSValueFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…