|
|
|
|
@ -107,12 +107,6 @@ public class NetworkAddressManagerServiceImpl
|
|
|
|
|
public static final String BIND_RETRIES_PROPERTY_NAME
|
|
|
|
|
= "net.java.sip.communicator.service.netaddr.BIND_RETRIES";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Default STUN server address.
|
|
|
|
|
*/
|
|
|
|
|
public static final String DEFAULT_STUN_SERVER_ADDRESS
|
|
|
|
|
= "stun.iptel.org";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Default STUN server port.
|
|
|
|
|
*/
|
|
|
|
|
@ -141,11 +135,8 @@ public void start()
|
|
|
|
|
if (stunAddressStr == null
|
|
|
|
|
|| portStr == null)
|
|
|
|
|
{
|
|
|
|
|
useStun = false;
|
|
|
|
|
//we use the default stun server address only for chosing a public
|
|
|
|
|
//route and not for stun queries.
|
|
|
|
|
stunServerAddress = new StunAddress(DEFAULT_STUN_SERVER_ADDRESS
|
|
|
|
|
, DEFAULT_STUN_SERVER_PORT);
|
|
|
|
|
useStun = false;
|
|
|
|
|
|
|
|
|
|
logger.info("Stun server address("
|
|
|
|
|
+stunAddressStr+")/port("
|
|
|
|
|
+portStr
|
|
|
|
|
@ -160,10 +151,10 @@ public void start()
|
|
|
|
|
}
|
|
|
|
|
catch (NumberFormatException ex)
|
|
|
|
|
{
|
|
|
|
|
logger.error(portStr + " is not a valid port number. "
|
|
|
|
|
logger.info(portStr + " is not a valid port number. "
|
|
|
|
|
+"Defaulting to 3478",
|
|
|
|
|
ex);
|
|
|
|
|
port = 3478;
|
|
|
|
|
port = DEFAULT_STUN_SERVER_PORT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stunServerAddress = new StunAddress(stunAddressStr, port);
|
|
|
|
|
@ -426,28 +417,6 @@ public InetSocketAddress getPublicAddressFor(InetAddress dst, int port)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tries to obtain a mapped/public address for the specified port (possibly
|
|
|
|
|
* by executing a STUN query).
|
|
|
|
|
*
|
|
|
|
|
* @param port the port whose mapping we are interested in.
|
|
|
|
|
*
|
|
|
|
|
* @return a public address corresponding to the specified port or null
|
|
|
|
|
* if all attempts to retrieve such an address have failed.
|
|
|
|
|
*
|
|
|
|
|
* @throws IOException if an error occurs while stun4j is using sockets.
|
|
|
|
|
* @throws BindException if the port is already in use.
|
|
|
|
|
*/
|
|
|
|
|
public InetSocketAddress getPublicAddressFor(int port)
|
|
|
|
|
throws IOException,
|
|
|
|
|
BindException
|
|
|
|
|
{
|
|
|
|
|
return getPublicAddressFor(
|
|
|
|
|
this.stunServerAddress.getSocketAddress().getAddress()
|
|
|
|
|
, port);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This method gets called when a bound property is changed.
|
|
|
|
|
* @param evt A PropertyChangeEvent object describing the event source
|
|
|
|
|
|