UNPKG

1.23 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="node" />
3/// <reference types="node" />
4/// <reference types="node" />
5/// <reference types="node" />
6import { Duplex } from 'stream';
7import * as tls from 'tls';
8import { Socket } from 'net';
9import { EventEmitter } from 'events';
10import Debug from './debug';
11import Message from './message';
12import OutgoingMessageStream from './outgoing-message-stream';
13declare class MessageIO extends EventEmitter {
14 socket: Socket;
15 debug: Debug;
16 tlsNegotiationComplete: boolean;
17 private incomingMessageStream;
18 outgoingMessageStream: OutgoingMessageStream;
19 securePair?: {
20 cleartext: tls.TLSSocket;
21 encrypted: Duplex;
22 };
23 incomingMessageIterator: AsyncIterableIterator<Message>;
24 constructor(socket: Socket, packetSize: number, debug: Debug);
25 packetSize(...args: [number]): number;
26 startTls(credentialsDetails: tls.SecureContextOptions, hostname: string, trustServerCertificate: boolean): Promise<void>;
27 sendMessage(packetType: number, data?: Buffer, resetConnection?: boolean): Message;
28 /**
29 * Read the next incoming message from the socket.
30 */
31 readMessage(): Promise<Message>;
32}
33export default MessageIO;