1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import { Duplex } from 'stream';
|
7 | import * as tls from 'tls';
|
8 | import { Socket } from 'net';
|
9 | import { EventEmitter } from 'events';
|
10 | import Debug from './debug';
|
11 | import Message from './message';
|
12 | import OutgoingMessageStream from './outgoing-message-stream';
|
13 | declare 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 | }
|
33 | export default MessageIO;
|