import { PeerConnection } from "bittorrent-tracker";
import { CoreEventMap, StreamConfig } from "../types.js";
import * as Command from "./commands/index.js";
import { EventTarget } from "../utils/event-target.js";
export type PeerConfig = Pick<StreamConfig, "p2pNotReceivingBytesTimeoutMs" | "webRtcMaxMessageSize" | "p2pErrorRetries" | "validateP2PSegment">;
export declare class PeerProtocol {
    private readonly connection;
    private readonly peerConfig;
    private readonly eventHandlers;
    private commandChunks?;
    private uploadingContext?;
    private readonly onChunkDownloaded;
    private readonly onChunkUploaded;
    constructor(connection: PeerConnection, peerConfig: PeerConfig, eventHandlers: {
        onCommandReceived: (command: Command.PeerCommand) => void;
        onSegmentChunkReceived: (data: Uint8Array) => void;
    }, eventTarget: EventTarget<CoreEventMap>);
    private onDataReceived;
    sendCommand(command: Command.PeerCommand): void;
    stopUploadingSegmentData(): void;
    getUploadingRequestId(): number | undefined;
    splitSegmentDataToChunksAndUploadAsync(data: Uint8Array, requestId: number): Promise<void>;
    private receivingCommandBytes;
}
