MCPcopy
hub / github.com/caddyserver/certmagic / SubjectIsInternal

Function SubjectIsInternal

certificates.go:609–617  ·  view source on GitHub ↗

SubjectIsInternal returns true if subj is an internal-facing hostname or address, including localhost/loopback hosts. Ports are ignored, if present.

(subj string)

Source from the content-addressed store, hash-verified

607// hostname or address, including localhost/loopback hosts.
608// Ports are ignored, if present.
609func SubjectIsInternal(subj string) bool {
610 subj = strings.ToLower(strings.TrimSuffix(hostOnly(subj), "."))
611 return subj == "localhost" ||
612 strings.HasSuffix(subj, ".localhost") ||
613 strings.HasSuffix(subj, ".local") ||
614 strings.HasSuffix(subj, ".internal") ||
615 strings.HasSuffix(subj, ".home.arpa") ||
616 isInternalIP(subj)
617}
618
619// isInternalIP returns true if the IP of addr
620// belongs to a private network IP range. addr

Callers 2

newBasicACMEClientMethod · 0.85

Calls 2

hostOnlyFunction · 0.85
isInternalIPFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…