/** * Navidrome MCP Server - Network Safety Helpers * Copyright (C) 2025 * SPDX-License-Identifier: AGPL-3.0-or-later */ import { type Dispatcher } from 'undici'; /** * The URL parser strips tab, LF and CR, so a string holding them parses clean while callers store * and play the raw string with the control characters intact. */ export declare function hasControlChars(value: string): boolean; /** * fetch can probe only http and https, though mpv also plays mms, rtsp and rtmp. Callers reject * other schemes up front with a clear message instead of an opaque fetch error. */ export declare function isHttpUrlScheme(url: string): boolean; /** * This guards untrusted stream URLs against SSRF, such as a public URL that redirects to localhost. * Unparseable input counts as private, so callers fail closed. */ export declare function isPrivateOrLocalIp(ip: string): boolean; /** * Any private record counts, since the connection may use any of them. A DNS failure throws, and * callers treat it as unsafe. */ export declare function hostResolvesToPrivateIp(host: string): Promise; /** * The recommendation engine matches this phrase to tell an SSRF refusal from a network failure, so * every refusal message uses this constant. */ export declare const PRIVATE_ADDRESS_REFUSAL = "private/local address"; /** * The recommendation engine matches this phrase, since a strict-parser rejection is deterministic * and a retry never helps. */ export declare const NON_STANDARD_HTTP_RESPONSE = "server sent a non-standard HTTP/ICY response"; /** HTTPParserError is matched by name, since its `code` varies by parser failure or is unset. */ export declare function isHttpParserError(err: unknown): boolean; /** * undici reports every connection failure, the private-IP refusal included, as "fetch failed" with * the reason in a nested `cause`. */ export declare function describeFetchError(err: unknown): string; /** * Node's bundled fetch rejects an external undici dispatcher. undici's RequestInit and Response are * separate copies of the WHATWG types, so they cast through `unknown`. */ export declare function fetchWithDispatcher(url: string, init: RequestInit, dispatcher: Dispatcher): Promise; /** * Every connection that lands on a private IP is refused, redirect hops included. The proxy is * skipped, since behind a proxy the peer check would see the proxy and not the target. */ export declare function safeFetch(url: string, init: RequestInit): Promise; //# sourceMappingURL=network-safety.d.ts.map