import type { Express } from 'express';
import type { Server } from 'ws';
import type { M3u8DLOptions, M3u8DLProgressStats, M3u8WorkerPool, TsItemInfo } from '../types/m3u8.js';
interface DLServerOptions {
    port?: number;
    cacheDir?: string;
    configPath?: string;
    debug?: boolean;
    /** 登录 token，默认取环境变量 DS_SECRET */
    token?: string;
    /** 是否限制文件访问(localplay视频资源等仅可读取下载和缓存目录) */
    limitFileAccess?: boolean;
}
interface CacheItem extends Partial<M3u8DLProgressStats> {
    url: string;
    /** 用户设置的参数 */
    options: M3u8DLOptions;
    /** 格式化后实际下载使用的参数 */
    dlOptions?: M3u8DLOptions;
    status: 'pause' | 'resume' | 'done' | 'pending' | 'error';
    current?: TsItemInfo;
    workPoll?: M3u8WorkerPool;
}
export declare class DLServer {
    app: Express;
    wss: Server;
    /** DS 参数 */
    options: DLServerOptions;
    private serverInfo;
    private cfg;
    /** 下载任务缓存 */
    private dlCache;
    /** 正在下载的任务数量 */
    private get downloading();
    constructor(opts?: DLServerOptions);
    private init;
    private loadCache;
    private checkDLFileLaest;
    private checkDLFileTimer;
    private checkDLFileIsExists;
    dlCacheClone(): [string, CacheItem][];
    private cacheSaveTimer;
    saveCache(): void;
    private readConfig;
    saveConfig(config: M3u8DLOptions, configPath?: string): void;
    private createApp;
    private startDownload;
    startNextPending(): void;
    private wsSend;
    private initRouters;
}
export {};
