]> git.mxchange.org Git - hub.git/commitdiff
Added switch to disable (default=disable) publishing of internal (private) IP address...
authorRoland Häder <roland@mxchange.org>
Fri, 3 Aug 2012 19:53:18 +0000 (19:53 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 3 Aug 2012 19:53:18 +0000 (19:53 +0000)
application/hub/config.php
application/hub/main/tools/class_HubTools.php

index ce94011bb2a0f33984cf90d00d3ea407986cba12..1eb266bb800ecf75d0a4af464ba9c01935203761 100644 (file)
@@ -616,6 +616,9 @@ $cfg->setConfigEntry('internal_ip', ConsoleTools::acquireSelfIPAddress());
 // CFG: EXTERNAL-IP
 $cfg->setConfigEntry('external_ip', '');
 
+// CFG: ALLOW-PUBLISH-INTERNAL-IP
+$cfg->setConfigEntry('allow_publish_internal_ip', 'N');
+
 // CFG: NODE-STATUS
 $cfg->setConfigEntry('node_status', 'invalid');
 
index fec7d60c08d66ebcbd2e30ea03d294acd1efb24b..0d8b4f0d9ce5c9e4ed3a56ba274143def0e7d2dd 100644 (file)
@@ -218,8 +218,11 @@ class HubTools extends BaseHubSystem {
         * @return      $ip             The determined external ip of this node
         */
        public static function determineOwnInternalIp () {
-               // Is the external_ip config entry set?
-               if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_ip') != '') {
+               // Is the internal_ip config entry set?
+               if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('allow_publish_internal_ip') == 'N') {
+                       // Not allowed to publish internal IP, so use external
+                       $ip = self::determineOwnExternalIp();
+               } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_ip') != '') {
                        // Use it as internal ip
                        $ip = FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_ip');
                } else {