MCPcopy Index your code
hub / github.com/coder/coder / ExecuteHostnamePattern

Function ExecuteHostnamePattern

coderd/workspaceapps/appurl/appurl.go:307–314  ·  view source on GitHub ↗

ExecuteHostnamePattern executes a pattern generated by CompileHostnamePattern and returns the wildcard match. If the pattern does not match the hostname, returns false.

(pattern *regexp.Regexp, hostname string)

Source from the content-addressed store, hash-verified

305// and returns the wildcard match. If the pattern does not match the hostname,
306// returns false.
307func ExecuteHostnamePattern(pattern *regexp.Regexp, hostname string) (string, bool) {
308 matches := pattern.FindStringSubmatch(hostname)
309 if len(matches) < 2 {
310 return "", false
311 }
312
313 return matches[1], true
314}
315
316// ConvertAppHostForCSP converts the wildcard host to a format accepted by CSP.
317// For example *--apps.coder.com must become *.coder.com. If there is no

Callers 4

WorkspaceAppCorsFunction · 0.92
parseHostnameMethod · 0.92

Calls

no outgoing calls

Tested by 1