Using mod_tcpproxy an XMPP client (including those using BOSH) can initiate a pipe to a given TCP/IP address and port. This implementation uses the In-Band Bytestreams XEP, simply extended with 2 new attributes in a new namespace, host and port.
Just add tcpproxy as a component, for example:
Component "tcp.example.com" "tcpproxy"
A new stream is opened like this:
iq type="set" id="newconn1" to="tcp.example.com"> <open xmlns='http://jabber.org/protocol/ibb' < sid='connection1' block-size='4096' stanza='message' xmlns:tcp='http://prosody.im/protocol/tcpproxy' tcp:host='example.com' tcp:port='80' /> iq></
The stanza attribute (currently) MUST be ‘message’, and block-size is (currently) ignored.
In response to this stanza you will receive a result upon connection success, or an error if the connection failed. You can then send to the connection by sending message stanzas as described in the IBB XEP. Incoming data will likewise be delivered as messages.
With the plugin installer in Prosody 0.12 you can use:
sudo prosodyctl install --server=https://modules.prosody.im/rocks/ mod_tcpproxy
For earlier versions see the documentation for installing 3rd party modules