rcon-ts-valve
Version:
Improved RCON client in typescript
55 lines (54 loc) • 1.53 kB
TypeScript
import { Buffer } from 'buffer';
export declare class ExtendableError extends Error {
readonly innerException?: Error | undefined;
constructor(message?: string, innerException?: Error | undefined);
}
export declare class RconError extends ExtendableError {
constructor(message: string, innerException?: Error);
}
export declare const enum State {
Disconnected = 0,
Connecting = 0.5,
Connected = 1,
Authorized = 2,
Refused = -1,
Unauthorized = -2
}
export interface RconConfig {
host: string;
port?: number;
password: string;
timeout?: number;
}
export declare namespace Defaults {
const PORT: number;
const TIMEOUT: number;
}
export declare class Rcon implements RconConfig {
readonly host: string;
readonly port: number;
readonly password: string;
readonly timeout: number;
enableConsoleLogging: boolean;
private _authPacketId;
private _state;
private _socket;
private _lastRequestId;
private _callbacks;
private _errors;
private _connector;
private _sessionCount;
private _tempResponse;
get errors(): Error[];
get state(): State;
constructor(config: RconConfig);
connect(): Promise<Rcon>;
session<T>(context: (rcon: Rcon, sessionId: number) => Promise<T>): Promise<T>;
toString(): string;
disconnect(): void;
_handleResponse(data: Buffer): void;
send(data: string): Promise<string>;
sequentialSend(data: string[]): Promise<string[]>;
private _send;
}
export default Rcon;