ejabberd SOCKS5 proxy – file transfer
Ejabberd XMPP server includes a SOCKS5 proxy, setting it up correctly is what
makes the difference between fast or very slow file transfer operations.
As per XEP-0065 file transfer is either peer-to-peer or mediated by a proxy
server.
In Conversation peer-to-peer transfer is done by converting the file in base64,
split it in 4 kb chunks sent one at the time always awaiting first for the ACK
of the precedent one; this makes the whole process painfully slow and bandwidth
consuming.
The other file transfer method supported by Conversation is defined by XEP-0234
(or Jingle file transfer) which relies on a SOCKS5 proxy and also allow to
negotiate parameters like encryption.
Ejabberd configuration:
acl:
proxy_users:
server:
- "hostname.domain"
access_rules:
proxy65_access:
- allow: proxy_users
proxy65_shaper:
- none: admin
- proxyrate: proxy_users
shaper:
normal: 100000
proxyrate: 1000000
modules:
...
mod_proxy65:
host: "proxy.hostname.domain"
name: "File transfer proxy"
ip: "127.0.0.1"
port: 7777
max_connections: 5
access: proxy65_access
shaper: proxy65_shaper
...
Instruct iptables to allow traffic on SOCKS5 proxy port:
INPUT -p tcp -m tcp --dport 7777 -j ACCEPT
Restart Ejabberd and reboot the phone or manually terminate (Settings -> Apps) and reopen Conversations.