function validURL(url) {
  try {
    const destination = new URL(url);
    if (!VALID_PROTOCOLS.includes(destination.protocol)) return false;
    if (isInvalidIp(destination)) return false;
    return true;
  } catch {}
  return false;
}
Validates a URL
- Checks the URL forms a valid URL
- Checks the URL is at least HTTP(S)
- Checks the URL is not an internal IP - can be bypassed via COLLECTOR_ALLOW_ANY_IP
@param {string} url
@returns {boolean}