1.0.0 • Published 5 months ago

proxy-hosts v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
5 months ago

hosts proxy

Override the IP address returned for one or more domains.

Note: This module modifies the core DNS library's lookup function.

Installation

pnpm add proxy-hosts

Usage

const proxyHosts = require("proxy-hosts");

// String match
proxyHosts.add("foo.com", "1.2.3.4");
// String with wild cards
proxyHosts.add("*foo.*", "1.2.3.4");
// RegExp match
proxyHosts.add(/^foo\.bar\..*$/i, "1.2.3.4");

// Remove domain entry
proxyHosts.remove("*foo.*", "1.2.3.4");

// Remove domain by matching the RegExp source attributes
// When no ip is passed any entry matching the domain will be removed
proxyHosts.remove(/^foo\.bar\..*$/i);

// Remove all domain entries
proxyHosts.clear();