1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 05:52:06 +01:00

Merge pull request #492 from Flowdalic/start-local-socks5-proxy

Start local SOCKS5 proxy
This commit is contained in:
Florian Schmaus 2021-10-19 14:08:57 +02:00 committed by GitHub
commit dac8b728b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -615,9 +615,7 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
if (annouceLocalStreamHost) { if (annouceLocalStreamHost) {
// add local proxy on first position if exists // add local proxy on first position if exists
List<StreamHost> localProxies = getLocalStreamHost(); List<StreamHost> localProxies = getLocalStreamHost();
if (localProxies != null) { streamHosts.addAll(localProxies);
streamHosts.addAll(localProxies);
}
} }
// query SOCKS5 proxies for network settings // query SOCKS5 proxies for network settings
@ -652,12 +650,14 @@ public final class Socks5BytestreamManager extends Manager implements Bytestream
/** /**
* Returns the stream host information of the local SOCKS5 proxy containing the IP address and * Returns the stream host information of the local SOCKS5 proxy containing the IP address and
* the port or null if local SOCKS5 proxy is not running. * the port. The returned list may be empty if the local SOCKS5 proxy is not running.
* *
* @return the stream host information of the local SOCKS5 proxy or null if local SOCKS5 proxy * @return the stream host information of the local SOCKS5 proxy
* is not running
*/ */
public List<StreamHost> getLocalStreamHost() { public List<StreamHost> getLocalStreamHost() {
// Ensure that the local SOCKS5 proxy is running (if enabled).
Socks5Proxy.getSocks5Proxy();
List<StreamHost> streamHosts = new ArrayList<>(); List<StreamHost> streamHosts = new ArrayList<>();
XMPPConnection connection = connection(); XMPPConnection connection = connection();