MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / resolveTargetAddresses

Function resolveTargetAddresses

server/modules/outboundTargetPolicy.js:243–271  ·  view source on GitHub ↗
(hostname)

Source from the content-addressed store, hash-verified

241}
242
243async function resolveTargetAddresses(hostname) {
244 const addresses = [];
245 const ipFamily = net.isIP(hostname);
246
247 if (ipFamily) {
248 addresses.push({
249 address: normalizeIpAddress(hostname),
250 family: ipFamily,
251 });
252 return addresses;
253 }
254
255 try {
256 const resolved = await dns.lookup(hostname, { all: true, verbatim: true });
257 resolved.forEach((entry) => {
258 const family = net.isIP(entry.address);
259 if (!family) return;
260
261 addresses.push({
262 address: normalizeIpAddress(entry.address),
263 family,
264 });
265 });
266 } catch (error) {
267 // Let downstream network errors surface naturally if DNS fails.
268 }
269
270 return addresses;
271}
272
273async function validateOutboundUrl(targetUrl, context = {}) {
274 let parsedUrl;

Callers 1

validateOutboundUrlFunction · 0.85

Calls 1

normalizeIpAddressFunction · 0.85

Tested by

no test coverage detected