import type { Connection, Stream, AbortOptions } from '@libp2p/interface';
/**
 * Close the passed stream, falling back to aborting the stream if closing
 * cleanly fails.
 */
export declare function safelyCloseStream(stream?: Stream, options?: AbortOptions): Promise<void>;
export interface SafelyCloseConnectionOptions extends AbortOptions {
    /**
     * Only close the stream if it either has no protocol streams open or only
     * ones in this list.
     *
     * @default ['/ipfs/id/1.0.0']
     */
    closableProtocols?: string[];
}
/**
 * Close the passed connection if it has no streams, or only closable protocol
 * streams, falling back to aborting the connection if closing it cleanly fails.
 */
export declare function safelyCloseConnectionIfUnused(connection?: Connection, options?: SafelyCloseConnectionOptions): Promise<void>;
//# sourceMappingURL=close.d.ts.map