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 java.lang.String |
resolvedLocalIP |
protected java.lang.String |
resolvedPublicIP |
protected java.lang.Thread |
resolverThread |
static java.lang.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.
|
java.lang.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.
|
java.util.ArrayList<STUNResolver.STUNService> |
loadSTUNServers()
Load a list of services: STUN servers and ports.
|
java.util.ArrayList<STUNResolver.STUNService> |
loadSTUNServers(java.io.InputStream stunConfigStream)
Load the STUN configuration from a stream.
|
void |
resolve(JingleSession session)
Resolve the IP and obtain a valid transport method.
|
void |
setSTUNService(java.lang.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, triggerCandidateAddedpublic static final java.lang.String STUNSERVERS_FILENAME
protected STUNResolver.STUNService currentServer
protected java.lang.Thread resolverThread
protected int defaultPort
protected java.lang.String resolvedPublicIP
protected java.lang.String resolvedLocalIP
public STUNResolver()
public STUNResolver(int defaultPort)
defaultPort - Port to use by default.public boolean isResolving()
isResolving in class TransportResolverTransportResolver.isResolving()public void setSTUNService(java.lang.String ip,
int port)
ip - the STUN server nameport - the STUN server portpublic java.lang.String getCurrentServerName()
public int getCurrentServerPort()
public java.util.ArrayList<STUNResolver.STUNService> loadSTUNServers(java.io.InputStream stunConfigStream)
stunConfigStream - An InputStream with the configuration file.public java.util.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.net
This list should be contained in a file in the "META-INF" directorypublic void resolve(JingleSession session) throws org.jivesoftware.smack.XMPPException, org.jivesoftware.smack.SmackException.NotConnectedException
resolve in class TransportResolverorg.jivesoftware.smack.SmackException.NotConnectedExceptionorg.jivesoftware.smack.XMPPExceptionpublic void initialize()
throws org.jivesoftware.smack.XMPPException
initialize in class TransportResolverorg.jivesoftware.smack.XMPPExceptionpublic void cancel()
throws org.jivesoftware.smack.XMPPException
cancel in class TransportResolverorg.jivesoftware.smack.XMPPExceptionTransportResolver.cancel()public void clear()
throws org.jivesoftware.smack.XMPPException
clear in class TransportResolverorg.jivesoftware.smack.XMPPExceptionTransportResolver.clear()