Configuration
Prev | Chapter 14. Tigase STUN Component | Next

## Configuration

Below is an example configuration for STUN component. Note that the 2 `stun-primary` and 2 `stun-secondary` settings are required, where external settings are not.

    stun (class: tigase.stun.StunComponent) {
        'stun-primary-ip' = '10.0.0.1'
        'stun-primary-port' = 3478
        'stun-secondary-ip' = '10.0.0.2'
        'stun-secondary-port' = 7001
        'stun-primary-external-ip' = '172.16.0.22'
        'stun-primary-external-port' = 3479
        'stun-secondary-external-ip' = '172.16.0.23'
        'stun-secondary-external-port' = 7002
    }

### Note

Primary port should be set to 3478 as it is default port for STUN servers.

### Setting descriptions

1. `stun-primary-ip` - primary IP address of STUN server used for binding (and sending to client if stun-primary-external-ip)
2. `stun-primary-port` - primary port of STUN server used for binding (and sending to client if stun-primary-external-port)
3. `stun-secondary-ip` - secondary IP address of STUN server used for binding (and sending to client if stun-secondary-external-ip)
4. `stun-secondary-ip` - secondary port of STUN server used for binding (and sending to client if stun-secondary-external-port)

If you wish to have a secondary STUN server as a backup, or to provide multiple addresses for STUN services, the following may be used.

1. `stun-primary-external-ip` - primary external IP address of STUN server used for sending to client if set
2. `stun-primary-external-port` - primary external port of STUN server used for sending to client if set
3. `stun-secondary-external-ip` - secondary external IP address of STUN server used for sending to client if set
4. `stun-secondary-external-port` - secondary external port of STUN server used for sending to client if set

### Logback configuration

You man want to use logback for STUN server to append normal server logs. To do this, specify the logback xml file within java options in the `tigase.conf` file.

    JAVA_OPTIONS="-Dlogback.configurationFile=etc/logback.xml"

You may configure the logback by editing the xml included with distributions at logback.xml.

What is included is a basic logback configuration that just adds the stun logging.

    <configuration  scan="true">

      <appender name="STDOUT"
        class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
          <pattern>
            %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
         </pattern>
        </encoder>
      </appender>

      <logger name="de.javawi.jstun.header.MessageHeader" level="INFO" />

      <root level="DEBUG">
        <appender-ref ref="STDOUT" />
      </root>

    </configuration>

Prev | Up | Next
Chapter 14. Tigase STUN Component | Home | Chapter 15. Tigase SPAM Filter