Browse Source

Add a local.conf option to set the port.

Adam Ierymenko 8 years ago
parent
commit
cd7b571da0
2 changed files with 2 additions and 0 deletions
  1. 1 0
      service/OneService.cpp
  2. 1 0
      service/README.md

+ 1 - 0
service/OneService.cpp

@@ -987,6 +987,7 @@ public:
 		_interfacePrefixBlacklist.clear();
 		_interfacePrefixBlacklist.clear();
 		json &settings = _localConfig["settings"];
 		json &settings = _localConfig["settings"];
 		if (settings.is_object()) {
 		if (settings.is_object()) {
+			_primaryPort = (unsigned int)OSUtils::jsonInt(settings["primaryPort"],(uint64_t)_primaryPort) & 0xffff;
 			_portMappingEnabled = OSUtils::jsonBool(settings["portMappingEnabled"],true);
 			_portMappingEnabled = OSUtils::jsonBool(settings["portMappingEnabled"],true);
 
 
 			const std::string up(OSUtils::jsonString(settings["softwareUpdate"],ZT_SOFTWARE_UPDATE_DEFAULT));
 			const std::string up(OSUtils::jsonString(settings["softwareUpdate"],ZT_SOFTWARE_UPDATE_DEFAULT));

+ 1 - 0
service/README.md

@@ -24,6 +24,7 @@ Settings available in `local.conf` (this is not valid JSON, and JSON does not al
 		}
 		}
 	},
 	},
 	"settings": { /* Other global settings */
 	"settings": { /* Other global settings */
+		"primaryPort": 0-65535, /* If set, override default port of 9993 and any command line port */
 		"portMappingEnabled": true|false, /* If true (the default), try to use uPnP or NAT-PMP to map ports */
 		"portMappingEnabled": true|false, /* If true (the default), try to use uPnP or NAT-PMP to map ports */
 		"softwareUpdate": "apply"|"download"|"disable", /* Automatically apply updates, just download, or disable built-in software updates */
 		"softwareUpdate": "apply"|"download"|"disable", /* Automatically apply updates, just download, or disable built-in software updates */
 		"softwareUpdateDist": true|false, /* If true, distribute software updates (only really useful to ZeroTier, Inc. itself, default is false) */
 		"softwareUpdateDist": true|false, /* If true, distribute software updates (only really useful to ZeroTier, Inc. itself, default is false) */