code: func RequestIsForLocalhost(r *http.Request) bool {
  	hostHost := missinggo.SplitHostMaybePort(r.Host).Host
  	if ip := net.ParseIP(hostHost); ip != nil {
  		return ip.IsLoopback()
  	}
  	return hostHost == "localhost"
  }
docs: // Request is intended for localhost, either with a localhost name, or
  // loopback IP.