added command line arguments
This commit is contained in:
parent
1754dd8385
commit
1c752847d9
169
.idea/workspace.xml
generated
169
.idea/workspace.xml
generated
@ -16,8 +16,6 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="59c80f39-2468-4db0-9afd-14b8acdbffed" name="Default Changelist" comment="">
|
<list default="true" id="59c80f39-2468-4db0-9afd-14b8acdbffed" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/API.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/API.cpp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.cpp" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/cmake-build-debug/" />
|
<ignored path="$PROJECT_DIR$/cmake-build-debug/" />
|
||||||
@ -37,43 +35,17 @@
|
|||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="90">
|
<state relative-caret-position="75">
|
||||||
<caret line="6" column="40" lean-forward="true" selection-start-line="6" selection-start-column="40" selection-end-line="6" selection-end-column="40" />
|
<caret line="5" column="27" selection-start-line="5" selection-start-column="27" selection-end-line="5" selection-end-column="27" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/API.h">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="195">
|
|
||||||
<caret line="14" column="124" selection-start-line="14" selection-start-column="124" selection-end-line="14" selection-end-column="124" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/API.cpp">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="45">
|
|
||||||
<caret line="3" selection-start-line="3" selection-end-line="3" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#40#56#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/Hashmap.h">
|
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="240">
|
<state relative-caret-position="211">
|
||||||
<caret line="16" column="69" selection-start-line="16" selection-start-column="69" selection-end-line="16" selection-end-column="69" />
|
<caret line="30" column="32" selection-start-line="30" selection-start-column="32" selection-end-line="30" selection-end-column="32" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#19#0" expanded="true" />
|
<element signature="e#0#19#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
@ -81,16 +53,11 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt">
|
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/src/Logger.cpp">
|
<entry file="file://$PROJECT_DIR$/src/Logger.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="555">
|
<state relative-caret-position="360">
|
||||||
<caret line="37" column="38" selection-start-line="37" selection-start-column="38" selection-end-line="37" selection-end-column="38" />
|
<caret line="24" column="18" selection-start-line="24" selection-start-column="18" selection-end-line="24" selection-end-column="18" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#40#58#0" expanded="true" />
|
<element signature="e#40#58#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
@ -98,29 +65,6 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/ip.txt">
|
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/Logger.h">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="150">
|
|
||||||
<caret line="10" column="38" selection-start-line="10" selection-start-column="22" selection-end-line="10" selection-end-column="38" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="424">
|
|
||||||
<caret line="38" column="23" selection-start-line="38" selection-start-column="23" selection-end-line="38" selection-end-column="23" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
</leaf>
|
</leaf>
|
||||||
</component>
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
@ -134,50 +78,42 @@
|
|||||||
<option value="$PROJECT_DIR$/API.cpp" />
|
<option value="$PROJECT_DIR$/API.cpp" />
|
||||||
<option value="$PROJECT_DIR$/.gitignore" />
|
<option value="$PROJECT_DIR$/.gitignore" />
|
||||||
<option value="$PROJECT_DIR$/src/Logger.h" />
|
<option value="$PROJECT_DIR$/src/Logger.h" />
|
||||||
<option value="$PROJECT_DIR$/src/Logger.cpp" />
|
|
||||||
<option value="$PROJECT_DIR$/src/API.cpp" />
|
<option value="$PROJECT_DIR$/src/API.cpp" />
|
||||||
<option value="$PROJECT_DIR$/CMakeLists.txt" />
|
<option value="$PROJECT_DIR$/CMakeLists.txt" />
|
||||||
|
<option value="$PROJECT_DIR$/src/Logger.cpp" />
|
||||||
<option value="$PROJECT_DIR$/src/main.cpp" />
|
<option value="$PROJECT_DIR$/src/main.cpp" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectFrameBounds" extendedState="6">
|
<component name="ProjectFrameBounds" extendedState="6">
|
||||||
<option name="x" value="1020" />
|
<option name="x" value="528" />
|
||||||
<option name="y" value="236" />
|
<option name="y" value="311" />
|
||||||
<option name="width" value="1914" />
|
<option name="width" value="1392" />
|
||||||
<option name="height" value="1051" />
|
<option name="height" value="995" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
<component name="ProjectView">
|
<component name="ProjectView">
|
||||||
<navigator proportions="" version="1">
|
<navigator proportions="" version="1">
|
||||||
<foldersAlwaysOnTop value="true" />
|
<foldersAlwaysOnTop value="true" />
|
||||||
</navigator>
|
</navigator>
|
||||||
<panes>
|
<panes>
|
||||||
|
<pane id="Scope" />
|
||||||
<pane id="ProjectPane">
|
<pane id="ProjectPane">
|
||||||
<subPane>
|
<subPane>
|
||||||
<expand>
|
<expand>
|
||||||
<path>
|
<path>
|
||||||
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
|
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
|
||||||
<item name="DynuIPRefresher" type="462c0819:PsiDirectoryNode" />
|
<item name="iprefresher" type="462c0819:PsiDirectoryNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
|
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
|
||||||
<item name="DynuIPRefresher" type="462c0819:PsiDirectoryNode" />
|
<item name="iprefresher" type="462c0819:PsiDirectoryNode" />
|
||||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
|
||||||
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
|
|
||||||
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="iprefresher" type="b2602c69:ProjectViewProjectNode" />
|
|
||||||
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
|
|
||||||
<item name="Header Search Paths" type="70bed36:NamedLibraryElementNode" />
|
|
||||||
</path>
|
|
||||||
</expand>
|
</expand>
|
||||||
<select />
|
<select />
|
||||||
</subPane>
|
</subPane>
|
||||||
</pane>
|
</pane>
|
||||||
<pane id="Scope" />
|
|
||||||
</panes>
|
</panes>
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
@ -230,6 +166,7 @@
|
|||||||
<workItem from="1556710548728" duration="6200000" />
|
<workItem from="1556710548728" duration="6200000" />
|
||||||
<workItem from="1557047487321" duration="761000" />
|
<workItem from="1557047487321" duration="761000" />
|
||||||
<workItem from="1557061811880" duration="10758000" />
|
<workItem from="1557061811880" duration="10758000" />
|
||||||
|
<workItem from="1557135515205" duration="1933000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="edited api class and made it to work">
|
<task id="LOCAL-00001" summary="edited api class and made it to work">
|
||||||
<created>1557063528491</created>
|
<created>1557063528491</created>
|
||||||
@ -266,28 +203,35 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1557067359327</updated>
|
<updated>1557067359327</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="6" />
|
<task id="LOCAL-00006" summary="syntax update and sperate variable for dynu domain id">
|
||||||
|
<created>1557128368242</created>
|
||||||
|
<option name="number" value="00006" />
|
||||||
|
<option name="presentableId" value="LOCAL-00006" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1557128368242</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="7" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="23609000" />
|
<option name="totallyTimeSpent" value="28207000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="1919" y="0" width="1922" height="1081" extended-state="6" />
|
<frame x="-1" y="25" width="1922" height="1056" extended-state="6" />
|
||||||
<editor active="true" />
|
<editor active="true" />
|
||||||
<layout>
|
<layout>
|
||||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.26040554" />
|
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25773746" />
|
||||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||||
<window_info id="Favorites" order="2" side_tool="true" />
|
<window_info id="Favorites" order="2" side_tool="true" />
|
||||||
<window_info anchor="bottom" id="Message" order="0" />
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
<window_info anchor="bottom" id="Find" order="1" />
|
<window_info anchor="bottom" id="Find" order="1" />
|
||||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.31875" />
|
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.3187166" />
|
||||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||||
<window_info anchor="bottom" id="TODO" order="6" />
|
<window_info anchor="bottom" id="TODO" order="6" />
|
||||||
<window_info anchor="bottom" id="Database Changes" order="7" />
|
<window_info anchor="bottom" id="Database Changes" order="7" />
|
||||||
<window_info anchor="bottom" id="Messages" order="8" weight="0.32708332" />
|
<window_info anchor="bottom" id="Messages" order="8" weight="0.3262032" />
|
||||||
<window_info anchor="bottom" id="Terminal" order="9" />
|
<window_info anchor="bottom" id="Terminal" order="9" />
|
||||||
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
|
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
|
||||||
<window_info anchor="bottom" id="Version Control" order="11" />
|
<window_info anchor="bottom" id="Version Control" order="11" />
|
||||||
@ -306,7 +250,8 @@
|
|||||||
<MESSAGE value="deleted cmake files" />
|
<MESSAGE value="deleted cmake files" />
|
||||||
<MESSAGE value="added loggin methods" />
|
<MESSAGE value="added loggin methods" />
|
||||||
<MESSAGE value="log on error" />
|
<MESSAGE value="log on error" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="log on error" />
|
<MESSAGE value="syntax update and sperate variable for dynu domain id" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="syntax update and sperate variable for dynu domain id" />
|
||||||
</component>
|
</component>
|
||||||
<component name="editorHistoryManager">
|
<component name="editorHistoryManager">
|
||||||
<entry file="file://$PROJECT_DIR$/test.cpp" />
|
<entry file="file://$PROJECT_DIR$/test.cpp" />
|
||||||
@ -323,13 +268,7 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/out.myfile">
|
<entry file="file://$PROJECT_DIR$/cmake-build-debug/out.myfile" />
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="15">
|
|
||||||
<caret line="1" column="6" selection-start-line="1" selection-start-column="6" selection-end-line="1" selection-end-column="6" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/Logger.h">
|
<entry file="file://$PROJECT_DIR$/src/Logger.h">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="150">
|
<state relative-caret-position="150">
|
||||||
@ -337,26 +276,8 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/Logger.cpp">
|
<entry file="file://$PROJECT_DIR$/cmake-build-debug/dynurefresher.log" />
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<entry file="file://$PROJECT_DIR$/cmake-build-debug/ip.txt" />
|
||||||
<state relative-caret-position="555">
|
|
||||||
<caret line="37" column="38" selection-start-line="37" selection-start-column="38" selection-end-line="37" selection-end-column="38" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#40#58#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/dynurefresher.log">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="195">
|
|
||||||
<caret line="13" column="31" selection-start-line="13" selection-start-column="31" selection-end-line="13" selection-end-column="31" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/ip.txt">
|
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/API.h">
|
<entry file="file://$PROJECT_DIR$/src/API.h">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="195">
|
<state relative-caret-position="195">
|
||||||
@ -374,20 +295,28 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt">
|
<entry file="file://$PROJECT_DIR$/cmake-build-debug/CMakeCache.txt" />
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="90">
|
<state relative-caret-position="75">
|
||||||
<caret line="6" column="40" lean-forward="true" selection-start-line="6" selection-start-column="40" selection-end-line="6" selection-end-column="40" />
|
<caret line="5" column="27" selection-start-line="5" selection-start-column="27" selection-end-line="5" selection-end-column="27" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/Logger.cpp">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="360">
|
||||||
|
<caret line="24" column="18" selection-start-line="24" selection-start-column="18" selection-end-line="24" selection-end-column="18" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#40#58#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
<entry file="file://$PROJECT_DIR$/src/main.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="240">
|
<state relative-caret-position="211">
|
||||||
<caret line="16" column="69" selection-start-line="16" selection-start-column="69" selection-end-line="16" selection-end-column="69" />
|
<caret line="30" column="32" selection-start-line="30" selection-start-column="32" selection-end-line="30" selection-end-column="32" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#19#0" expanded="true" />
|
<element signature="e#0#19#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
74
src/main.cpp
74
src/main.cpp
@ -4,50 +4,62 @@
|
|||||||
#include "API.h"
|
#include "API.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
int main() {
|
int main(int argc, char *argv[]) {
|
||||||
API api;
|
|
||||||
Logger logger;
|
if(argc > 1){
|
||||||
|
std::string firstarg(argv[1]);
|
||||||
|
if (firstarg == "-h" || firstarg == "--help"){
|
||||||
|
std::cout << "help page: " << std::endl << "[-h] [--help] print this help page" << std::endl << "[-v] [--version] print the software version" <<std::endl << "[no argument] normal ip check and refresh" << std::endl;
|
||||||
|
}else if(firstarg == "-v" || firstarg == "--version"){
|
||||||
|
std::cout << "Version 1.0" << std::endl;
|
||||||
|
}else{
|
||||||
|
std::cout << "wrong arguments! -h for help" << std::endl;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
API api;
|
||||||
|
Logger logger;
|
||||||
|
|
||||||
|
|
||||||
std::string ip = api.request("https://api.ipify.org");
|
std::string ip = api.request("https://api.ipify.org");
|
||||||
|
|
||||||
if (ip == "") {
|
if (ip == "") {
|
||||||
//no internet connection
|
//no internet connection
|
||||||
logger.logToLogfile("[WARNING] no internet connection");
|
logger.logToLogfile("[WARNING] no internet connection");
|
||||||
std::cout << "[WARNING] no internet connection" << std::endl;
|
std::cout << "[WARNING] no internet connection" << std::endl;
|
||||||
|
|
||||||
} else {
|
|
||||||
std::string oldip = logger.readip();
|
|
||||||
|
|
||||||
if (oldip == ip) {
|
|
||||||
std::cout << "no change -- ip: " << ip << std::endl;
|
|
||||||
logger.logToLogfile(" [INFO] no change -- ip: " + ip);
|
|
||||||
} else {
|
} else {
|
||||||
logger.logToLogfile(" [INFO] ip changed! -- from :" + oldip + "to: " + ip);
|
std::string oldip = logger.readip();
|
||||||
std::cout << "ip changed! -- from :" << oldip << "to: " << ip << std::endl;
|
|
||||||
|
|
||||||
//dynu api key: 88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg
|
if (oldip == ip) {
|
||||||
|
std::cout << "no change -- ip: " << ip << std::endl;
|
||||||
|
logger.logToLogfile(" [INFO] no change -- ip: " + ip);
|
||||||
|
} else {
|
||||||
|
logger.logToLogfile(" [INFO] ip changed! -- from :" + oldip + "to: " + ip);
|
||||||
|
std::cout << "ip changed! -- from :" << oldip << "to: " << ip << std::endl;
|
||||||
|
|
||||||
static std::string domainid = "8506047"; //id of the dynu domain
|
//dynu api key: 88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg
|
||||||
|
|
||||||
Hashmap<std::string, std::string> args;
|
static std::string domainid = "8506047"; //id of the dynu domain
|
||||||
args.add("name", "luki.dynu.net");
|
|
||||||
args.add("ipv4Address", ip);
|
|
||||||
|
|
||||||
std::vector<std::string> headers;
|
Hashmap<std::string, std::string> args;
|
||||||
headers.push_back("accept: application/json");
|
args.add("name", "luki.dynu.net");
|
||||||
headers.push_back("User-Agent: Mozilla/5.0 (compatible; Rigor/1.0.0; http://rigor.com)");
|
args.add("ipv4Address", ip);
|
||||||
headers.push_back("API-Key: 88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg");
|
|
||||||
|
|
||||||
std::string dynurepl = api.request("https://api.dynu.com/v2/dns/" + domainid, true, args, headers);
|
std::vector<std::string> headers;
|
||||||
|
headers.push_back("accept: application/json");
|
||||||
|
headers.push_back("User-Agent: Mozilla/5.0 (compatible; Rigor/1.0.0; http://rigor.com)");
|
||||||
|
headers.push_back("API-Key: 88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg");
|
||||||
|
|
||||||
std::cout << "[ DEBUG ] api reply:: " << dynurepl << std::endl;
|
std::string dynurepl = api.request("https://api.dynu.com/v2/dns/" + domainid, true, args, headers);
|
||||||
|
|
||||||
if (dynurepl != "{\"statusCode\":200}") {
|
std::cout << "[ DEBUG ] api reply:: " << dynurepl << std::endl;
|
||||||
logger.logToLogfile(" [ERROR] failed to write ip to dynu api!");
|
|
||||||
|
if (dynurepl != "{\"statusCode\":200}") {
|
||||||
|
logger.logToLogfile(" [ERROR] failed to write ip to dynu api!");
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.safeip(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.safeip(ip);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user