MCPcopy
hub / github.com/caddyserver/caddy / hostsFromKeysNotHTTP

Method hostsFromKeysNotHTTP

caddyconfig/httpcaddyfile/directives.go:594–613  ·  view source on GitHub ↗
(httpPort string)

Source from the content-addressed store, hash-verified

592}
593
594func (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.

Callers 1

buildTLSAppMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected