mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 01:40:55 +01:00
Make DLC node's external IP configurable (#3838)
* Make DLC node's external IP configurable * docs * some more changes
This commit is contained in:
parent
a6898defe2
commit
41cb26a3bb
@ -25,6 +25,7 @@ bitcoin-s.node.proxy.enabled = ${?BITCOIN_S_NODE_PROXY_ENABLED}
|
||||
bitcoin-s.node.tor.enabled = ${?BITCOIN_S_NODE_TOR_ENABLED}
|
||||
bitcoin-s.dlcnode.proxy.enabled = ${?BITCOIN_S_DLCNODE_PROXY_ENABLED}
|
||||
bitcoin-s.dlcnode.tor.enabled = ${?BITCOIN_S_DLCNODE_TOR_ENABLED}
|
||||
bitcoin-s.dlcnode.external-ip = ${?BITCOIN_S_DLCNODE_EXTERNAL_IP}
|
||||
|
||||
bitcoin-s.tor.enabled = ${?BITCOIN_S_TOR_ENABLED}
|
||||
bitcoin-s.tor.provided = ${?BITCOIN_S_TOR_PROVIDED}
|
@ -39,7 +39,10 @@ case class DLCNode(wallet: DLCWalletApi)(implicit
|
||||
Promise[InetSocketAddress]()
|
||||
|
||||
def getHostAddress: Future[InetSocketAddress] = {
|
||||
hostAddressP.future
|
||||
config.externalIP match {
|
||||
case Some(address) => Future.successful(address)
|
||||
case None => hostAddressP.future
|
||||
}
|
||||
}
|
||||
|
||||
override def start(): Future[Unit] = {
|
||||
|
@ -4,7 +4,7 @@ import akka.actor.ActorSystem
|
||||
import com.typesafe.config.Config
|
||||
import org.bitcoins.commons.config.{AppConfig, AppConfigFactory}
|
||||
import org.bitcoins.core.api.dlc.wallet.DLCWalletApi
|
||||
import org.bitcoins.core.util.FutureUtil
|
||||
import org.bitcoins.core.util.{FutureUtil, NetworkUtil}
|
||||
import org.bitcoins.dlc.node.DLCNode
|
||||
import org.bitcoins.tor.config.TorAppConfig
|
||||
import org.bitcoins.tor.{Socks5ProxyParams, TorParams}
|
||||
@ -55,6 +55,16 @@ case class DLCNodeAppConfig(
|
||||
new InetSocketAddress(uri.getHost, uri.getPort)
|
||||
}
|
||||
|
||||
lazy val externalIP: Option[InetSocketAddress] = {
|
||||
val path = s"bitcoin-s.$moduleName.external-ip"
|
||||
if (config.hasPath(path)) {
|
||||
val str = config.getString(path)
|
||||
Some(NetworkUtil.parseInetSocketAddress(str, listenAddress.getPort))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
def createDLCNode(dlcWallet: DLCWalletApi)(implicit
|
||||
system: ActorSystem): DLCNode = {
|
||||
DLCNode(dlcWallet)(system, this)
|
||||
|
@ -302,7 +302,15 @@ bitcoin-s {
|
||||
dlcnode {
|
||||
# The address we are listening on for incoming connections for DLCs
|
||||
# Binding to 0.0.0.0 makes us listen to all incoming connections
|
||||
# Consider using 127.0.0.1 listen address if Tor is enabled.
|
||||
listen = "0.0.0.0:2862"
|
||||
|
||||
# The address our peers use to connect to our node.
|
||||
# By default it's the same as the listen address,
|
||||
# or if Tor is enabled, the hidden service's onion address.
|
||||
# You can specify a port number like this "192.168.0.1:12345",
|
||||
# The default port number is the same as in the listen adrress
|
||||
# external-ip = "192.168.0.1"
|
||||
}
|
||||
|
||||
server {
|
||||
|
Loading…
Reference in New Issue
Block a user