/// import Address from './address'; interface ParseUdpFrame { rsv: Buffer; frag: number; address: Address; data: Buffer; } /** * UdpRelay will create a UDP relay server, * and it happens only once because of the singleton design pattern */ declare class UdpRelay { /** * Save the instance for further use */ private static instance; /** * Datagram socket */ private udpRelay; private constructor(); /** * The static method that controls the access to the UdpRelay instance * @param port - Port to bind socket to * @returns UdpRelay */ static getInstance(port: number): UdpRelay; /** * Creates a SOCKS UDP frame * @param address - The address to forward data to * @param data - The data to be forwarded * @param frag - The fragment number * @returns Buffer */ static createUdpFrame(address: Address, data: Buffer, frag?: number): Buffer; /** * Parses a SOCKS UDP frame * @param buffer - data to be parse * @returns ParseUdpFrame */ static parseUdpFrame(buffer: Buffer): ParseUdpFrame; /** * Close Relay's socket * @param callback - Called when the socket has been closed */ close(callback?: () => void): void; } export default UdpRelay;