mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Add Socks5ProxyInternalFactory interface and use in Socks5ProxyProvider
Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
parent
c573672fce
commit
1b0bd5f9c6
4 changed files with 32 additions and 6 deletions
|
@ -17,12 +17,12 @@
|
|||
|
||||
package bisq.network;
|
||||
|
||||
import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy;
|
||||
|
||||
import bisq.network.p2p.network.NetworkNode;
|
||||
import bisq.network.p2p.network.Socks5ProxyInternalFactory;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
|
||||
import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
@ -49,7 +49,7 @@ public class Socks5ProxyProvider {
|
|||
private static final Logger log = LoggerFactory.getLogger(Socks5ProxyProvider.class);
|
||||
|
||||
@Nullable
|
||||
private NetworkNode socks5ProxyInternalFactory;
|
||||
private Socks5ProxyInternalFactory socks5ProxyInternalFactory;
|
||||
|
||||
// proxy used for btc network
|
||||
@Nullable
|
||||
|
@ -91,7 +91,7 @@ public class Socks5ProxyProvider {
|
|||
return socks5ProxyInternalFactory.getSocksProxy();
|
||||
}
|
||||
|
||||
public void setSocks5ProxyInternal(@Nullable NetworkNode bisqSocks5ProxyFactory) {
|
||||
public void setSocks5ProxyInternal(@Nullable Socks5ProxyInternalFactory bisqSocks5ProxyFactory) {
|
||||
this.socks5ProxyInternalFactory = bisqSocks5ProxyFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
// Run in UserThread
|
||||
public abstract class NetworkNode implements MessageListener {
|
||||
public abstract class NetworkNode implements MessageListener, Socks5ProxyInternalFactory {
|
||||
private static final Logger log = LoggerFactory.getLogger(NetworkNode.class);
|
||||
private static final int CREATE_SOCKET_TIMEOUT = (int) TimeUnit.SECONDS.toMillis(120);
|
||||
|
||||
|
@ -277,6 +277,7 @@ public abstract class NetworkNode implements MessageListener {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Socks5Proxy getSocksProxy() {
|
||||
return null;
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bisq is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.network.p2p.network;
|
||||
|
||||
import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy;
|
||||
|
||||
public interface Socks5ProxyInternalFactory {
|
||||
Socks5Proxy getSocksProxy();
|
||||
}
|
|
@ -104,6 +104,7 @@ public class TorNetworkNode extends NetworkNode {
|
|||
return new TorSocket(peerNodeAddress.getHostName(), peerNodeAddress.getPort(), torControlHost, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socks5Proxy getSocksProxy() {
|
||||
try {
|
||||
String stream = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue