From b1e6488bb7c9e92c49e1c38aa95c4cf0d4f6efc4 Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Sat, 8 Jul 2023 13:57:44 -0500 Subject: [PATCH] Move Socks5ProxyParams, Credentials into core (#5138) --- .../rpc/config/BitcoindInstance.scala | 2 +- .../rpc/config/BitcoindRpcAppConfig.scala | 2 +- .../org/bitcoins/core/api/node}/Peer.scala | 14 +------ .../bitcoins/core/api/tor/Credentials.scala | 6 +++ .../core/api/tor/Socks5ProxyParams.scala | 31 +++++++++++++++ .../bitcoins/dlc/node/DLCServerTorTest.scala | 3 +- .../org/bitcoins/dlc/node/DLCClient.scala | 3 +- .../dlc/node/config/DLCNodeAppConfig.scala | 3 +- .../org/bitcoins/dlc/node/peer/Peer.scala | 2 +- .../eclair/rpc/config/EclairInstance.scala | 2 +- .../bitcoins/esplora/EsploraClientTest.scala | 2 +- .../org/bitcoins/esplora/EsploraClient.scala | 1 + .../feeprovider/FeeRateProviderTest.scala | 2 +- .../feeprovider/BitGoFeeRateProvider.scala | 2 +- .../BitcoinerLiveFeeRateProvider.scala | 2 +- .../feeprovider/FeeProviderFactory.scala | 2 +- .../feeprovider/HttpFeeRateProvider.scala | 3 +- .../feeprovider/MempoolSpaceProvider.scala | 2 +- .../org/bitcoins/lnurl/LnURLClient.scala | 1 + .../org/bitcoins/node/NeutrinoNodeTest.scala | 3 +- ...NeutrinoNodeWithUncachedBitcoindTest.scala | 2 +- .../org/bitcoins/node/NeutrinoNode.scala | 3 +- .../main/scala/org/bitcoins/node/Node.scala | 2 +- .../org/bitcoins/node/NodeStreamMessage.scala | 2 +- .../scala/org/bitcoins/node/PeerData.scala | 4 +- .../scala/org/bitcoins/node/PeerFinder.scala | 5 ++- .../scala/org/bitcoins/node/PeerManager.scala | 4 +- .../bitcoins/node/config/NodeAppConfig.scala | 6 +-- .../peer/ControlMessageHandler.scala | 2 +- .../networking/peer/DataMessageHandler.scala | 2 +- .../node/networking/peer/NodeState.scala | 2 +- .../networking/peer/PeerMessageReceiver.scala | 3 +- .../networking/peer/PeerMessageSender.scala | 2 +- .../node/util/PeerMessageSenderApi.scala | 2 +- .../explorer/client/SbExplorerClient.scala | 3 +- .../client/SbExplorerClientTest.scala | 2 +- .../bitcoins/testkit/node/NodeTestUtil.scala | 6 +-- .../node/NodeTestWithCachedBitcoind.scala | 3 +- .../bitcoins/testkit/node/NodeUnitTest.scala | 3 +- .../bitcoins/tor/Socks5ClientTransport.scala | 1 + .../org/bitcoins/tor/Socks5Connection.scala | 38 ++----------------- .../org/bitcoins/tor/client/TorClient.scala | 3 +- .../bitcoins/tor/config/TorAppConfig.scala | 3 +- 43 files changed, 97 insertions(+), 94 deletions(-) rename {node/src/main/scala/org/bitcoins/node/models => core/src/main/scala/org/bitcoins/core/api/node}/Peer.scala (57%) create mode 100644 core/src/main/scala/org/bitcoins/core/api/tor/Credentials.scala create mode 100644 core/src/main/scala/org/bitcoins/core/api/tor/Socks5ProxyParams.scala diff --git a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindInstance.scala b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindInstance.scala index 6f01518ad3..beb5ce4322 100644 --- a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindInstance.scala +++ b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindInstance.scala @@ -5,9 +5,9 @@ import com.typesafe.config.ConfigFactory import grizzled.slf4j.Logging import org.bitcoins.commons.util.NativeProcessFactory import org.bitcoins.core.api.commons.{InstanceFactory, InstanceFactoryLocal} +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.config.NetworkParameters import org.bitcoins.rpc.client.common.BitcoindVersion -import org.bitcoins.tor.Socks5ProxyParams import java.io.File import java.net.URI diff --git a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindRpcAppConfig.scala b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindRpcAppConfig.scala index 17c1c585a8..849074990d 100644 --- a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindRpcAppConfig.scala +++ b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindRpcAppConfig.scala @@ -4,10 +4,10 @@ import akka.actor.ActorSystem import com.typesafe.config.Config import org.bitcoins.asyncutil.AsyncUtil import org.bitcoins.commons.config.{AppConfig, ConfigOps} +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.rpc.BitcoindException.InWarmUp import org.bitcoins.rpc.client.common.{BitcoindRpcClient, BitcoindVersion} import org.bitcoins.rpc.util.AppConfigFactoryActorSystem -import org.bitcoins.tor.Socks5ProxyParams import org.bitcoins.tor.config.TorAppConfig import java.io.File diff --git a/node/src/main/scala/org/bitcoins/node/models/Peer.scala b/core/src/main/scala/org/bitcoins/core/api/node/Peer.scala similarity index 57% rename from node/src/main/scala/org/bitcoins/node/models/Peer.scala rename to core/src/main/scala/org/bitcoins/core/api/node/Peer.scala index 652f92a3d1..5669ba3d12 100644 --- a/node/src/main/scala/org/bitcoins/node/models/Peer.scala +++ b/core/src/main/scala/org/bitcoins/core/api/node/Peer.scala @@ -1,8 +1,7 @@ -package org.bitcoins.node.models +package org.bitcoins.core.api.node import org.bitcoins.core.api.db.DbRowAutoInc -import org.bitcoins.rpc.config.BitcoindInstance -import org.bitcoins.tor.Socks5ProxyParams +import org.bitcoins.core.api.tor.Socks5ProxyParams import java.net.InetSocketAddress @@ -28,13 +27,4 @@ object Peer { socks5ProxyParams: Option[Socks5ProxyParams]): Peer = { Peer(socket, socks5ProxyParams = socks5ProxyParams) } - - /** Constructs a peer from the given `bitcoind` instance - */ - def fromBitcoind( - bitcoind: BitcoindInstance, - socks5ProxyParams: Option[Socks5ProxyParams]): Peer = { - val socket = new InetSocketAddress(bitcoind.uri.getHost, bitcoind.p2pPort) - fromSocket(socket, socks5ProxyParams = socks5ProxyParams) - } } diff --git a/core/src/main/scala/org/bitcoins/core/api/tor/Credentials.scala b/core/src/main/scala/org/bitcoins/core/api/tor/Credentials.scala new file mode 100644 index 0000000000..650326d7b5 --- /dev/null +++ b/core/src/main/scala/org/bitcoins/core/api/tor/Credentials.scala @@ -0,0 +1,6 @@ +package org.bitcoins.core.api.tor + +case class Credentials(username: String, password: String) { + require(username.length < 256, "username is too long") + require(password.length < 256, "password is too long") +} diff --git a/core/src/main/scala/org/bitcoins/core/api/tor/Socks5ProxyParams.scala b/core/src/main/scala/org/bitcoins/core/api/tor/Socks5ProxyParams.scala new file mode 100644 index 0000000000..4e5023a451 --- /dev/null +++ b/core/src/main/scala/org/bitcoins/core/api/tor/Socks5ProxyParams.scala @@ -0,0 +1,31 @@ +package org.bitcoins.core.api.tor + +import org.bitcoins.crypto.CryptoUtil + +import java.net.InetSocketAddress + +case class Socks5ProxyParams( + address: InetSocketAddress, + credentialsOpt: Option[Credentials], + randomizeCredentials: Boolean) + +object Socks5ProxyParams { + + val DefaultPort = 9050 + + val defaultProxyParams: Socks5ProxyParams = + new Socks5ProxyParams( + address = InetSocketAddress.createUnresolved("127.0.0.1", DefaultPort), + credentialsOpt = None, + randomizeCredentials = true) + + def proxyCredentials(proxyParams: Socks5ProxyParams): Option[Credentials] = + if (proxyParams.randomizeCredentials) { + // randomize credentials for every proxy connection to enable Tor stream isolation + Some( + Credentials(CryptoUtil.randomBytes(16).toHex, + CryptoUtil.randomBytes(16).toHex)) + } else { + proxyParams.credentialsOpt + } +} diff --git a/dlc-node-test/src/test/scala/org/bitcoins/dlc/node/DLCServerTorTest.scala b/dlc-node-test/src/test/scala/org/bitcoins/dlc/node/DLCServerTorTest.scala index 9f5ae5d05e..4a447b0bfc 100644 --- a/dlc-node-test/src/test/scala/org/bitcoins/dlc/node/DLCServerTorTest.scala +++ b/dlc-node-test/src/test/scala/org/bitcoins/dlc/node/DLCServerTorTest.scala @@ -3,6 +3,7 @@ package org.bitcoins.dlc.node import akka.actor.ActorRef import akka.testkit.{TestActorRef, TestProbe} import org.bitcoins.asyncutil.AsyncUtil +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.number.UInt16 import org.bitcoins.core.protocol.BigSizeUInt import org.bitcoins.core.protocol.tlv.{LnMessage, PingTLV, PongTLV} @@ -14,7 +15,7 @@ import org.bitcoins.testkit.tor.CachedTor import org.bitcoins.testkit.util.{BitcoinSActorFixtureWithDLCWallet, TorUtil} import org.bitcoins.testkit.util.TorUtil._ import org.bitcoins.testkit.wallet.FundWalletUtil.FundedDLCWallet -import org.bitcoins.tor.{Socks5ProxyParams, TorController, TorProtocolHandler} +import org.bitcoins.tor.{TorController, TorProtocolHandler} import org.scalatest.{Assertion, FutureOutcome} import scodec.bits.ByteVector diff --git a/dlc-node/src/main/scala/org/bitcoins/dlc/node/DLCClient.scala b/dlc-node/src/main/scala/org/bitcoins/dlc/node/DLCClient.scala index 383aa7d253..f464561705 100644 --- a/dlc-node/src/main/scala/org/bitcoins/dlc/node/DLCClient.scala +++ b/dlc-node/src/main/scala/org/bitcoins/dlc/node/DLCClient.scala @@ -4,10 +4,11 @@ import akka.actor._ import akka.event.LoggingReceive import akka.io.{IO, Tcp} import org.bitcoins.core.api.dlc.wallet.DLCWalletApi +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.protocol.BigSizeUInt import org.bitcoins.dlc.node.peer.Peer import org.bitcoins.tor.Socks5Connection.{Socks5Connect, Socks5Connected} -import org.bitcoins.tor.{Socks5Connection, Socks5ProxyParams} +import org.bitcoins.tor.Socks5Connection import scodec.bits.ByteVector import java.io.IOException diff --git a/dlc-node/src/main/scala/org/bitcoins/dlc/node/config/DLCNodeAppConfig.scala b/dlc-node/src/main/scala/org/bitcoins/dlc/node/config/DLCNodeAppConfig.scala index 7a0aaa37b4..206775304b 100644 --- a/dlc-node/src/main/scala/org/bitcoins/dlc/node/config/DLCNodeAppConfig.scala +++ b/dlc-node/src/main/scala/org/bitcoins/dlc/node/config/DLCNodeAppConfig.scala @@ -5,10 +5,11 @@ import com.typesafe.config.Config import org.bitcoins.commons.config.{AppConfig, AppConfigFactory} import org.bitcoins.core.api.CallbackConfig import org.bitcoins.core.api.dlc.wallet.DLCWalletApi +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.util.{FutureUtil, NetworkUtil} import org.bitcoins.dlc.node.{DLCNode, DLCNodeCallbacks} import org.bitcoins.tor.config.TorAppConfig -import org.bitcoins.tor.{Socks5ProxyParams, TorParams} +import org.bitcoins.tor.TorParams import java.net.{InetSocketAddress, URI} import java.nio.file.Path diff --git a/dlc-node/src/main/scala/org/bitcoins/dlc/node/peer/Peer.scala b/dlc-node/src/main/scala/org/bitcoins/dlc/node/peer/Peer.scala index a9e4735438..e2e35cc0b4 100644 --- a/dlc-node/src/main/scala/org/bitcoins/dlc/node/peer/Peer.scala +++ b/dlc-node/src/main/scala/org/bitcoins/dlc/node/peer/Peer.scala @@ -1,7 +1,7 @@ package org.bitcoins.dlc.node.peer import org.bitcoins.core.api.db.DbRowAutoInc -import org.bitcoins.tor.Socks5ProxyParams +import org.bitcoins.core.api.tor.Socks5ProxyParams import java.net.InetSocketAddress diff --git a/eclair-rpc/src/main/scala/org/bitcoins/eclair/rpc/config/EclairInstance.scala b/eclair-rpc/src/main/scala/org/bitcoins/eclair/rpc/config/EclairInstance.scala index 16cf1571a7..ee07fb195e 100644 --- a/eclair-rpc/src/main/scala/org/bitcoins/eclair/rpc/config/EclairInstance.scala +++ b/eclair-rpc/src/main/scala/org/bitcoins/eclair/rpc/config/EclairInstance.scala @@ -3,11 +3,11 @@ package org.bitcoins.eclair.rpc.config import akka.actor.ActorSystem import com.typesafe.config.{Config, ConfigFactory} import org.bitcoins.core.api.commons.InstanceFactoryLocal +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.config.{MainNet, NetworkParameters, RegTest, TestNet3} import org.bitcoins.core.protocol.ln.LnPolicy import org.bitcoins.core.util.NetworkUtil import org.bitcoins.rpc.config.{BitcoindAuthCredentials, ZmqConfig} -import org.bitcoins.tor.Socks5ProxyParams import java.io.File import java.net.{InetSocketAddress, URI} diff --git a/esplora-test/src/test/scala/org/bitcoins/esplora/EsploraClientTest.scala b/esplora-test/src/test/scala/org/bitcoins/esplora/EsploraClientTest.scala index c2de7227fb..d90ef33c31 100644 --- a/esplora-test/src/test/scala/org/bitcoins/esplora/EsploraClientTest.scala +++ b/esplora-test/src/test/scala/org/bitcoins/esplora/EsploraClientTest.scala @@ -1,5 +1,6 @@ package org.bitcoins.esplora +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.config.MainNet import org.bitcoins.core.number._ import org.bitcoins.core.protocol.BitcoinAddress @@ -8,7 +9,6 @@ import org.bitcoins.core.protocol.transaction.Transaction import org.bitcoins.crypto._ import org.bitcoins.testkit.util.BitcoinSAsyncTest import org.bitcoins.testkit.util.TorUtil._ -import org.bitcoins.tor.Socks5ProxyParams class EsploraClientTest extends BitcoinSAsyncTest { diff --git a/esplora/src/main/scala/org/bitcoins/esplora/EsploraClient.scala b/esplora/src/main/scala/org/bitcoins/esplora/EsploraClient.scala index 3819998444..4481299d0c 100644 --- a/esplora/src/main/scala/org/bitcoins/esplora/EsploraClient.scala +++ b/esplora/src/main/scala/org/bitcoins/esplora/EsploraClient.scala @@ -6,6 +6,7 @@ import akka.http.scaladsl.client.RequestBuilding.Post import akka.http.scaladsl.model._ import akka.util.ByteString import org.bitcoins.core.api.chain.ChainQueryApi +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.protocol.blockchain.{Block, BlockHeader} import org.bitcoins.core.protocol.transaction.Transaction import org.bitcoins.core.protocol.{BitcoinAddress, BlockStamp} diff --git a/fee-provider-test/src/test/scala/org/bitcoins/feeprovider/FeeRateProviderTest.scala b/fee-provider-test/src/test/scala/org/bitcoins/feeprovider/FeeRateProviderTest.scala index 30421a2ea6..29c3b20eb4 100644 --- a/fee-provider-test/src/test/scala/org/bitcoins/feeprovider/FeeRateProviderTest.scala +++ b/fee-provider-test/src/test/scala/org/bitcoins/feeprovider/FeeRateProviderTest.scala @@ -2,12 +2,12 @@ package org.bitcoins.feeprovider import org.bitcoins.asyncutil.AsyncUtil import org.bitcoins.core.api.feeprovider.FeeRateApi +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.config._ import org.bitcoins.core.currency.Satoshis import org.bitcoins.core.wallet.fee.SatoshisPerByte import org.bitcoins.feeprovider.MempoolSpaceTarget._ import org.bitcoins.testkit.util.BitcoinSAsyncTest -import org.bitcoins.tor.Socks5ProxyParams import org.scalatest.Assertion import scala.concurrent.Future diff --git a/fee-provider/src/main/scala/org/bitcoins/feeprovider/BitGoFeeRateProvider.scala b/fee-provider/src/main/scala/org/bitcoins/feeprovider/BitGoFeeRateProvider.scala index 1bda596bbd..3fe2521e9c 100644 --- a/fee-provider/src/main/scala/org/bitcoins/feeprovider/BitGoFeeRateProvider.scala +++ b/fee-provider/src/main/scala/org/bitcoins/feeprovider/BitGoFeeRateProvider.scala @@ -4,8 +4,8 @@ import akka.actor.ActorSystem import akka.http.scaladsl.model.Uri import org.bitcoins.commons.jsonmodels.wallet.BitGoResult import org.bitcoins.commons.serializers.JsonSerializers._ +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.wallet.fee.SatoshisPerKiloByte -import org.bitcoins.tor.Socks5ProxyParams import play.api.libs.json.{JsError, JsSuccess, Json} import scala.util.{Failure, Success, Try} diff --git a/fee-provider/src/main/scala/org/bitcoins/feeprovider/BitcoinerLiveFeeRateProvider.scala b/fee-provider/src/main/scala/org/bitcoins/feeprovider/BitcoinerLiveFeeRateProvider.scala index 575406a0f0..da0dfdcb78 100644 --- a/fee-provider/src/main/scala/org/bitcoins/feeprovider/BitcoinerLiveFeeRateProvider.scala +++ b/fee-provider/src/main/scala/org/bitcoins/feeprovider/BitcoinerLiveFeeRateProvider.scala @@ -4,9 +4,9 @@ import akka.actor.ActorSystem import akka.http.scaladsl.model.Uri import org.bitcoins.commons.jsonmodels.wallet.BitcoinerLiveResult import org.bitcoins.commons.serializers.JsonSerializers._ +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte import org.bitcoins.feeprovider.BitcoinerLiveFeeRateProvider.validMinutes -import org.bitcoins.tor.Socks5ProxyParams import play.api.libs.json.{JsError, JsSuccess, Json} import scala.util.{Failure, Success, Try} diff --git a/fee-provider/src/main/scala/org/bitcoins/feeprovider/FeeProviderFactory.scala b/fee-provider/src/main/scala/org/bitcoins/feeprovider/FeeProviderFactory.scala index a5edb5323e..19d4cbc80f 100644 --- a/fee-provider/src/main/scala/org/bitcoins/feeprovider/FeeProviderFactory.scala +++ b/fee-provider/src/main/scala/org/bitcoins/feeprovider/FeeProviderFactory.scala @@ -3,6 +3,7 @@ package org.bitcoins.feeprovider import akka.actor.ActorSystem import grizzled.slf4j.Logging import org.bitcoins.core.api.feeprovider.FeeRateApi +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.config.BitcoinNetwork import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte import org.bitcoins.feeprovider.FeeProviderName.{ @@ -12,7 +13,6 @@ import org.bitcoins.feeprovider.FeeProviderName.{ MempoolSpace } import org.bitcoins.feeprovider.MempoolSpaceTarget.HourFeeTarget -import org.bitcoins.tor.Socks5ProxyParams trait FeeProviderFactory[T <: FeeRateApi] { diff --git a/fee-provider/src/main/scala/org/bitcoins/feeprovider/HttpFeeRateProvider.scala b/fee-provider/src/main/scala/org/bitcoins/feeprovider/HttpFeeRateProvider.scala index 28812cdfc8..118b5ccb5e 100644 --- a/fee-provider/src/main/scala/org/bitcoins/feeprovider/HttpFeeRateProvider.scala +++ b/fee-provider/src/main/scala/org/bitcoins/feeprovider/HttpFeeRateProvider.scala @@ -6,9 +6,10 @@ import akka.http.scaladsl.Http import akka.http.scaladsl.model.{HttpRequest, Uri} import akka.util.ByteString import org.bitcoins.core.api.feeprovider.FeeRateApi +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.util.TimeUtil import org.bitcoins.core.wallet.fee.FeeUnit -import org.bitcoins.tor.{Socks5ClientTransport, Socks5ProxyParams} +import org.bitcoins.tor.Socks5ClientTransport import scala.concurrent.{ExecutionContextExecutor, Future} import scala.util.Try diff --git a/fee-provider/src/main/scala/org/bitcoins/feeprovider/MempoolSpaceProvider.scala b/fee-provider/src/main/scala/org/bitcoins/feeprovider/MempoolSpaceProvider.scala index ed58f6aad4..abebedc87f 100644 --- a/fee-provider/src/main/scala/org/bitcoins/feeprovider/MempoolSpaceProvider.scala +++ b/fee-provider/src/main/scala/org/bitcoins/feeprovider/MempoolSpaceProvider.scala @@ -4,10 +4,10 @@ import akka.actor.ActorSystem import akka.http.scaladsl.model.Uri import org.bitcoins.commons.jsonmodels.wallet.MempoolSpaceResult import org.bitcoins.commons.serializers.JsonSerializers._ +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.config._ import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte import org.bitcoins.feeprovider.MempoolSpaceTarget._ -import org.bitcoins.tor.Socks5ProxyParams import play.api.libs.json.{JsError, JsSuccess, Json} import scala.util.{Failure, Success, Try} diff --git a/lnurl/src/main/scala/org/bitcoins/lnurl/LnURLClient.scala b/lnurl/src/main/scala/org/bitcoins/lnurl/LnURLClient.scala index f81f28767b..ca6cfc8b9d 100644 --- a/lnurl/src/main/scala/org/bitcoins/lnurl/LnURLClient.scala +++ b/lnurl/src/main/scala/org/bitcoins/lnurl/LnURLClient.scala @@ -6,6 +6,7 @@ import akka.http.scaladsl.client.RequestBuilding.Get import akka.http.scaladsl.model.HttpRequest import akka.util.ByteString import grizzled.slf4j.Logging +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.currency._ import org.bitcoins.core.protocol.ln.LnInvoice import org.bitcoins.core.protocol.ln.currency._ diff --git a/node-test/src/test/scala/org/bitcoins/node/NeutrinoNodeTest.scala b/node-test/src/test/scala/org/bitcoins/node/NeutrinoNodeTest.scala index db01fe80c6..b65296bb8b 100644 --- a/node-test/src/test/scala/org/bitcoins/node/NeutrinoNodeTest.scala +++ b/node-test/src/test/scala/org/bitcoins/node/NeutrinoNodeTest.scala @@ -3,9 +3,10 @@ package org.bitcoins.node import akka.actor.Cancellable import org.bitcoins.asyncutil.AsyncUtil import org.bitcoins.chain.models.{CompactFilterDAO, CompactFilterHeaderDAO} +import org.bitcoins.core.api.node.Peer import org.bitcoins.core.util.NetworkUtil import org.bitcoins.crypto.DoubleSha256DigestBE -import org.bitcoins.node.models.{Peer, PeerDAO, PeerDb} +import org.bitcoins.node.models.{PeerDAO, PeerDb} import org.bitcoins.server.BitcoinSAppConfig import org.bitcoins.testkit.BitcoinSTestAppConfig import org.bitcoins.testkit.node.fixture.NeutrinoNodeConnectedWithBitcoinds diff --git a/node-test/src/test/scala/org/bitcoins/node/NeutrinoNodeWithUncachedBitcoindTest.scala b/node-test/src/test/scala/org/bitcoins/node/NeutrinoNodeWithUncachedBitcoindTest.scala index 6fbd4c7bb8..9f33fb67e9 100644 --- a/node-test/src/test/scala/org/bitcoins/node/NeutrinoNodeWithUncachedBitcoindTest.scala +++ b/node-test/src/test/scala/org/bitcoins/node/NeutrinoNodeWithUncachedBitcoindTest.scala @@ -1,10 +1,10 @@ package org.bitcoins.node import org.bitcoins.asyncutil.AsyncUtil +import org.bitcoins.core.api.node.Peer import org.bitcoins.core.p2p.{GetHeadersMessage, HeadersMessage} import org.bitcoins.core.protocol.blockchain.BlockHeader import org.bitcoins.core.util.FutureUtil -import org.bitcoins.node.models.Peer import org.bitcoins.server.BitcoinSAppConfig import org.bitcoins.testkit.BitcoinSTestAppConfig import org.bitcoins.testkit.node.fixture.NeutrinoNodeConnectedWithBitcoinds diff --git a/node/src/main/scala/org/bitcoins/node/NeutrinoNode.scala b/node/src/main/scala/org/bitcoins/node/NeutrinoNode.scala index 84bd9e21b8..416d96a386 100644 --- a/node/src/main/scala/org/bitcoins/node/NeutrinoNode.scala +++ b/node/src/main/scala/org/bitcoins/node/NeutrinoNode.scala @@ -4,11 +4,10 @@ import akka.actor.ActorSystem import org.bitcoins.asyncutil.AsyncUtil import org.bitcoins.chain.config.ChainAppConfig import org.bitcoins.core.api.chain.ChainQueryApi.FilterResponse -import org.bitcoins.core.api.node.NodeType +import org.bitcoins.core.api.node.{NodeType, Peer} import org.bitcoins.core.p2p.ServiceIdentifier import org.bitcoins.core.protocol.BlockStamp import org.bitcoins.node.config.NodeAppConfig -import org.bitcoins.node.models.Peer import java.time.Instant import scala.concurrent.Future diff --git a/node/src/main/scala/org/bitcoins/node/Node.scala b/node/src/main/scala/org/bitcoins/node/Node.scala index f8695c6865..ade1866bef 100644 --- a/node/src/main/scala/org/bitcoins/node/Node.scala +++ b/node/src/main/scala/org/bitcoins/node/Node.scala @@ -10,7 +10,7 @@ import org.bitcoins.chain.models.{ CompactFilterHeaderDAO } import org.bitcoins.core.api.chain._ -import org.bitcoins.core.api.node.NodeApi +import org.bitcoins.core.api.node.{NodeApi, Peer} import org.bitcoins.core.p2p._ import org.bitcoins.core.protocol.transaction.Transaction import org.bitcoins.crypto.{DoubleSha256Digest, DoubleSha256DigestBE} diff --git a/node/src/main/scala/org/bitcoins/node/NodeStreamMessage.scala b/node/src/main/scala/org/bitcoins/node/NodeStreamMessage.scala index 76bbf0a139..3b59322f6b 100644 --- a/node/src/main/scala/org/bitcoins/node/NodeStreamMessage.scala +++ b/node/src/main/scala/org/bitcoins/node/NodeStreamMessage.scala @@ -1,12 +1,12 @@ package org.bitcoins.node +import org.bitcoins.core.api.node.Peer import org.bitcoins.core.p2p.{ DataPayload, ExpectsResponse, NetworkMessage, NetworkPayload } -import org.bitcoins.node.models.Peer sealed abstract class NodeStreamMessage diff --git a/node/src/main/scala/org/bitcoins/node/PeerData.scala b/node/src/main/scala/org/bitcoins/node/PeerData.scala index bdd6f2c078..61ee9adbc2 100644 --- a/node/src/main/scala/org/bitcoins/node/PeerData.scala +++ b/node/src/main/scala/org/bitcoins/node/PeerData.scala @@ -1,11 +1,11 @@ package org.bitcoins.node -import akka.actor.{ActorSystem} +import akka.actor.ActorSystem import akka.stream.scaladsl.SourceQueueWithComplete import org.bitcoins.chain.config.ChainAppConfig +import org.bitcoins.core.api.node.Peer import org.bitcoins.core.p2p.ServiceIdentifier import org.bitcoins.node.config.NodeAppConfig -import org.bitcoins.node.models.Peer import org.bitcoins.node.networking.peer._ import org.bitcoins.node.util.PeerMessageSenderApi diff --git a/node/src/main/scala/org/bitcoins/node/PeerFinder.scala b/node/src/main/scala/org/bitcoins/node/PeerFinder.scala index 48d15d1a85..2f3ad3ae67 100644 --- a/node/src/main/scala/org/bitcoins/node/PeerFinder.scala +++ b/node/src/main/scala/org/bitcoins/node/PeerFinder.scala @@ -4,11 +4,12 @@ import akka.actor.{ActorSystem, Cancellable} import akka.stream.scaladsl.SourceQueueWithComplete import org.bitcoins.asyncutil.AsyncUtil import org.bitcoins.chain.config.ChainAppConfig +import org.bitcoins.core.api.node.Peer import org.bitcoins.core.p2p.ServiceIdentifier import org.bitcoins.core.util.{NetworkUtil, StartStopAsync} import org.bitcoins.node.config.NodeAppConfig -import org.bitcoins.node.models.{Peer, PeerDAO, PeerDb} -import org.bitcoins.node.networking.peer.{ControlMessageHandler} +import org.bitcoins.node.models.{PeerDAO, PeerDb} +import org.bitcoins.node.networking.peer.ControlMessageHandler import org.bitcoins.node.util.PeerMessageSenderApi import java.net.{InetAddress, UnknownHostException} diff --git a/node/src/main/scala/org/bitcoins/node/PeerManager.scala b/node/src/main/scala/org/bitcoins/node/PeerManager.scala index c588c246ff..5f3b40f4a5 100644 --- a/node/src/main/scala/org/bitcoins/node/PeerManager.scala +++ b/node/src/main/scala/org/bitcoins/node/PeerManager.scala @@ -27,13 +27,13 @@ import org.bitcoins.core.api.chain.db.{ CompactFilterDb, CompactFilterHeaderDb } -import org.bitcoins.core.api.node.NodeType +import org.bitcoins.core.api.node.{NodeType, Peer} import org.bitcoins.core.p2p._ import org.bitcoins.core.protocol.transaction.Transaction import org.bitcoins.core.util.{NetworkUtil, StartStopAsync} import org.bitcoins.crypto.DoubleSha256DigestBE import org.bitcoins.node.config.NodeAppConfig -import org.bitcoins.node.models.{Peer, PeerDAO, PeerDb} +import org.bitcoins.node.models.{PeerDAO, PeerDb} import org.bitcoins.node.networking.peer.NodeState._ import org.bitcoins.node.networking.peer._ import org.bitcoins.node.util.PeerMessageSenderApi diff --git a/node/src/main/scala/org/bitcoins/node/config/NodeAppConfig.scala b/node/src/main/scala/org/bitcoins/node/config/NodeAppConfig.scala index 3f7ed8fff8..934c147398 100644 --- a/node/src/main/scala/org/bitcoins/node/config/NodeAppConfig.scala +++ b/node/src/main/scala/org/bitcoins/node/config/NodeAppConfig.scala @@ -4,18 +4,18 @@ import akka.actor.ActorSystem import com.typesafe.config.Config import org.bitcoins.chain.config.ChainAppConfig import org.bitcoins.core.api.CallbackConfig -import org.bitcoins.core.api.node.NodeType +import org.bitcoins.core.api.node.{NodeType, Peer} +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.config.{MainNet, RegTest, SigNet, TestNet3} import org.bitcoins.core.util.TimeUtil import org.bitcoins.db.{DbAppConfig, JdbcProfileComponent} import org.bitcoins.node._ import org.bitcoins.node.callback.NodeCallbackStreamManager import org.bitcoins.node.db.NodeDbManagement -import org.bitcoins.node.models.Peer import org.bitcoins.rpc.config.BitcoindRpcAppConfig import org.bitcoins.rpc.util.AppConfigFactoryActorSystem import org.bitcoins.tor.config.TorAppConfig -import org.bitcoins.tor.{Socks5ProxyParams, TorParams} +import org.bitcoins.tor.TorParams import java.nio.file.Path import java.time.{Duration, Instant} diff --git a/node/src/main/scala/org/bitcoins/node/networking/peer/ControlMessageHandler.scala b/node/src/main/scala/org/bitcoins/node/networking/peer/ControlMessageHandler.scala index 219520fbbe..5c46366410 100644 --- a/node/src/main/scala/org/bitcoins/node/networking/peer/ControlMessageHandler.scala +++ b/node/src/main/scala/org/bitcoins/node/networking/peer/ControlMessageHandler.scala @@ -1,9 +1,9 @@ package org.bitcoins.node.networking.peer +import org.bitcoins.core.api.node.Peer import org.bitcoins.core.p2p._ import org.bitcoins.core.util.NetworkUtil import org.bitcoins.node.config.NodeAppConfig -import org.bitcoins.node.models.Peer import org.bitcoins.node.networking.peer.PeerMessageReceiverState._ import org.bitcoins.node.{NodeStreamMessage, P2PLogger, PeerManager} diff --git a/node/src/main/scala/org/bitcoins/node/networking/peer/DataMessageHandler.scala b/node/src/main/scala/org/bitcoins/node/networking/peer/DataMessageHandler.scala index 6cf9e7b11e..fb21698b96 100644 --- a/node/src/main/scala/org/bitcoins/node/networking/peer/DataMessageHandler.scala +++ b/node/src/main/scala/org/bitcoins/node/networking/peer/DataMessageHandler.scala @@ -6,7 +6,7 @@ import org.bitcoins.chain.config.ChainAppConfig import org.bitcoins.chain.models.BlockHeaderDAO import org.bitcoins.core.api.chain.ChainApi import org.bitcoins.core.api.chain.db.CompactFilterHeaderDb -import org.bitcoins.core.api.node.NodeType +import org.bitcoins.core.api.node.{NodeType, Peer} import org.bitcoins.core.gcs.{BlockFilter, GolombFilter} import org.bitcoins.core.p2p._ import org.bitcoins.core.protocol.CompactSizeUInt diff --git a/node/src/main/scala/org/bitcoins/node/networking/peer/NodeState.scala b/node/src/main/scala/org/bitcoins/node/networking/peer/NodeState.scala index 82326c909f..de65de2218 100644 --- a/node/src/main/scala/org/bitcoins/node/networking/peer/NodeState.scala +++ b/node/src/main/scala/org/bitcoins/node/networking/peer/NodeState.scala @@ -1,6 +1,6 @@ package org.bitcoins.node.networking.peer -import org.bitcoins.node.models.Peer +import org.bitcoins.core.api.node.Peer import org.bitcoins.node.networking.peer.NodeState.{ DoneSyncing, FilterHeaderSync, diff --git a/node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageReceiver.scala b/node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageReceiver.scala index 57150e29d7..d724263802 100644 --- a/node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageReceiver.scala +++ b/node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageReceiver.scala @@ -5,10 +5,9 @@ import akka.stream.QueueOfferResult import akka.stream.scaladsl.SourceQueueWithComplete import org.bitcoins.chain.blockchain.ChainHandler import org.bitcoins.chain.config.ChainAppConfig -import org.bitcoins.core.api.node.NodeType +import org.bitcoins.core.api.node.{NodeType, Peer} import org.bitcoins.core.p2p._ import org.bitcoins.node.config.NodeAppConfig -import org.bitcoins.node.models.Peer import org.bitcoins.node.networking.peer.PeerMessageReceiverState._ import org.bitcoins.node.{NodeStreamMessage, P2PLogger} import org.bitcoins.node.util.PeerMessageSenderApi diff --git a/node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageSender.scala b/node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageSender.scala index 348460c41f..aa48891402 100644 --- a/node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageSender.scala +++ b/node/src/main/scala/org/bitcoins/node/networking/peer/PeerMessageSender.scala @@ -18,6 +18,7 @@ import akka.stream.{Attributes, KillSwitches, UniqueKillSwitch} import akka.util.ByteString import org.bitcoins.chain.blockchain.ChainHandler import org.bitcoins.chain.config.ChainAppConfig +import org.bitcoins.core.api.node.Peer import org.bitcoins.core.bloom.BloomFilter import org.bitcoins.core.number.Int32 import org.bitcoins.core.p2p._ @@ -26,7 +27,6 @@ import org.bitcoins.crypto.{DoubleSha256Digest, HashDigest} import org.bitcoins.node.P2PLogger import org.bitcoins.node.config.NodeAppConfig import org.bitcoins.node.constant.NodeConstants -import org.bitcoins.node.models.Peer import org.bitcoins.node.networking.peer.PeerMessageReceiver.NetworkMessageReceived import org.bitcoins.node.networking.peer.PeerMessageSender.ConnectionGraph import org.bitcoins.node.util.PeerMessageSenderApi diff --git a/node/src/main/scala/org/bitcoins/node/util/PeerMessageSenderApi.scala b/node/src/main/scala/org/bitcoins/node/util/PeerMessageSenderApi.scala index 2d26c448cb..a32ea1138e 100644 --- a/node/src/main/scala/org/bitcoins/node/util/PeerMessageSenderApi.scala +++ b/node/src/main/scala/org/bitcoins/node/util/PeerMessageSenderApi.scala @@ -1,6 +1,7 @@ package org.bitcoins.node.util import org.bitcoins.core.api.chain.{ChainApi, FilterSyncMarker} +import org.bitcoins.core.api.node.Peer import org.bitcoins.core.number.Int32 import org.bitcoins.core.p2p.{ GetAddrMessage, @@ -19,7 +20,6 @@ import org.bitcoins.core.protocol.transaction.Transaction import org.bitcoins.crypto.DoubleSha256DigestBE import org.bitcoins.node.config.NodeAppConfig import org.bitcoins.node.constant.NodeConstants -import org.bitcoins.node.models.Peer import org.bitcoins.node.networking.peer.NodeState import scala.concurrent.{ExecutionContext, Future} diff --git a/oracle-explorer-client/src/main/scala/org/bitcoins/explorer/client/SbExplorerClient.scala b/oracle-explorer-client/src/main/scala/org/bitcoins/explorer/client/SbExplorerClient.scala index 51f725b125..1cf0cd1c7a 100644 --- a/oracle-explorer-client/src/main/scala/org/bitcoins/explorer/client/SbExplorerClient.scala +++ b/oracle-explorer-client/src/main/scala/org/bitcoins/explorer/client/SbExplorerClient.scala @@ -5,6 +5,7 @@ import akka.http.scaladsl.model._ import akka.http.scaladsl.{Http, HttpExt} import akka.util.ByteString import org.bitcoins.commons.jsonmodels.ExplorerEnv +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.protocol.tlv.OracleAnnouncementTLV import org.bitcoins.core.util.FutureUtil import org.bitcoins.crypto.{SchnorrPublicKey, Sha256Digest} @@ -15,7 +16,7 @@ import org.bitcoins.explorer.model.{ SbAnnouncementEvent } import org.bitcoins.explorer.picklers.ExplorerPicklers -import org.bitcoins.tor.{Socks5ClientTransport, Socks5ProxyParams} +import org.bitcoins.tor.{Socks5ClientTransport} import play.api.libs.json.{ JsArray, JsBoolean, diff --git a/oracle-explorer-client/src/test/scala/org/bitcoins/explorer/client/SbExplorerClientTest.scala b/oracle-explorer-client/src/test/scala/org/bitcoins/explorer/client/SbExplorerClientTest.scala index e45b39d261..fb541f4432 100644 --- a/oracle-explorer-client/src/test/scala/org/bitcoins/explorer/client/SbExplorerClientTest.scala +++ b/oracle-explorer-client/src/test/scala/org/bitcoins/explorer/client/SbExplorerClientTest.scala @@ -1,6 +1,7 @@ package org.bitcoins.explorer.client import org.bitcoins.commons.jsonmodels.ExplorerEnv +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.protocol.tlv.{ OracleAnnouncementV0TLV, OracleAttestmentV0TLV @@ -12,7 +13,6 @@ import org.bitcoins.explorer.model.{ SbAnnouncementEvent } import org.bitcoins.testkit.util.BitcoinSAsyncTest -import org.bitcoins.tor.Socks5ProxyParams import scala.concurrent.Future diff --git a/testkit/src/main/scala/org/bitcoins/testkit/node/NodeTestUtil.scala b/testkit/src/main/scala/org/bitcoins/testkit/node/NodeTestUtil.scala index da03bfe983..97ec7fa554 100644 --- a/testkit/src/main/scala/org/bitcoins/testkit/node/NodeTestUtil.scala +++ b/testkit/src/main/scala/org/bitcoins/testkit/node/NodeTestUtil.scala @@ -1,13 +1,13 @@ package org.bitcoins.testkit.node import akka.actor.ActorSystem +import org.bitcoins.core.api.node.Peer +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.crypto.DoubleSha256DigestBE -import org.bitcoins.node.models.Peer import org.bitcoins.node.{NeutrinoNode, Node, P2PLogger} import org.bitcoins.rpc.client.common.BitcoindRpcClient import org.bitcoins.testkit.async.TestAsyncUtil import org.bitcoins.testkit.util.TorUtil -import org.bitcoins.tor.Socks5ProxyParams import java.net.{InetSocketAddress, URI} import scala.concurrent.duration._ @@ -53,7 +53,7 @@ abstract class NodeTestUtil extends P2PLogger { } else None } - /** Gets the [[org.bitcoins.node.models.Peer]] that + /** Gets the [[Peer]] that * corresponds to [[org.bitcoins.rpc.client.common.BitcoindRpcClient]] */ def getBitcoindPeer(bitcoindRpcClient: BitcoindRpcClient)(implicit diff --git a/testkit/src/main/scala/org/bitcoins/testkit/node/NodeTestWithCachedBitcoind.scala b/testkit/src/main/scala/org/bitcoins/testkit/node/NodeTestWithCachedBitcoind.scala index cc340cd9da..40ca4eb2d4 100644 --- a/testkit/src/main/scala/org/bitcoins/testkit/node/NodeTestWithCachedBitcoind.scala +++ b/testkit/src/main/scala/org/bitcoins/testkit/node/NodeTestWithCachedBitcoind.scala @@ -1,9 +1,8 @@ package org.bitcoins.testkit.node import akka.actor.ActorSystem -import org.bitcoins.core.api.node.NodeType +import org.bitcoins.core.api.node.{NodeType, Peer} import org.bitcoins.node.Node -import org.bitcoins.node.models.Peer import org.bitcoins.rpc.client.common.BitcoindRpcClient import org.bitcoins.server.BitcoinSAppConfig import org.bitcoins.testkit.node.NodeUnitTest diff --git a/testkit/src/main/scala/org/bitcoins/testkit/node/NodeUnitTest.scala b/testkit/src/main/scala/org/bitcoins/testkit/node/NodeUnitTest.scala index 56445d6ecf..3f26b5fce1 100644 --- a/testkit/src/main/scala/org/bitcoins/testkit/node/NodeUnitTest.scala +++ b/testkit/src/main/scala/org/bitcoins/testkit/node/NodeUnitTest.scala @@ -3,10 +3,9 @@ package org.bitcoins.testkit.node import akka.actor.ActorSystem import org.bitcoins.asyncutil.AsyncUtil import org.bitcoins.chain.config.ChainAppConfig -import org.bitcoins.core.api.node.NodeType +import org.bitcoins.core.api.node.{NodeType, Peer} import org.bitcoins.node._ import org.bitcoins.node.config.NodeAppConfig -import org.bitcoins.node.models.Peer import org.bitcoins.node.networking.peer._ import org.bitcoins.rpc.client.common.BitcoindVersion.V22 import org.bitcoins.rpc.client.common.{BitcoindRpcClient, BitcoindVersion} diff --git a/tor/src/main/scala/org/bitcoins/tor/Socks5ClientTransport.scala b/tor/src/main/scala/org/bitcoins/tor/Socks5ClientTransport.scala index b40898a703..702215e3d1 100644 --- a/tor/src/main/scala/org/bitcoins/tor/Socks5ClientTransport.scala +++ b/tor/src/main/scala/org/bitcoins/tor/Socks5ClientTransport.scala @@ -13,6 +13,7 @@ import akka.stream.stage._ import akka.stream.{Attributes, BidiShape, Inlet, Outlet} import akka.util.ByteString import grizzled.slf4j.Logging +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.util.NetworkUtil import java.net.{InetSocketAddress, URI} diff --git a/tor/src/main/scala/org/bitcoins/tor/Socks5Connection.scala b/tor/src/main/scala/org/bitcoins/tor/Socks5Connection.scala index 769ce34e99..a7e93a3c3c 100644 --- a/tor/src/main/scala/org/bitcoins/tor/Socks5Connection.scala +++ b/tor/src/main/scala/org/bitcoins/tor/Socks5Connection.scala @@ -4,8 +4,8 @@ import akka.actor.{Actor, ActorLogging, ActorRef, Props, Terminated} import akka.io.Tcp import akka.util.ByteString import grizzled.slf4j.Logging -import org.bitcoins.crypto.CryptoUtil -import org.bitcoins.tor.Socks5Connection.{Credentials, Socks5Connect} +import org.bitcoins.core.api.tor.Credentials +import org.bitcoins.tor.Socks5Connection.Socks5Connect import java.net.{Inet4Address, Inet6Address, InetAddress, InetSocketAddress} import scala.util.{Failure, Success, Try} @@ -104,7 +104,7 @@ class Socks5Connection( } -object Socks5Connection { +object Socks5Connection extends Logging { def props( tcpConnection: ActorRef, @@ -118,11 +118,6 @@ object Socks5Connection { case class Socks5Error(message: String) extends RuntimeException(message) - case class Credentials(username: String, password: String) { - require(username.length < 256, "username is too long") - require(password.length < 256, "password is too long") - } - val NoAuth: Byte = 0x00 val PasswordAuth: Byte = 0x02 @@ -245,30 +240,3 @@ object Socks5Connection { def tryParseAuth(data: ByteString): Try[Boolean] = Try(parseAuth(data)) } - -case class Socks5ProxyParams( - address: InetSocketAddress, - credentialsOpt: Option[Credentials], - randomizeCredentials: Boolean) - -object Socks5ProxyParams { - - val DefaultPort = 9050 - - val defaultProxyParams: Socks5ProxyParams = - Socks5ProxyParams( - address = InetSocketAddress.createUnresolved("127.0.0.1", DefaultPort), - credentialsOpt = None, - randomizeCredentials = true) - - def proxyCredentials( - proxyParams: Socks5ProxyParams): Option[Socks5Connection.Credentials] = - if (proxyParams.randomizeCredentials) { - // randomize credentials for every proxy connection to enable Tor stream isolation - Some( - Socks5Connection.Credentials(CryptoUtil.randomBytes(16).toHex, - CryptoUtil.randomBytes(16).toHex)) - } else { - proxyParams.credentialsOpt - } -} diff --git a/tor/src/main/scala/org/bitcoins/tor/client/TorClient.scala b/tor/src/main/scala/org/bitcoins/tor/client/TorClient.scala index ba6a05b69c..b362c83695 100644 --- a/tor/src/main/scala/org/bitcoins/tor/client/TorClient.scala +++ b/tor/src/main/scala/org/bitcoins/tor/client/TorClient.scala @@ -2,10 +2,11 @@ package org.bitcoins.tor.client import grizzled.slf4j.Logging import org.bitcoins.commons.util.NativeProcessFactory +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.util.EnvUtil import org.bitcoins.tor.TorProtocolHandler._ import org.bitcoins.tor.config.TorAppConfig -import org.bitcoins.tor.{Socks5ProxyParams, TorParams} +import org.bitcoins.tor.{TorParams} import java.io.{File, FileNotFoundException} import java.net.{InetAddress, InetSocketAddress} diff --git a/tor/src/main/scala/org/bitcoins/tor/config/TorAppConfig.scala b/tor/src/main/scala/org/bitcoins/tor/config/TorAppConfig.scala index c303f50a14..34f8fe8002 100644 --- a/tor/src/main/scala/org/bitcoins/tor/config/TorAppConfig.scala +++ b/tor/src/main/scala/org/bitcoins/tor/config/TorAppConfig.scala @@ -4,10 +4,11 @@ import com.typesafe.config.Config import org.bitcoins.asyncutil.AsyncUtil import org.bitcoins.commons.config.{AppConfig, AppConfigFactory, ConfigOps} import org.bitcoins.core.api.CallbackConfig +import org.bitcoins.core.api.tor.Socks5ProxyParams import org.bitcoins.core.util.NetworkUtil import org.bitcoins.tor.TorProtocolHandler.{Password, SafeCookie} import org.bitcoins.tor.client.TorClient -import org.bitcoins.tor.{Socks5ProxyParams, TorCallbacks, TorParams} +import org.bitcoins.tor.{TorCallbacks, TorParams} import java.io.File import java.net.{InetAddress, InetSocketAddress}