import { connectionSymbol } from '@libp2p/interface';
import type { AbortOptions, Logger, Direction, Connection as ConnectionInterface, Stream, ConnectionTimeline, ConnectionStatus, NewStreamOptions, PeerId, ConnectionLimits, StreamMuxerFactory, Metrics, PeerStore, MultiaddrConnection } from '@libp2p/interface';
import type { Registrar } from '@libp2p/interface-internal';
import type { Multiaddr } from '@multiformats/multiaddr';
export interface ConnectionComponents {
    peerStore: PeerStore;
    registrar: Registrar;
    metrics?: Metrics;
}
export interface ConnectionInit {
    id: string;
    maConn: MultiaddrConnection;
    remotePeer: PeerId;
    direction?: Direction;
    muxerFactory?: StreamMuxerFactory;
    encryption?: string;
    limits?: ConnectionLimits;
    outboundStreamProtocolNegotiationTimeout?: number;
    inboundStreamProtocolNegotiationTimeout?: number;
}
/**
 * An implementation of the js-libp2p connection.
 * Any libp2p transport should use an upgrader to return this connection.
 */
export declare class Connection implements ConnectionInterface {
    readonly id: string;
    readonly remoteAddr: Multiaddr;
    readonly remotePeer: PeerId;
    direction: Direction;
    timeline: ConnectionTimeline;
    multiplexer?: string;
    encryption?: string;
    status: ConnectionStatus;
    limits?: ConnectionLimits;
    readonly log: Logger;
    tags: string[];
    private readonly maConn;
    private readonly muxer?;
    private readonly components;
    private readonly outboundStreamProtocolNegotiationTimeout;
    private readonly inboundStreamProtocolNegotiationTimeout;
    constructor(components: ConnectionComponents, init: ConnectionInit);
    readonly [Symbol.toStringTag] = "Connection";
    readonly [connectionSymbol] = true;
    get streams(): Stream[];
    /**
     * Create a new stream over this connection
     */
    newStream: (protocols: string[], options?: NewStreamOptions) => Promise<Stream>;
    private onIncomingStream;
    /**
     * Close the connection
     */
    close(options?: AbortOptions): Promise<void>;
    abort(err: Error): void;
}
export declare function createConnection(components: ConnectionComponents, init: ConnectionInit): ConnectionInterface;
//# sourceMappingURL=connection.d.ts.map