<commit_before>/*
 * TurnServer, the OpenSource Java Solution for TURN protocol. Maintained by the
 * Jitsi community (http://jitsi.org).
 * 
 * Distributable under LGPL license. See terms of license at gnu.org.
 */

package org.jitsi.turnserver.stack;

import java.io.*;
import java.net.*;
import java.util.logging.*;

import org.ice4j.*;
import org.ice4j.socket.*;
import org.ice4j.stunclient.*;
import org.jitsi.turnserver.*;
import org.jitsi.turnserver.listeners.*;

/**
 * The class to run a Turn server.
 * 
 * @author <NAME>
 */
public class TurnServer
{
    private static Logger logger = Logger.getLogger(TurnServer.class.getName());

    private TransportAddress localAddress = null;

    private boolean started = false;

    private TurnStack turnStack = null;

    private IceUdpSocketWrapper sock;

    private final ServerPeerUdpEventHandler peerUdpHandler;
    
    private final ServerChannelDataEventHandler channelDataHandler;
    
    public TurnServer(TransportAddress localUDPAddress)
    {
        this.localAddress = localUDPAddress;
        this.peerUdpHandler = new ServerPeerUdpEventHandler();
        this.channelDataHandler = new ServerChannelDataEventHandler();
        
        turnStack = new TurnStack(this.peerUdpHandler,this.channelDataHandler);
        
        this.peerUdpHandler.setTurnStack(turnStack);
        this.channelDataHandler.setTurnStack(turnStack);
        
        logger.info("Server initialized Waiting to be started");
    }

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception
    {
        //getPublicAddress();
        //getLocalAddress();
        TransportAddress localAddress = null;
        if (args.length == 2)
        {
            localAddress =
                new TransportAddress(args[0], Integer.valueOf(args[1]),
                    Transport.UDP);
        }
        else
        {
            localAddress =
                new TransportAddress(InetAddress.getLocalHost(), 3478,
                    Transport.UDP);<commit_msg>Updates adddress discovery for TURN.<commit_after>/*
 * TurnServer, the OpenSource Java Solution for TURN protocol. Maintained by the
 * Jitsi community (http://jitsi.org).
 * 
 * Distributable under LGPL license. See terms of license at gnu.org.
 */

package org.jitsi.turnserver.stack;

import java.io.*;
import java.net.*;
import java.util.logging.*;

import org.ice4j.*;
import org.ice4j.socket.*;
import org.ice4j.stunclient.StunDiscoveryReport;
import org.jitsi.turnserver.*;
import org.jitsi.turnserver.listeners.*;
import org.jitsi.turnserver.turnClient.*;

/**
 * The class to run a Turn server.
 * 
 * @author <NAME>
 */
public class TurnServer
{
    private static Logger logger = Logger.getLogger(TurnServer.class.getName());

    private TransportAddress localAddress = null;

    private boolean started = false;

    private TurnStack turnStack = null;

    private IceUdpSocketWrapper sock;

    private final ServerPeerUdpEventHandler peerUdpHandler;
    
    private final ServerChannelDataEventHandler channelDataHandler;
    
    public TurnServer(TransportAddress localUDPAddress)
    {
        this.localAddress = localUDPAddress;
        this.peerUdpHandler = new ServerPeerUdpEventHandler();
        this.channelDataHandler = new ServerChannelDataEventHandler();
        
        turnStack = new TurnStack(this.peerUdpHandler,this.channelDataHandler);
        System.out.println("Setting turnstack.");
        this.peerUdpHandler.setTurnStack(turnStack);
        this.channelDataHandler.setTurnStack(turnStack);
        
        logger.info("Server initialized Waiting to be started");
    }

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception
    {
        //getPublicAddress();
        //getLocalAddress();
        TransportAddress localAddress = null;
        if (args.length == 2)
        {
            localAddress =
                new TransportAddress(args[0], Integer.valueOf(args[1]),
                    Transport.UDP);
        }
        else
        {
            localAddress =
                new TransportAddress(InetAddress.getLocalHost(), 3478,
                    Transport.UDP);
{'fraction_non_alphanumeric': 0.09467174119885823, 'fraction_numerical': 0.004757373929590866, 'mean_word_length': 2.68859649122807, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1553585', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1132, 'n_words': 273}