If using SOCKS5 proxy, then resolve server hostname remotely at the proxy

parent d3ee174d
...@@ -190,16 +190,26 @@ public class ConnectionThread implements ...@@ -190,16 +190,26 @@ public class ConnectionThread implements
runOnConnectionThread(new Runnable() { runOnConnectionThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if(proxyType == ProxyType.socks5) {
onReady(defaultHost, defaultPort);
}
else {
addressResolve(null, defaultHost, defaultPort, true); addressResolve(null, defaultHost, defaultPort, true);
} }
}
}); });
} else { } else {
runOnConnectionThread(new Runnable() { runOnConnectionThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if(proxyType == ProxyType.socks5) {
onReady(target.getHost(), target.getPort());
}
else {
addressResolve(fqdn, target.getHost(), target.getPort(), addressResolve(fqdn, target.getHost(), target.getPort(),
true); true);
} }
}
}); });
} }
} }
...@@ -284,6 +294,19 @@ public class ConnectionThread implements ...@@ -284,6 +294,19 @@ public class ConnectionThread implements
proxyUser, proxyPassword); proxyUser, proxyPassword);
ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration( ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(
address.getHostAddress(), port, serverName, proxy); address.getHostAddress(), port, serverName, proxy);
onReady(connectionConfiguration);
}
private void onReady(final String host, final int port) {
LogManager.i(this, "Use remote DNS for " + host);
ProxyInfo proxy = proxyType.getProxyInfo(proxyHost, proxyPort,
proxyUser, proxyPassword);
ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(
host, port, serverName, proxy);
onReady(connectionConfiguration);
}
private void onReady(ConnectionConfiguration connectionConfiguration) {
if (Build.VERSION.SDK_INT >= 14) { if (Build.VERSION.SDK_INT >= 14) {
connectionConfiguration.setTruststoreType("AndroidCAStore"); connectionConfiguration.setTruststoreType("AndroidCAStore");
connectionConfiguration.setTruststorePassword(null); connectionConfiguration.setTruststorePassword(null);
...@@ -680,9 +703,15 @@ public class ConnectionThread implements ...@@ -680,9 +703,15 @@ public class ConnectionThread implements
public void run() { public void run() {
if (useSRVLookup) if (useSRVLookup)
srvResolve(fqdn, fqdn, port); srvResolve(fqdn, fqdn, port);
else else {
if(proxyType == ProxyType.socks5) {
onReady(fqdn, port);
}
else {
addressResolve(null, fqdn, port, true); addressResolve(null, fqdn, port, true);
} }
}
}
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment