/// import Connection from '../helper/connection'; /** * The ObfsMethod class is an abstract class that all other, * extended classes should implement its methods and properties * every obfuscation method should extend this class */ declare abstract class ObfsMethod { static readonly CLIENT = "CLIENT"; static readonly SERVER = "SERVER"; /** * The type of obfuscation */ type: typeof ObfsMethod.CLIENT | typeof ObfsMethod.SERVER; /** * Connection object */ protected connection: Connection; /** * The Obfuscation method name */ abstract name: string; constructor(connection: Connection, type: typeof ObfsMethod.CLIENT | typeof ObfsMethod.SERVER); /** * Checks if the message format is Appropriate with * this obfuscation method * @param message - The incoming message */ abstract check(message: Buffer): boolean; /** * Begins the handshake process for the encryption * @param callback - Emitted after the handshake process */ abstract handshake(callback: () => void): void; /** * DeObfuscates the obfuscated message * @param message - The obfuscated message */ abstract deObfuscate(message: Buffer): Buffer; /** * Obfuscates the non-obfuscated message * @param message - The non-obfuscated message */ abstract obfuscate(message: Buffer): Buffer; } export type ObfsBuilder = (connection: Connection, type?: typeof ObfsMethod.CLIENT | typeof ObfsMethod.SERVER) => ObfsMethod; export default ObfsMethod;