matterbridge
Version:
Matterbridge plugin manager for Matter
84 lines • 3.74 kB
TypeScript
/**
* @description This file contains the network functions.
* @file network.ts
* @author Luca Liguori
* @created 2024-02-17
* @version 1.0.1
* @license Apache-2.0
*
* Copyright 2024, 2025, 2026 Luca Liguori.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Retrieves the IPv4 address of the first non-internal network interface.
*
* @returns {string | undefined} The IPv4 address of the selected network interface, or undefined if not found.
*/
export declare function getIpv4InterfaceAddress(): string | undefined;
/**
* Retrieves the IPv6 address of the first non-internal network interface.
*
* @returns {string | undefined} The IPv4 address of the selected network interface, or undefined if not found.
*/
export declare function getIpv6InterfaceAddress(): string | undefined;
/**
* Retrieves the mac address of the first non-internal network interface.
*
* @returns {string | undefined} The mac address, or undefined if not found.
*/
export declare function getMacAddress(): string | undefined;
/**
* Logs the available network interfaces and their details.
*
* @returns {void}
*/
export declare function logInterfaces(): void;
/**
* Resolves the given hostname to an IP address.
*
* @param {string} hostname - The hostname to resolve.
* @param {0 | 4 | 6} [family] - The address family to use (0 for any, 4 for IPv4, 6 for IPv6). Default is 4.
* @returns {Promise<string | null>} - A promise that resolves to the IP address or null if not found.
*
* @remarks
* This function uses DNS lookup to resolve the hostname, which can take some time to complete.
*/
export declare function resolveHostname(hostname: string, family?: 0 | 4 | 6): Promise<string | null>;
/**
* Retrieves the version of an npm package from the npm registry.
*
* @param {string} packageName - The name of the npm package.
* @param {string} [tag] - The tag of the package version to retrieve (default is 'latest').
* @param {number} [timeout] - The timeout duration in milliseconds (default is 10000ms).
* @returns {Promise<string>} A promise that resolves to the version string of the package.
* @throws {Error} If the request fails or the tag is not found.
*/
export declare function getNpmPackageVersion(packageName: string, tag?: string, timeout?: number): Promise<string>;
/**
* Retrieves a file from the public directory of the Matterbridge GitHub repository.
*
* @param {string} branch - The branch from which to fetch the file.
* @param {string} file - The file path to fetch.
* @param {number} [timeout] - The timeout duration in milliseconds (default is 10000ms).
* @returns {Promise<Record<string, boolean | string | number>>} A promise that resolves to the parsed JSON object from the file.
* @throws {Error} If the request fails or the JSON parsing fails.
*/
export declare function getGitHubUpdate(branch: string, file: string, timeout?: number): Promise<Record<string, boolean | string | number>>;
/**
* Retrieves the path to the global Node.js modules directory.
*
* @returns {Promise<string>} A promise that resolves to the path of the global Node.js modules directory.
*/
export declare function getGlobalNodeModules(): Promise<string>;
//# sourceMappingURL=network.d.ts.map