diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-09-17 14:47:48 -0400 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-09-17 14:47:48 -0400 |
| commit | 300588c5e86689b56d66555f8aefa9868d170361 (patch) | |
| tree | 86d02a1a26150980d72bf8b8640423ca81bfd337 /main.cpp | |
| parent | de5cc82b5b29a47b0cc7de08800fe38860228850 (diff) | |
| download | infinitytier-300588c5e86689b56d66555f8aefa9868d170361.tar.gz infinitytier-300588c5e86689b56d66555f8aefa9868d170361.zip | |
Add port and control port command line options to daemon and command line client, add new supernode keys to Defaults.
Diffstat (limited to 'main.cpp')
| -rw-r--r-- | main.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -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<port> - Bind to this port for network I/O"ZT_EOL_S); + fprintf(out," -c<port> - 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<argc;++i) { if (argv[i][0] == '-') { switch(argv[i][1]) { + case 'p': + port = Utils::strToUInt(argv[i] + 2); + if (port > 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: |
