summaryrefslogtreecommitdiff
path: root/listeners.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-04-16 11:41:32 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-04-16 11:41:32 -0600
commitf5ccb904a3db2bffd980feee685afaa762224cb2 (patch)
treecb6eb567c4c1d92cb01c5ab8d4d8d6889fab6d07 /listeners.go
parent829e36d535cf5bbff7cf0f510608e6fca956cec4 (diff)
admin: Disable host checking if wildcard interface is specified
To clarify, listening on wildcard interfaces is NOT the default and should only be done under certain circumstances and when you know what you're doing. Emits a warning in the log. Fixes https://github.com/caddyserver/caddy-docker/issues/71
Diffstat (limited to 'listeners.go')
-rw-r--r--listeners.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/listeners.go b/listeners.go
index bfbe6dd..39bd811 100644
--- a/listeners.go
+++ b/listeners.go
@@ -302,6 +302,16 @@ func (na NetworkAddress) isLoopback() bool {
return false
}
+func (na NetworkAddress) isWildcardInterface() bool {
+ if na.Host == "" {
+ return true
+ }
+ if ip := net.ParseIP(na.Host); ip != nil {
+ return ip.IsUnspecified()
+ }
+ return false
+}
+
func (na NetworkAddress) port() string {
if na.StartPort == na.EndPort {
return strconv.FormatUint(uint64(na.StartPort), 10)