public class STUNResolver extends TransportResolver
Modifier and Type | Class and Description |
---|---|
protected class |
STUNResolver.STUNService
STUN service definition.
|
TransportResolver.Type
Modifier and Type | Field and Description |
---|---|
protected STUNResolver.STUNService |
currentServer |
protected int |
defaultPort |
protected String |
resolvedLocalIP |
protected String |
resolvedPublicIP |
protected Thread |
resolverThread |
static String |
STUNSERVERS_FILENAME |
candidates, CHECK_TIMEOUT, type
Constructor and Description |
---|
STUNResolver()
Constructor with default STUN server.
|
STUNResolver(int defaultPort)
Constructor with a default port.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel any operation.
|
void |
clear()
Clear the list of candidates and start the resolution again.
|
String |
getCurrentServerName()
Get the name of the current STUN server.
|
int |
getCurrentServerPort()
Get the port of the current STUN server.
|
void |
initialize()
Initialize the resolver.
|
boolean |
isResolving()
Return true if the service is working.
|
ArrayList<STUNResolver.STUNService> |
loadSTUNServers()
Load a list of services: STUN servers and ports.
|
ArrayList<STUNResolver.STUNService> |
loadSTUNServers(InputStream stunConfigStream)
Load the STUN configuration from a stream.
|
void |
resolve(JingleSession session)
Resolve the IP and obtain a valid transport method.
|
void |
setSTUNService(String ip,
int port)
Set the STUN server name and port
|
addCandidate, addListener, clearCandidates, getCandidate, getCandidateCount, getCandidates, getCandidatesList, getFreePort, getListenersList, getPreferredCandidate, getType, initializeAndWait, isInitialized, isResolved, removeListener, setInitialized, setResolveEnd, setResolveInit, setType, triggerCandidateAdded
public static final String STUNSERVERS_FILENAME
protected STUNResolver.STUNService currentServer
protected Thread resolverThread
protected int defaultPort
protected String resolvedPublicIP
protected String resolvedLocalIP
public STUNResolver()
public STUNResolver(int defaultPort)
defaultPort
- Port to use by default.public boolean isResolving()
isResolving
in class TransportResolver
TransportResolver.isResolving()
public void setSTUNService(String ip, int port)
ip
- the STUN server nameport
- the STUN server portpublic String getCurrentServerName()
public int getCurrentServerPort()
public ArrayList<STUNResolver.STUNService> loadSTUNServers(InputStream stunConfigStream)
stunConfigStream
- An InputStream with the configuration file.public ArrayList<STUNResolver.STUNService> loadSTUNServers()
iphone-stun.freenet.de:3478 larry.gloo.net:3478 stun.xten.net:3478 stun.fwdnet.net stun.fwd.org (no DNS SRV record) stun01.sipphone.com (no DNS SRV record) stun.softjoys.com (no DNS SRV record) stun.voipbuster.com (no DNS SRV record) stun.voxgratia.org (no DNS SRV record) stun.noc.ams-ix.netThis list should be contained in a file in the "META-INF" directory
public void resolve(JingleSession session) throws XMPPException, SmackException.NotConnectedException
resolve
in class TransportResolver
SmackException.NotConnectedException
XMPPException
public void initialize() throws XMPPException
initialize
in class TransportResolver
XMPPException
public void cancel() throws XMPPException
cancel
in class TransportResolver
XMPPException
TransportResolver.cancel()
public void clear() throws XMPPException
clear
in class TransportResolver
XMPPException
TransportResolver.clear()