UNPKG

@trezub/ts-rcon

Version:

Rcon client implemented in Node.js with TypeScript

48 lines (47 loc) 1.32 kB
import { TypedEmitter } from 'tiny-typed-emitter'; declare enum PacketType { COMMAND = 2, AUTH = 3, RESPONSE_VALUE = 0, RESPONSE_AUTH = 2 } interface Options { tcp?: boolean; challenge?: boolean; id?: number; } export interface RconEvents { 'error': (err: any) => any; 'server': (str: string) => any; 'response': (str: string) => any; 'auth': () => any; /** * emitted when connected to socket */ 'connect': () => any; 'end': () => any; } export declare class Rcon extends TypedEmitter<RconEvents> { private host; private port; private password; private hasAuthed; private outstandingData; private tcp; private challenge; private _challengeToken; private _tcpSocket; private _udpSocket; private _runningCommands; constructor(host: string, port: number, password: string, options?: Options); send: (data: string, cmd?: PacketType | undefined) => Promise<string | undefined>; private _sendSocket; connect: () => void; disconnect: () => void; setTimeout: (timeout: number, callback: () => void) => void; private _udpSocketOnData; private _tcpSocketOnData; socketOnConnect: () => void; socketOnEnd: () => void; } export {};