<?xml version='1.0'?>
<jabber xmlns:jabberd='http://jabberd.org/ns/configfile/replace' xmlns='http://jabberd.org/ns/configfile'>

    <!-- let this instance connect to the other instance of jabberd14 -->
    <service id='s2s-linker'>
	<uplink/>
	<connect>
	    <ip>127.0.0.1</ip>
	    <port>5300</port>
	    <secret>password</secret>
	</connect>
    </service>

  <!--
  The following 's2s' config handles server connections and 
  dialback hostname verification.
  The karma settings are a little higher here to handle the 
  higher traffic of server-to-server connections (read
  the io section below for more details, medium settings).
  -->

  <service id="s2s">
    <load>
      <dialback>/usr/local/lib/libjabberddialback.so</dialback>
    </load>
    <dialback xmlns='jabber:config:dialback'>
      <!--
      With the <secret/> element you can configure a fixed
      dialback secret. You will need this to cluster multiple
      s2s instances in which case all instances have to use
      the same dialback secret.
      If no secret is configured, the server will generate
      a new random secret on each start.
      -->
      <!-- <secret>somethingSecret</secret> -->

      <!--
      How long we are waiting for an outgoing connection to be
      established before we bounce pending messages to this server.
      Default: 30 seconds
      -->
      <!-- <queuetimeout>30</queuetimeout> -->

      <!--
      Close idle server to server connections after this number of
      seconds.
      Default: 900 seconds (15 minutes)
      -->
      <!-- <idletimeout>900</idletimeout> -->

      <!-- using the following configuration option, you can    -->
      <!-- disable, enable, or force the usage of features for  -->
      <!-- the interconnect to other servers.                   -->
      <!-- A setting is also applied to subdomains. E.g. a      -->
      <!-- setting for b.example.com is also used if the        -->
      <!-- dialback component establishes a connection to       -->
      <!-- service.b.example.com.                               -->
      <!-- To configure the default settings, omit the name     -->
      <!-- attribute.                                           -->
      <!-- Note: On incoming connections, the peer might not    -->
      <!-- tell who he is before we initialize our stream, and  -->
      <!-- we do not know then who the other side is. In that   -->
      <!-- case the default settings are used!                  -->
      <!--                                                      -->
      <!-- xmpp-attribute:                                      -->
      <!-- 'yes':   allow advertizing of stream version 1.0     -->
      <!--          (this is the default)                       -->
      <!-- 'no':    do not advertize or use XMPP version '1.0'  -->
      <!--                                                      -->
      <!-- tls-attribute:                                       -->
      <!-- 'yes':   allow usage of STARTTLS                     -->
      <!--          (this is the default)                       -->
      <!-- 'no':    do not use/offer STARTTLS                   -->
      <!-- 'force': require usage of STARTTLS                   -->
      <!-- number:  require usage of STARTTLS with a cipher     -->
      <!--          of at least (number) bits secret key length -->
      <!--                                                      -->
      <!-- auth-attribute:                                      -->
      <!-- 'any':   allow dialback as well as SASL EXTERNAL     -->
      <!--          authentication (this is the default)        -->
      <!-- 'db':    only allow usage of dialback, disable SASL  -->
      <!-- 'sasl':  only allow usage of SASL EXTERNAL           -->
      <!--          authentication                              -->
      <!--
      <host name='a.example.com' xmpp='no' tls='no'/>
      <host name='b.example.com' xmpp='no'/>
      <host name='c.example.com' tls='256' auth='sasl'/>
      -->

      <!-- Use these to listen on particular addresses and/or ports.
      <ip port="7000"/>
      <ip port="5269">127.0.0.1</ip>
      -->
      <ip port="5269"/>
      <karma>
        <init>50</init>
        <max>50</max>
        <inc>4</inc>
        <dec>1</dec>
        <penalty>-5</penalty>
        <restore>50</restore>
      </karma>
    </dialback>
  </service>

  <!--
  The following <io/> config initializes the top-level
  I/O, otherwise known as MIO (Managed Input/Output).
  -->

  <io>

    <!-- Set the default karma for *all* sockets -->
    <!-- definition of terms:

      * Avg. Throughput - The number of bytes you can
        send every second without incuring any penalty.

      * Burst Allowed - The maximum number of bytes you
        can send in 2 seconds without incurring any penalty.

      * Max Sustained Rate - If you send data as fast as 
        you can, you will hit penalty, and will not be 
        able to send for 10 seconds; the max sustained 
        rate is the average rate you can dump data when 
        you are dumping as much data as you can, as fast 
        as you can.

      * Seconds to Recover from Burst - The amount of time 
        it will take to reach Avg. Throughput capability 
        after sending a max burst of data.

      * Penalty Length - The length of your penalty is
        determined according to this formula:
              abs(penalty) * Heartbeat seconds
        E.g., a penalty of -5 and heartbeat of 2 will 
        cause your penalty length to be 10 seconds. 
        Note that a penalty CANNOT be less than -100, 
        otherwise strange things might happen.

    -->
    <!-- Example of Low Karma Limits 
        Avg. Throughput: 1k-2k/s 
        Burst Allowed To: 5.5k/s 
        Max Sustained Rate: 485b/s
        Seconds to Recover from Burst: 20
        Penalty Length: 12 seconds
    <karma>
      <heartbeat>2</heartbeat>
      <init>10</init>
      <max>10</max>
      <inc>1</inc>
      <dec>1</dec>
      <penalty>-6</penalty>
      <restore>10</restore>
    </karma>
    -->

    <!-- Example of Medium Karma Limits 
        Avg. Throughput: 5k-10k/s 
        Burst Allowed: 125.5k/s 
        Max Sustained Rate: 12.6k/s
        Seconds to Recover From Burst: 25
        Penalty Length: 10 seconds
    <karma>
      <heartbeat>2</heartbeat>
      <init>50</init>
      <max>50</max>
      <inc>4</inc>
      <dec>1</dec>
      <penalty>-5</penalty>
      <restore>50</restore>
    </karma>
    -->

    <!-- Example of High Karma Limits 
        Avg. Throughput: 5k-10k/s 
        Burst Allowed: 206k/s 
        Max Sustained Rate: 34.3k/s
        Seconds to Recover from Burst: 21
        Penalty Length: 6 seconds
    <karma>
      <heartbeat>2</heartbeat>
      <init>64</init>
      <max>64</max>
      <inc>6</inc>
      <dec>1</dec>
      <penalty>-3</penalty>
      <restore>64</restore>
    </karma>
    -->

    <!-- 
    Set rate limits to monitor the number of connection
    attempts from a single IP, any more than [points]
    within [time] will engage the limit.  This setting
    applies to all incoming connections to any service,
    unless otherwise overridden by that service.
    -->

    <rate points="5" time="25"/>

    <!-- 
    The following section initializes TLS (also known as SSL)
    for top-level I/O.
    This works only when the server is compiled with OpenSSL!

    As the id, use one of the following things:
    - and IP address for usage with client conns on port 5223
    - a host name for usage with the STARTTLS feature
    - a star ("*") as a default for the STARTTLS feature

    The following attributes can be defined using any value:
    - no-ssl-v2: disable usage of SSLv2
    - no-ssl-v3: disable usage of SSLv3
    - no-tls-v1: disable usage of TLSv1 (= SSLv3.1)
    - enable-workarounds: should not be needed

    By using the ciphers attribute you can select which ciphers
    are allowed to be used.
    -->
    <!--
    <tls>
      <key id='192.168.1.1'>/usr/local/etc/cert_and_key.pem</key>
      <key id='192.168.1.100'>/usr/local/etc/other_cert_and_key.pem</key>
      <key id='localhost'>/usr/local/etc/localhost.pem</key>
      <key id='*'>/usr/local/etc/default-STARTTLS.pem</key>

      <cacertfile>/usr/local/etc/cacerts.pem</cacertfile>
    </tls>
    -->

    <!-- 
    The following section is used to allow or deny 
    communications from specified IP networks or 
    addressses. If there is no <allow/> section, 
    then *all* IPs will be allowed to connect. If 
    you allow one block, then only that block may 
    connect. Note that <allow/> is checked before
    <deny/>, so if a specific address is allowed 
    but the network for that address is denied, 
    then that address will still be denied.
    -->
    <!--
    <allow><ip>127.0.0.0</ip><mask>255.255.255.0</mask></allow>
    <allow><ip>12.34.56.78</ip></allow>
    <deny><ip>22.11.44.0</ip><mask>255.255.255.0</mask></deny>
    -->

    <!--
    The following section is used to configure
    stream behaviour for individual streams
    -->
    <streamconf>
      <default type='s2s'>
        <stream-from/>
      </default>
    </streamconf>

    <!--
    With this setting it is possible to configure jabberd to detect incoming
    HTTP requests. Jabberd will then bounce the user's agent to the
    configured URI. This might be especially useful, if you run your
    jabber server on port 80 and want to bounce web requests to a different
    domain.
    -->
    <bounce>http://www.example.com/</bounce>

  </io>

  <!--
  Debugging settings. You can change these settings while jabberd is running
  and notify the running process with a SIGHUP to reread these settings
  -->
  <debug>
      <!-- which debug messages to activate -->
      <!-- ORed with the mask given on the command line -->
      <mask>0</mask>

      <!-- activate logging to syslog and specify facility -->
      <!-- default is to log to the standard output -->
      <!-- <facility>local0</facility> -->
  </debug>

  <!--
  This specifies the file to store the pid of the process in.
  -->
  <pidfile>/usr/local/var/run/jabberd/jabber-s2s.pid</pidfile>


</jabber>
