Add a config option to toggle auto IP discovery

This commit is contained in:
Andrius Dagys
2017-06-23 11:42:55 +01:00
parent bf9e2c6f54
commit 7804c68401
3 changed files with 11 additions and 3 deletions

View File

@ -169,8 +169,11 @@ open class Node(override val configuration: FullNodeConfiguration,
private fun getAdvertisedAddress(): HostAndPort {
return with(configuration) {
val publicHost = tryDetectIfNotPublicHost(p2pAddress.host)
val useHost = publicHost ?: p2pAddress.host
val useHost = if (detectPublicIp) {
tryDetectIfNotPublicHost(p2pAddress.host) ?: p2pAddress.host
} else {
p2pAddress.host
}
HostAndPort.fromParts(useHost, p2pAddress.port)
}
}

View File

@ -58,7 +58,8 @@ data class FullNodeConfiguration(
val notaryClusterAddresses: List<HostAndPort>,
override val certificateChainCheckPolicies: List<CertChainPolicyConfig>,
override val devMode: Boolean = false,
val useTestClock: Boolean = false
val useTestClock: Boolean = false,
val detectPublicIp: Boolean = true
) : NodeConfiguration {
/** This is not retrieved from the config file but rather from a command line argument. */
@Suppress("DEPRECATION")