Lines 1-34javascript
1/********************************************************************************
2 * Copyright (C) 2023 CoCreate and Contributors.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as published
6 * by the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
14 * You should have received a copy of the GNU Affero General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 ********************************************************************************/
HighCloud Metadata Access
Source reaches cloud instance metadata or link-local credential endpoints.
src/getInfrastructure.jsView on unpkg · L14 18import http from 'node:http';
19import https from 'node:https';
20import fs from 'node:fs';
21import os from 'node:os';
23const METADATA_IP = '169.254.169.254';
24const PROBE_TIMEOUT_MS = 500; // Fast timeout for parallel background probes
26/* STREAMING_CHUNK: Structuring the native network request wrapper... */
28 * Native, lightweight HTTP request wrapper supporting standard GET/PUT/POST operations.
30function request(options, data = null, useHttps = false) {
31 const client = useHttps ? https : http;
32 return new Promise((resolve, reject) => {
33 const req = client.request(options, (res) => {
34 if (res.statusCode < 200 || res.statusCode >= 300) {