mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Refactor: Extract method getSocks5Proxy
This commit is contained in:
parent
77f46a0a5e
commit
3a2e4f1d69
@ -104,14 +104,7 @@ public class HttpClientImpl implements HttpClient {
|
||||
@Nullable String headerValue) throws IOException {
|
||||
checkNotNull(baseUrl, "baseUrl must be set before calling requestWithGET");
|
||||
|
||||
Socks5Proxy socks5Proxy = null;
|
||||
if (socks5ProxyProvider != null) {
|
||||
// We use the custom socks5ProxyHttp. If not set we request socks5ProxyProvider.getSocks5ProxyBtc()
|
||||
// which delivers the btc proxy if set, otherwise the internal proxy.
|
||||
socks5Proxy = socks5ProxyProvider.getSocks5ProxyHttp();
|
||||
if (socks5Proxy == null)
|
||||
socks5Proxy = socks5ProxyProvider.getSocks5Proxy();
|
||||
}
|
||||
Socks5Proxy socks5Proxy = getSocks5Proxy(socks5ProxyProvider);
|
||||
if (ignoreSocks5Proxy || socks5Proxy == null || baseUrl.contains("localhost")) {
|
||||
log.debug("Use clear net for HttpClient. socks5Proxy={}, ignoreSocks5Proxy={}, baseUrl={}",
|
||||
socks5Proxy, ignoreSocks5Proxy, baseUrl);
|
||||
@ -122,6 +115,18 @@ public class HttpClientImpl implements HttpClient {
|
||||
}
|
||||
}
|
||||
|
||||
private Socks5Proxy getSocks5Proxy(Socks5ProxyProvider socks5ProxyProvider) {
|
||||
Socks5Proxy socks5Proxy = null;
|
||||
if (socks5ProxyProvider != null) {
|
||||
// We use the custom socks5ProxyHttp. If not set we request socks5ProxyProvider.getSocks5ProxyBtc()
|
||||
// which delivers the btc proxy if set, otherwise the internal proxy.
|
||||
socks5Proxy = socks5ProxyProvider.getSocks5ProxyHttp();
|
||||
if (socks5Proxy == null)
|
||||
socks5Proxy = socks5ProxyProvider.getSocks5Proxy();
|
||||
}
|
||||
return socks5Proxy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an HTTP Get request directly (not routed over socks5 proxy).
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user