/// import churn_types = require('../churn/churn.types'); import net = require('../net/net.types'); /** * A Churn Pipe is a transparent obfuscator/deobfuscator for transforming the * apparent type of browser-generated UDP datagrams. * * This implementation makes the simplifying assumption that the browser only * allocates one endpoint per interface. Relaxing this assumption would allow * us to achieve the same performance while allocating fewer ports, at the cost * of slightly more complex logic. */ declare class Pipe { private dispatchEvent_; private name_; private static id_; private publicSockets_; private publicPorts_; private maxSocketsPerInterface_; private mirrorSockets_; private transformer_; private browserEndpoints_; private browserPorts_; private lastInterface_; private queueManager_; constructor(dispatchEvent_: (name: string, args: Object) => void, name_?: string); setTransformer: (transformerConfig: churn_types.TransformerConfig) => Promise; /** * Returns a promise to create a socket, bind to the specified address, and * start listening for datagrams, which will be deobfuscated and forwarded to the * browser endpoint. */ bindLocal: (publicEndpoint: net.Endpoint) => Promise; private addPublicSocket_; private increaseReplication_; private emitMirror_; addBrowserEndpoint: (browserEndpoint: net.Endpoint) => Promise; private ensureRemoteEndpoint_; /** * Given an endpoint from which obfuscated datagrams may arrive, this method * constructs a corresponding mirror socket, and returns its endpoint. */ bindRemote: (remoteEndpoint: net.Endpoint) => Promise; private static anyInterface_; private getMirrorSocket_; private getMirrorSocketAndEmit_; private getLocalInterface_; private endpointFromInfo_; /** * Sends a message over the network to the specified destination. * The message is obfuscated before it hits the wire. */ private sendTo_; /** * Sends a message to the specified destination. */ private fastSend_; /** * Sends a message to the specified destination. * This version also requests an Ack from the core, and returns a Promise * that resolves when the core has sent the message. */ private tracedSend_; /** * Called when a message is received over the network from the remote side. * The message is de-obfuscated before being passed to the browser endpoint * via a corresponding mirror socket. */ private onIncomingData_; on: (name: string, listener: (event: any) => void) => void; private static closeSocket_(socket); shutdown: () => Promise; } export = Pipe;