From c3e64636766716d996de3689f71c6a8dd09fee9f Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 2 Nov 2015 19:27:42 -0700 Subject: [PATCH] A few comments, slight tweaks --- caddy/caddy.go | 2 +- caddy/config.go | 1 + caddy/helpers.go | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/caddy/caddy.go b/caddy/caddy.go index 5d3785e1..f92666f0 100644 --- a/caddy/caddy.go +++ b/caddy/caddy.go @@ -39,7 +39,7 @@ var ( // The name and version of the application. AppName, AppVersion string - // If true, initialization will not show any output. + // If true, initialization will not show any informative output. Quiet bool // DefaultInput is the default configuration to use when config input is empty or missing. diff --git a/caddy/config.go b/caddy/config.go index 4bf111a1..0b14ca59 100644 --- a/caddy/config.go +++ b/caddy/config.go @@ -278,6 +278,7 @@ func arrangeBindings(allConfigs []server.Config) (Group, error) { func resolveAddr(conf server.Config) (resolvAddr *net.TCPAddr, warnErr error, fatalErr error) { bindHost := conf.BindHost + // TODO: Do we even need the port? Maybe we just need to look up the host. resolvAddr, warnErr = net.ResolveTCPAddr("tcp", net.JoinHostPort(bindHost, conf.Port)) if warnErr != nil { // Most likely the host lookup failed or the port is unknown diff --git a/caddy/helpers.go b/caddy/helpers.go index c606f941..66446a6c 100644 --- a/caddy/helpers.go +++ b/caddy/helpers.go @@ -16,9 +16,9 @@ func init() { letsencrypt.OnChange = func() error { return Restart(nil) } } -// isLocalhost returns true if the string looks explicitly like a localhost address. -func isLocalhost(s string) bool { - return s == "localhost" || s == "::1" || strings.HasPrefix(s, "127.") +// isLocalhost returns true if host looks explicitly like a localhost address. +func isLocalhost(host string) bool { + return host == "localhost" || host == "::1" || strings.HasPrefix(host, "127.") } // checkFdlimit issues a warning if the OS max file descriptors is below a recommended minimum.