(u *url.URL)
| 166 | } |
| 167 | |
| 168 | func portForURL(u *url.URL) string { |
| 169 | port := u.Port() |
| 170 | if port != "" { |
| 171 | return port |
| 172 | } |
| 173 | switch u.Scheme { |
| 174 | case "http": |
| 175 | return "80" |
| 176 | case "https": |
| 177 | return "443" |
| 178 | case "ssh": |
| 179 | return "22" |
| 180 | default: |
| 181 | return "" |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | // compareHosts compares a hostname with a configuration hostname to determine |
| 186 | // a match. It returns an integer indicating the strength of the match, or 0 if |