hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
19 lines (14 loc) • 421 B
text/typescript
export function shouldUseProxy(url: string): boolean {
const { hostname } = new URL(url);
const noProxy = process.env.NO_PROXY;
if (hostname === "localhost" || hostname === "127.0.0.1" || noProxy === "*") {
return false;
}
if (noProxy !== undefined && noProxy !== "") {
const noProxyList = noProxy.split(",");
if (noProxyList.includes(hostname)) {
return false;
}
}
return true;
}