/**
	 * Load and initialize cluster definition and GeoIP data if any
	 *
	 * @param myAddress My ZeroTier address
	 * @param pathToClusterFile Path to cluster definition file
	 * @throws std::runtime_error Invalid cluster definition or unable to load data
	 */
	ClusterDefinition(uint64_t myAddress,const char *pathToClusterFile)
	{
		std::string cf;
		if (!OSUtils::readFile(pathToClusterFile,cf))
			return;

		char myAddressStr[64];
		Utils::snprintf(myAddressStr,sizeof(myAddressStr),"%.10llx",myAddress);

		std::vector<std::string> lines(OSUtils::split(cf.c_str(),"\r\n","",""));
		for(std::vector<std::string>::iterator l(lines.begin());l!=lines.end();++l) {
			std::vector<std::string> fields(OSUtils::split(l->c_str()," \t","",""));
			if ((fields.size() < 5)||(fields[0][0] == '#')||(fields[0] != myAddressStr))
				continue;

			// <address> geo <CSV path> <ip start column> <ip end column> <latitutde column> <longitude column>
			if (fields[1] == "geo") {
				if ((fields.size() >= 7)&&(OSUtils::fileExists(fields[2].c_str()))) {
					int ipStartColumn = Utils::strToInt(fields[3].c_str());
					int ipEndColumn = Utils::strToInt(fields[4].c_str());
					int latitudeColumn = Utils::strToInt(fields[5].c_str());
					int longitudeColumn = Utils::strToInt(fields[6].c_str());
					if (_geo.load(fields[2].c_str(),ipStartColumn,ipEndColumn,latitudeColumn,longitudeColumn) <= 0)
						throw std::runtime_error(std::string("failed to load geo-ip data from ")+fields[2]);
				}
				continue;
			}

			// <address> <ID> <name> <backplane IP/port(s)> <ZT frontplane IP/port(s)> <x,y,z>
			int id = Utils::strToUInt(fields[1].c_str());
			if ((id < 0)||(id > ZT_CLUSTER_MAX_MEMBERS))
				throw std::runtime_error(std::string("invalid cluster member ID: ")+fields[1]);
			MemberDefinition &md = _md[id];

			md.id = (unsigned int)id;
			if (fields.size() >= 6) {
				std::vector<std::string> xyz(OSUtils::split(fields[5].c_str(),",","",""));
				md.x = (xyz.size() > 0) ? Utils::strToInt(xyz[0].c_str()) : 0;
				md.y = (xyz.size() > 1) ? Utils::strToInt(xyz[1].c_str()) : 0;
				md.z = (xyz.size() > 2) ? Utils::strToInt(xyz[2].c_str()) : 0;
			}
			Utils::scopy(md.name,sizeof(md.name),fields[2].c_str());
			md.clusterEndpoint.fromString(fields[3]);
			if (!md.clusterEndpoint)
				continue;
			std::vector<std::string> zips(OSUtils::split(fields[4].c_str(),",","",""));
			for(std::vector<std::string>::iterator zip(zips.begin());zip!=zips.end();++zip) {
				InetAddress i;
				i.fromString(*zip);
				if (i)
					md.zeroTierEndpoints.push_back(i);
			}

			_ids.push_back((unsigned int)id);
		}

		std::sort(_ids.begin(),_ids.end());
	}