import tls from 'node:tls'; import { ContextAwareError } from 'cm-libs-context-aware-error'; import { Socket, TcpBase, TcpConnection } from './tcp-base'; export * from './tcp-base'; export declare enum TCP_CLIENT_PROTOCOL { TCP = "TCP", TLS = "TLS" } export type OnCheckServerIdentity = (hostname: string, cert: tls.PeerCertificate) => Error; export declare abstract class TcpClient extends TcpBase { readonly hostname: string; readonly port: number; readonly connectTimeout: number; readonly keepAliveInterval?: number; readonly idleTimeout?: number; readonly detectEarlyClosure?: number; protected ref?: T; protected protocol: TCP_CLIENT_PROTOCOL; protected tlsServerName: string; protected tlsCert: string; protected tlsKey: string; protected tlsCa: string; protected tlsOnCheckServerIdentity: OnCheckServerIdentity; protected abstract onConnect(clientId: string, hostname: string, port: number, timeout?: number): Promise; private tlsSession; protected constructor(hostname: string, port: number, connectTimeout: number, keepAliveInterval?: number, idleTimeout?: number, detectEarlyClosure?: number); protected initTls(cert?: string, key?: string, ca?: string, serverName?: string, onCheckServerIdentity?: OnCheckServerIdentity): void; protected connect(clientId: string, ref?: T): Promise>; private secureConnect; protected raiseConnectionError(socket: Socket, clientId: string, error: ContextAwareError | Error): Promise; }