| 592 | } |
| 593 | |
| 594 | func (sb serverBlock) hostsFromKeysNotHTTP(httpPort string) []string { |
| 595 | // ensure each entry in our list is unique |
| 596 | hostMap := make(map[string]struct{}) |
| 597 | for _, addr := range sb.parsedKeys { |
| 598 | if addr.Host == "" { |
| 599 | continue |
| 600 | } |
| 601 | if addr.Scheme != "http" && addr.Port != httpPort { |
| 602 | hostMap[addr.Host] = struct{}{} |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | // convert map to slice |
| 607 | sblockHosts := make([]string, 0, len(hostMap)) |
| 608 | for host := range hostMap { |
| 609 | sblockHosts = append(sblockHosts, host) |
| 610 | } |
| 611 | |
| 612 | return sblockHosts |
| 613 | } |
| 614 | |
| 615 | // hasHostCatchAllKey returns true if sb has a key that |
| 616 | // omits a host portion, i.e. it "catches all" hosts. |