# error_log stdout debug;

stream {
    upstream xmpp {
        server 172.60.0.10:5222;
        server 172.60.0.20:5222;
        server 172.60.0.30:5222;
    }
    server {
        listen 55222;
        tcp_nodelay on;
        proxy_connect_timeout 10s; 
        proxy_timeout 12h; # Set this lower to be more flappy
        proxy_pass xmpp;
    }

    upstream bosh {
        server 172.60.0.10:7070;
        server 172.60.0.20:7070;
        server 172.60.0.30:7070;
    }
    server {
        listen 57070;
        tcp_nodelay on;
        proxy_connect_timeout 10s; 
        proxy_timeout 12h; # Set this lower to be more flappy
        proxy_pass bosh;
    }

    upstream boshs {
        server 172.60.0.10:7443;
        server 172.60.0.20:7443;
        server 172.60.0.30:7443;
    }
    server {
        listen 57443;
        tcp_nodelay on;
        proxy_connect_timeout 10s; 
        proxy_timeout 30s;
        proxy_pass boshs;
    }

    upstream s2s {
        server 172.60.0.10:5269;
        server 172.60.0.20:5269;
        server 172.60.0.30:5269;
    }
    server {
        listen 5269;
        tcp_nodelay on;
        proxy_connect_timeout 10s; 
        proxy_timeout 1m;
        proxy_pass s2s;
    }

    upstream s2slegacy {
        server 172.60.0.10:5270;
        server 172.60.0.20:5270;
        server 172.60.0.30:5270;
    }
    server {
        listen 5270;
        tcp_nodelay on;
        proxy_connect_timeout 10s; 
        proxy_timeout 1m;
        proxy_pass s2slegacy;
    }
}

events {}
