From 300588c5e86689b56d66555f8aefa9868d170361 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 17 Sep 2013 14:47:48 -0400 Subject: Add port and control port command line options to daemon and command line client, add new supernode keys to Defaults. --- main.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index a6b684b9..8bf1bd00 100644 --- a/main.cpp +++ b/main.cpp @@ -60,7 +60,13 @@ static Node *node = (Node *)0; static void printHelp(const char *cn,FILE *out) { - fprintf(out,"ZeroTier One version %d.%d.%d"ZT_EOL_S"(c)2012-2013 ZeroTier Networks LLC"ZT_EOL_S"Licensed under the GNU General Public License v3"ZT_EOL_S""ZT_EOL_S"Usage: %s [home directory]"ZT_EOL_S,Node::versionMajor(),Node::versionMinor(),Node::versionRevision(),cn); + fprintf(out,"ZeroTier One version %d.%d.%d"ZT_EOL_S"(c)2012-2013 ZeroTier Networks LLC"ZT_EOL_S,Node::versionMajor(),Node::versionMinor(),Node::versionRevision()); + fprintf(out,"Licensed under the GNU General Public License v3"ZT_EOL_S""ZT_EOL_S); + fprintf(out,"Usage: %s [-switches] [home directory]"ZT_EOL_S""ZT_EOL_S,cn); + fprintf(out,"Available switches:"ZT_EOL_S); + fprintf(out," -h - Display this help"ZT_EOL_S); + fprintf(out," -p - Bind to this port for network I/O"ZT_EOL_S); + fprintf(out," -c - Bind to this port for local control packets"ZT_EOL_S); } #ifdef __UNIX_LIKE__ @@ -114,9 +120,25 @@ int main(int argc,char **argv) #endif const char *homeDir = (const char *)0; + unsigned int port = 0; + unsigned int controlPort = 0; for(int i=1;i 65535) { + printHelp(argv[0],stderr); + return -1; + } + break; + case 'c': + controlPort = Utils::strToUInt(argv[i] + 2); + if (controlPort > 65535) { + printHelp(argv[0],stderr); + return -1; + } + break; case 'h': case '?': default: @@ -142,7 +164,7 @@ int main(int argc,char **argv) int exitCode = 0; - node = new Node(homeDir); + node = new Node(homeDir,port,controlPort); const char *termReason = (char *)0; switch(node->run()) { case Node::NODE_UNRECOVERABLE_ERROR: -- cgit v1.2.3