normalizeHost returns a normalized version of the URL host for use as a map key.
(u *url.URL)
| 78 | |
| 79 | // normalizeHost returns a normalized version of the URL host for use as a map key. |
| 80 | func normalizeHost(u *url.URL) (string, error) { |
| 81 | if u == nil || u.Host == "" { |
| 82 | return "", xerrors.New("nil server URL") |
| 83 | } |
| 84 | return strings.TrimSpace(strings.ToLower(u.Host)), nil |
| 85 | } |
| 86 | |
| 87 | // parseCredentialsJSON parses the JSON from the keyring into a credentialsMap. |
| 88 | func parseCredentialsJSON(jsonData []byte) (credentialsMap, error) { |