import { ISocket } from "../../stream"; export type PeerServerOptions = { peer: string; enableTurn: boolean; turnDelay: number; }; export type ClientInfo = { /** peerid */ id: string; /** token */ token: string; secret?: string; /** client ip */ ip: string; socket: ISocket; options: PeerServerOptions; isBrowser: boolean; username: string; password: string; /** 运行模式 p2p 节点->节点打隧道, psp节点->服务->节点打隧道(在浏览器插件模式下的background后台, 不支持webrtc, 就需要模拟) */ mode: "p2p" | "psp"; os: string; browser: string; [key: string]: any; }; /** peer客户端操作命令 */ export type PeerClientCMD = {}; export type PeerMsg = { type: ServerMessageType; data: any; dst: string; sessionId: string; }; export declare enum ServerMessageType { Heartbeat = "heartbeat", Candidate = "candidate", Offer = "offer", Answer = "answer", Open = "open", Error = "error", IdTaken = "id-taken", InvalidKey = "invalid-key", Leave = "leave", Expire = "expire" } export type PeerServerEvent = { heartbeat: (data: any) => void; candidate: (data: any) => void; offer: (data: any) => void; answer: (data: any) => void; open: (data: any) => void; error: (err: Error) => void; idTaken: (data: any) => void; close: (data: any) => void; expire: (data: any) => void; list: (data: any) => void; };