added option to get current global ip
This commit is contained in:
		@@ -8,6 +8,8 @@
 | 
				
			|||||||
#include <Config.h>
 | 
					#include <Config.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <api/IPAPI.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * application entry point
 | 
					 * application entry point
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -20,6 +22,7 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
                      << "[-f] [--force] force refresh of ip" << std::endl
 | 
					                      << "[-f] [--force] force refresh of ip" << std::endl
 | 
				
			||||||
                      << "[-l] [--loop] infinite loop to refresh ip every five minutes" << std::endl
 | 
					                      << "[-l] [--loop] infinite loop to refresh ip every five minutes" << std::endl
 | 
				
			||||||
                      << "[-c] [--checkconfig] validate configuration" << std::endl
 | 
					                      << "[-c] [--checkconfig] validate configuration" << std::endl
 | 
				
			||||||
 | 
					                      << "[-ip] [--currentip] get current global ip" << std::endl
 | 
				
			||||||
                      << "[no argument] normal ip check and refresh" << std::endl;
 | 
					                      << "[no argument] normal ip check and refresh" << std::endl;
 | 
				
			||||||
        } else if (firstarg == "-v" || firstarg == "--version") {
 | 
					        } else if (firstarg == "-v" || firstarg == "--version") {
 | 
				
			||||||
            std::cout << "Version " << Version::VERSION << std::endl;
 | 
					            std::cout << "Version " << Version::VERSION << std::endl;
 | 
				
			||||||
@@ -40,6 +43,9 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
                Logger::warning("There are errors in config file!");
 | 
					                Logger::warning("There are errors in config file!");
 | 
				
			||||||
                return -1;
 | 
					                return -1;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        } else if (firstarg == "-ip" || firstarg == "--currentip") {
 | 
				
			||||||
 | 
					            IPAPI ipapi;
 | 
				
			||||||
 | 
					            std::cout << "Current global IP: " << ipapi.getGlobalIp() << std::endl;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            Logger::message("wrong arguments!  -h for help");
 | 
					            Logger::message("wrong arguments!  -h for help");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user