/// /// /// /// import net = require('../net/net.types'); import churn_pipe_types = require('./freedom-module.interface'); import Message = churn_pipe_types.Message; /** * Listens on a port for UDP datagrams -- emitting a Freedom message for each * datagram received -- and sends UDP datagrams to a destination, in response * to Freedom messages. * * Each incoming and outgoing message is first passed through an obfuscator. * The obfuscator is used via direct function calls rather than Freedom * message passing owing to the inelegance of receiving a response *back* * from a Freedom module. */ declare class Pipe { private dispatchEvent_; private socket_; private transformer_; private remoteEndpoint_; constructor(dispatchEvent_: (name: string, args: Message) => void); /** * Returns a promise to create a socket, bind to the specified address, and * start listening for datagrams. */ bind: (localAddress: string, localPort: number, remoteAddress: string, remotePort: number, transformerName: string, key?: ArrayBuffer, config?: string) => Promise; private makeTransformer_; /** * Sends a message over the network to the remote side. * The message is obfuscated before it hits the wire. */ send: (buffer: ArrayBuffer) => any; /** * Sends a message over the network to the specified destination. * The message is obfuscated before it hits the wire. */ sendTo: (buffer: ArrayBuffer, to: net.Endpoint) => any; getLocalEndpoint: () => Promise; /** * Called when a message is received over the network from the remote side. * The message is de-obfuscated before the Freedom message is emitted. */ private onData_; } export = Pipe;